Make QLabel clickable

I do not understand why you pass QMouseEvent to the parent constructor, you must pass the parent attribute as shown below: class QLabel_alterada(QLabel): clicked=pyqtSignal() def mousePressEvent(self, ev): self.clicked.emit() To avoid having problems with imports we can directly promote the widget as shown below: We place a QLabel and right click and choose Promote to …: … Read more

QLabel does not display in QWidget

Widgets when they are visible for the first time call to be visible to their children, but since you are creating it afterwards they probably are not calling that method, a possible solution is to call the show method. void ChatWidget::displayChatAfterButtonPressed() { QLabel *lbl; lbl=new QLabel(this); lbl->setText(“Hello World 2”); lbl->show(); } comment: it seems strange … Read more