Important: Please read the Qt Code of Conduct -

Open a link when clicking on a QLabel that contains a QPixmap

  • Is there a simple way to open a link when the QLabel is clicked?

  • @turbedi

    To handle a Click on a QLabel you need to install an eventFilter.

    For example

    void MyClass::MyClass (QWidget *parent) {
      //QLabel *mylabel; can be found in the header file 
      mylabel = new QLabel;
    bool MyClass::eventFilter(QObject *object, QEvent *event) {
      if(object == mylabel && event->type() == QEvent::MouseButtonPress) {
        //do something
      return QObject::eventFilter(object, event);

    What is done in the eventFilter depends on how you want open the link.

Log in to reply