[Interest] adding widget into a mousePressEvent

Carlos Agon agonc at ircam.fr
Sat Jun 20 10:28:46 CEST 2020


Hello 

I would like to add a button to my view at each time I click, but my code doesn't work, it prints the message "click enter" but nothing is added. What is wrong with this code ?

thanks

Carlos (newbie at this list)

======

class ShView :public QFrame {
protected:
   void mousePressEvent(QMouseEvent *event) override;
}

void ShView::mousePressEvent(QMouseEvent *event) {
   std::cout << " click enter " << std::endl;
   QPushButton * child = new QPushButton ("push",this);
}


More information about the Interest mailing list