Add menubar/toolbar context menu explicitly
Previously it was somehow automatically generated. Unfortunately it caused SEGV in libQtCore (4.8).
This commit is contained in:
parent
6b03b6dd1b
commit
fd330c283d
@ -232,6 +232,9 @@
|
|||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<widget class="QMenu" name="menu_system">
|
<widget class="QMenu" name="menu_system">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>System</string>
|
<string>System</string>
|
||||||
@ -324,6 +327,9 @@
|
|||||||
<property name="floatable">
|
<property name="floatable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<attribute name="toolBarArea">
|
<attribute name="toolBarArea">
|
||||||
<enum>TopToolBarArea</enum>
|
<enum>TopToolBarArea</enum>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -785,10 +785,18 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
self.context_menu.addMenu(self.logs_menu)
|
self.context_menu.addMenu(self.logs_menu)
|
||||||
self.context_menu.addSeparator()
|
self.context_menu.addSeparator()
|
||||||
|
|
||||||
|
self.tools_context_menu = QMenu(self)
|
||||||
|
self.tools_context_menu.addAction(self.action_toolbar)
|
||||||
|
self.tools_context_menu.addAction(self.action_menubar)
|
||||||
|
|
||||||
self.table_selection_changed()
|
self.table_selection_changed()
|
||||||
|
|
||||||
self.connect(self.table.horizontalHeader(), SIGNAL("sortIndicatorChanged(int, Qt::SortOrder)"), self.sortIndicatorChanged)
|
self.connect(self.table.horizontalHeader(), SIGNAL("sortIndicatorChanged(int, Qt::SortOrder)"), self.sortIndicatorChanged)
|
||||||
self.connect(self.table, SIGNAL("customContextMenuRequested(const QPoint&)"), self.open_context_menu)
|
self.connect(self.table, SIGNAL("customContextMenuRequested(const QPoint&)"), self.open_context_menu)
|
||||||
|
self.connect(self.menubar, SIGNAL("customContextMenuRequested(const QPoint&)"),
|
||||||
|
lambda pos: self.open_tools_context_menu(self.menubar, pos))
|
||||||
|
self.connect(self.toolBar, SIGNAL("customContextMenuRequested(const QPoint&)"),
|
||||||
|
lambda pos: self.open_tools_context_menu(self.toolBar, pos))
|
||||||
self.connect(self.blk_menu, SIGNAL("triggered(QAction *)"), self.attach_dettach_device_triggered)
|
self.connect(self.blk_menu, SIGNAL("triggered(QAction *)"), self.attach_dettach_device_triggered)
|
||||||
self.connect(self.logs_menu, SIGNAL("triggered(QAction *)"), self.show_log)
|
self.connect(self.logs_menu, SIGNAL("triggered(QAction *)"), self.show_log)
|
||||||
|
|
||||||
@ -1649,6 +1657,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
menu.addAction(self.action_menubar)
|
menu.addAction(self.action_menubar)
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
|
def open_tools_context_menu(self, widget, point):
|
||||||
|
self.tools_context_menu.exec_(widget.mapToGlobal(point))
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot('const QPoint&')
|
@pyqtSlot('const QPoint&')
|
||||||
def open_context_menu(self, point):
|
def open_context_menu(self, point):
|
||||||
|
Loading…
Reference in New Issue
Block a user