[Interest] adding widget into a mousePressEvent

Carlos Agon agonc at ircam.fr
Sat Jun 20 19:15:56 CEST 2020


Hi Volker

Thanks, it works !

André Pönits thanks to you too. I had made a bad test.

Bye

Carlos

> Le 20 juin 2020 à 18:25, Volker Hilsheimer <volker.hilsheimer at qt.io> a écrit :
> 
> You have to show widgets that you add to parents that are already visible.
> Cheers,
> Volker
> 
> 
> From: Interest <interest-bounces at qt-project.org> on behalf of Carlos Agon <agonc at ircam.fr>
> Sent: Saturday, June 20, 2020 10:28:46 AM
> To: interest at qt-project.org <interest at qt-project.org>
> Subject: [Interest] adding widget into a mousePressEvent
>  
> 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);
> }
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest <https://lists.qt-project.org/listinfo/interest>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200620/b136b4ae/attachment.html>


More information about the Interest mailing list