[qt4] enable Ctrl-Q even if the window toolbar is hidden (closes #109856)

The Ctrl-Q keybinding is related to the action actionQuit which is added into the window toolbar only. Adding it to the mainwindow let him active even if the window toolbar is hidden.

How to test

Start hgview, then hide the toolbar containing the quit button. Now hitting Ctrl-Q shall close the window.

authorAlain Leufroy <alain@leufroy.fr>
changeset1631798f68b3
branchdefault
phasepublic
hiddenno
parent revision#d0a1583639e5 [qt4] new signal style: fix typo
child revision#c52c2c5cbded [qt4] remove quit button from toolbar (closes #50416)
files modified by this revision
hgviewlib/qt4/hgfiledialog.py
hgviewlib/qt4/hgmanifestdialog.py
hgviewlib/qt4/hgrepoviewer.py
# HG changeset patch
# User Alain Leufroy <alain@leufroy.fr>
# Date 1371161058 -7200
# Fri Jun 14 00:04:18 2013 +0200
# Node ID 1631798f68b3758252d0718c912b530b09bda133
# Parent d0a1583639e5af6f28dc38f7366440943e67642e
[qt4] enable Ctrl-Q even if the window toolbar is hidden (closes #109856)

The ``Ctrl-Q`` keybinding is related to the action ``actionQuit``
which is added into the window toolbar only.
Adding it to the mainwindow let him active even if the
window toolbar is hidden.

.. admonition:: How to test

Start hgview, then hide the toolbar containing the quit button.
Now hitting ``Ctrl-Q`` shall close the window.

diff --git a/hgviewlib/qt4/hgfiledialog.py b/hgviewlib/qt4/hgfiledialog.py
@@ -160,10 +160,11 @@
1          self.find_toolbar.setMode('file')
2          self.filerevmodel.setFilename(self.filename)
3 
4      def createActions(self):
5          self.actionClose.triggered.connect(self.close)
6 +        self.addAction(self.actionClose)
7          self.actionReload.triggered.connect(self.reload)
8          self.actionClose.setIcon(geticon('quit'))
9          self.actionReload.setIcon(geticon('reload'))
10 
11          self.actionDiffMode = QtGui.QAction('Diff mode', self)
@@ -307,10 +308,11 @@
12          self.tableView_revisions_left.setModel(self.filerevmodel)
13          self.tableView_revisions_right.setModel(self.filerevmodel)
14 
15      def createActions(self):
16          self.actionClose.triggered.connect(self.close)
17 +        self.addAction(self.actionClose)
18          self.actionReload.triggered.connect(self.reload)
19          self.actionClose.setIcon(geticon('quit'))
20          self.actionReload.setIcon(geticon('reload'))
21 
22          self.actionNextDiff = QtGui.QAction(geticon('down'), 'Next diff', self)
diff --git a/hgviewlib/qt4/hgmanifestdialog.py b/hgviewlib/qt4/hgmanifestdialog.py
@@ -65,10 +65,11 @@
23              self.fileSelected)
24 
25      def createActions(self):
26          self.actionClose.triggered.connect(self.close)
27          self.actionClose.setIcon(geticon('quit'))
28 +        self.addAction(self.actionClose)
29 
30      def setupTextview(self):
31          lay = QtGui.QHBoxLayout(self.mainFrame)
32          lay.setSpacing(0)
33          lay.setContentsMargins(0,0,0,0)
diff --git a/hgviewlib/qt4/hgrepoviewer.py b/hgviewlib/qt4/hgrepoviewer.py
@@ -273,10 +273,12 @@
34          if self.textview_header.rst_action is not None:
35              self.toolBar_rev.addAction(self.textview_header.rst_action)
36 
37          self._handle_toolbar_visibility()
38 
39 +        self.addAction(self.actionQuit)
40 +
41      def _handle_toolbar_visibility(self):
42          """Initial value and event hooking
43 
44          This function read toolbar related persistent settings from QT API.
45          It also setup hooks on visibility changes so to make the setting