Results 1 to 2 of 2

Thread: An interesting problem when using QMenu::aboutToShow() signal!!

  1. #1
    Join Date
    Jul 2010
    Posts
    41
    Thanks
    6
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Exclamation An interesting problem when using QMenu::aboutToShow() signal!!

    I subclass QToolBar and create some QToolButtons and create and set menu for every QToolButton, all things work good until I connect 'QMenu::aboutToShow()' to a 'SLOT'!! And then I see that menus are showed in an incorrect position!!!
    when I looked at 'qtoolbutton.cpp' I see this code:
    Qt Code:
    1. void QToolButtonPrivate::popupTimerDone()
    2. {
    3. ...
    4. QPoint p;
    5. QRect screen = QApplication::desktop()->availableGeometry(q);
    6. QSize sh = ((QToolButton*)(QMenu*)actualMenu)->receivers(SIGNAL(aboutToShow()))? QSize() : actualMenu->sizeHint();
    7. QRect rect = q->rect();
    8. ...
    9. //computing 'p'! 'sh' is used in this computation
    10. ...
    11. actualMenu->exec(p);
    12. ...
    13. }
    To copy to clipboard, switch view to plain text mode 
    I can't understand using 'QObject::receivers(const char *signal)' in such a bad way!!!!! Why we should get different results just because of creating a connection!!!!?
    It's unbelievable...

    For solving the problem I use 'QEvent::Show' in replace of 'QMenu::aboutToShow()'!

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: An interesting problem when using QMenu::aboutToShow() signal!!

    Every library ever created contains many unbelieveable things. And I mean it literally.

    Sending a neutral bug report might advance things.

Similar Threads

  1. problem with aboutToHide signal on QMenu
    By eric_vi in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2010, 17:05
  2. signal -slot mechanism!! an interesting problem!!!
    By qt_user in forum Qt Programming
    Replies: 6
    Last Post: 5th August 2010, 11:20
  3. Replies: 4
    Last Post: 3rd August 2010, 12:30
  4. Replies: 1
    Last Post: 29th February 2008, 23:04
  5. Interesting little Segfault w/r to signal/slot connection
    By Hydragyrum in forum Qt Programming
    Replies: 24
    Last Post: 12th September 2006, 19:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.