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()'!