- QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + proxyText + " ");
- painter->setPen(Qt::NoPen);
- painter->setBrush(option.palette.highlight());
- painter->drawRoundedRect(txtBounding, 2, 2);
- painter->setPen(option.palette.highlightedText().color());
- painter->drawText(txtBounding, Qt::AlignHCenter | Qt::AlignVCenter , proxyText);
+ if (!proxyText.isEmpty()) {
+ QRectF txtBounding = painter->boundingRect(r2, Qt::AlignRight | Qt::AlignVCenter, " " + proxyText + " ");
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(option.palette.highlight());
+ painter->drawRoundedRect(txtBounding, 2, 2);
+ painter->setPen(option.palette.highlightedText().color());
+ painter->drawText(txtBounding, Qt::AlignHCenter | Qt::AlignVCenter , proxyText);
+ }