19 #include <QApplication> 25 setTextFormat(Qt::RichText);
29 setOpenExternalLinks(
true);
61 QPalette palette = QApplication::palette();
63 setTextInteractionFlags(Qt::LinksAccessibleByKeyboard |
64 Qt::LinksAccessibleByMouse |
65 Qt::TextSelectableByMouse);
70 (QString(
"QLabel:hover { background: %1; color: %3; } " 71 "QLabel:!hover { background: %2; color: %3 } " 72 "QLabel { padding: 7px }")
73 .arg(palette.mid().color().lighter(120).name())
74 .arg(palette.mid().color().lighter(140).name())
75 .arg(palette.text().color().name()));
79 (QString(
"QLabel:hover { background: %1; color: %3; } " 80 "QLabel:!hover { background: %2; color: %3 } " 81 "QLabel { padding: 7px }")
82 .arg(palette.button().color().name())
83 .arg(palette.light().color().name())
84 .arg(palette.text().color().name()));
99 parentWidget()->resize(parentWidget()->sizeHint());
113 QLabel::mousePressEvent(e);
120 QLabel::mouseDoubleClickEvent(e);
SelectableLabel(QWidget *parent=0)
void enterEvent(QEvent *) override
void mouseDoubleClickEvent(QMouseEvent *e) override
void mouseReleaseEvent(QMouseEvent *e) override
virtual ~SelectableLabel()
void setUnselectedText(QString)
void setSelectedText(QString)
void mousePressEvent(QMouseEvent *e) override
void leaveEvent(QEvent *) override