You can subclass a QLabel and append the clik event how you like.
void FullEdit::PaintDirtyStatus( bool e )
{
QString textd
= "nulltext overwrite";
QPixmap pix
(140,
22);
///// take from label if (e) {
pix.
fill(QColor("crimson"));
/* red */ textd = tr("Upload Pending.");
} else {
pix.
fill(QColor("lime"));
/* green */ textd = tr("Not Upload.");
}
pen.setStyle( Qt::SolidLine );
pen.setColor(textColor);
painter.setFont( f );
painter.setPen( pen);
int largo = fm.width(textd);
painter.
drawText(QPointF((pix.
width() / 2) - (largo
/ 2),
15),textd
);
dirtystartus->setPixmap(pix); /* label */
}
void FullEdit::PaintDirtyStatus( bool e )
{
QString textd = "nulltext overwrite";
QPixmap pix(140,22); ///// take from label
if (e) {
pix.fill(QColor("crimson")); /* red */
textd = tr("Upload Pending.");
} else {
pix.fill(QColor("lime")); /* green */
textd = tr("Not Upload.");
}
QPainter painter(&pix);
QColor textColor = QColor(255,255,255);
QPen pen;
pen.setStyle( Qt::SolidLine );
pen.setColor(textColor);
QFont f( "arial", 8, QFont::Bold );
painter.setFont( f );
painter.setPen( pen);
QFontMetrics fm = painter.fontMetrics();
int largo = fm.width(textd);
painter.drawText(QPointF((pix.width() / 2) - (largo / 2),15),textd);
dirtystartus->setPixmap(pix); /* label */
}
To copy to clipboard, switch view to plain text mode
Bookmarks