[Qt-interest] QGLWidget Popup menu: QAction not clickable
Marco Arena
marcoarena at email.it
Mon Oct 18 15:39:37 CEST 2010
I solved, thanks anyway!
Marco
Il 18/10/2010 10:00, Marco Arena ha scritto:
> Hi,
> I've written a simple OpenGL renderer (overriding /QGLWidget/ class)
> and I've overrided the /mouseReleaseEvent/ function to show a popup
> menu when I right click. This is the method:
>
> void myViewer::mouseReleaseEvent ( QMouseEvent * event )
> {
> if(event->button() == Qt::RightButton)
> {
> QMenu *menu = new QMenu("&Menu",this);
>
> QAction* action_1 = new QAction("&A", this);
> QAction* action_2 = new QAction("&B", this);
> QAction* action_3 = new QAction("&C", this);
>
> menu->addAction(action_1);
> menu->addAction(action_2);
> menu->addAction(action_3);
>
> connect(action_1, SIGNAL(triggered()), this, SLOT(slot_action_1()));
> connect(action_2, SIGNAL(triggered()), this, SLOT(slot_action_2()));
> connect(action_3, SIGNAL(triggered()), this, SLOT(slot_action_3()));
>
>
> menu->exec(mapToGlobal(event->pos()));
> delete menu;
> }
> }
>
> The menu is shown as expected but when I try to click a menu item this
> seems inactive and the corresponding slot isn't called. What's wrong
> with this? I thought it was a focus problem but I wrote a similar code
> for a QTextEdit and it worked fine. I'm using Qt 4.6 on MS Visual
> Studio 2008 pro.
>
> Thanks!
>
> Marco
>
>
> ----
> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e
> SMTP autenticato? GRATIS solo con Email.it
> <http://www.email.it/cgi-bin/start?sid=3>
>
> Sponsor:
> Vuoi farti o vuoi fare un regalo originale? Visita MisterCupido.com e
> personalizza con foto: quadri, tazze, puzzle, cuscini, magliette,
> peluche, borse, portachiavi...
> Clicca qui <http://adv.email.it/cgi-bin/foclick.cgi?mid=11030&d=18-10>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
Sponsor:
Prova subito Emailpaghe, e' in prova gratuita sino al 31 dicembre 2010
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=10679&d=18-10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101018/8d4cb2cc/attachment.html
More information about the Qt-interest-old
mailing list