How to show the menu in QPushButton without blocking?
问题 I use Qt4 QPushButton with QMenu in it (set by setMenu() ). I need to show this menu when some unrelated event occurs. Method QPushButton::showMenu() does this, but it blocks until user closes the menu. QMenu::show() also does this, but it shows the menu in the top left corner of the screen. How can I programmatically make the menu show up properly positioned, and without blocking? 回答1: QMenu is QWidget . So you can call move() before show() . 回答2: You can use void QMenu::popup ( const QPoint