Details
-
Suggestion
-
Resolution: Fixed
-
P3: Somewhat important
-
5.15.2, 6.4.2
-
None
-
-
7689d4ad2 (dev), c5479c9b2 (6.4), 5baf64466 (6.5), 593ffd385 (dev), 379649dd8 (6.4), 0c8335575 (6.5)
Description
Consider the following code:
#include <QApplication> #include <QDebug> #include <QLabel> #include <QVBoxLayout> class Widget : public QWidget { protected: void mousePressEvent(QMouseEvent *event) override { qInfo() << "pressed" << event; } void mouseReleaseEvent(QMouseEvent *event) override { qInfo() << "released" << event; } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; auto layout = new QVBoxLayout(&w); auto label1 = new QLabel("<b>rich text DOES NOT pass mouse release event to parent</b>"); layout->addWidget(label1); auto label2 = new QLabel("plain text DOES pass mouse release event to parent"); layout->addWidget(label2); w.show(); return a.exec(); }
When clicking on the plain text label, BOTH mouse press and mouse release events are passed to the parent and written to console.
But when clicking on the rich text (HTML formatted) label, ONLY mouse press event is passed to the parent. Mouse release event gets lost somewhere.
This is a very surprising behaviour and as such I assess it to be a bug.