eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py

branch
without_py2_and_pyqt4
changeset 7201
6b42677d7043
parent 7192
a22eee00b052
child 7229
53054eb5b15a
equal deleted inserted replaced
7200:ebab8ba287e6 7201:6b42677d7043
12 12
13 import os 13 import os
14 import tempfile 14 import tempfile
15 15
16 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize 16 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize
17 from PyQt5.QtGui import QTextCursor, QCursor 17 from PyQt5.QtGui import QTextCursor
18 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \ 18 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \
19 QTreeWidgetItem, QLineEdit, QInputDialog, QToolTip 19 QTreeWidgetItem, QLineEdit, QInputDialog
20 20
21 from E5Gui.E5Application import e5App 21 from E5Gui.E5Application import e5App
22 from E5Gui import E5MessageBox 22 from E5Gui import E5MessageBox
23 23
24 from Globals import qVersionTuple, strToQByteArray 24 from Globals import strToQByteArray
25 25
26 from .Ui_GitStatusDialog import Ui_GitStatusDialog 26 from .Ui_GitStatusDialog import Ui_GitStatusDialog
27 27
28 from .GitDiffHighlighter import GitDiffHighlighter 28 from .GitDiffHighlighter import GitDiffHighlighter
29 from .GitDiffGenerator import GitDiffGenerator 29 from .GitDiffGenerator import GitDiffGenerator
180 """ 180 """
181 Private method to initialize the actions menu. 181 Private method to initialize the actions menu.
182 """ 182 """
183 self.__actionsMenu = QMenu() 183 self.__actionsMenu = QMenu()
184 self.__actionsMenu.setTearOffEnabled(True) 184 self.__actionsMenu.setTearOffEnabled(True)
185 if qVersionTuple() >= (5, 1, 0): 185 self.__actionsMenu.setToolTipsVisible(True)
186 self.__actionsMenu.setToolTipsVisible(True)
187 else:
188 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered)
189 self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu) 186 self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu)
190 187
191 self.__commitAct = self.__actionsMenu.addAction( 188 self.__commitAct = self.__actionsMenu.addAction(
192 self.tr("Commit"), self.__commit) 189 self.tr("Commit"), self.__commit)
193 self.__commitAct.setToolTip(self.tr("Commit the selected changes")) 190 self.__commitAct.setToolTip(self.tr("Commit the selected changes"))
259 "Adjusts the width of all columns to their contents")) 256 "Adjusts the width of all columns to their contents"))
260 257
261 self.actionsButton.setIcon( 258 self.actionsButton.setIcon(
262 UI.PixmapCache.getIcon("actionsToolButton.png")) 259 UI.PixmapCache.getIcon("actionsToolButton.png"))
263 self.actionsButton.setMenu(self.__actionsMenu) 260 self.actionsButton.setMenu(self.__actionsMenu)
264
265 def __actionsMenuHovered(self, action):
266 """
267 Private slot to show the tooltip for an action menu entry.
268
269 @param action action to show tooltip for
270 @type QAction
271 """
272 QToolTip.showText(
273 QCursor.pos(), action.toolTip(),
274 self.__actionsMenu, self.__actionsMenu.actionGeometry(action))
275 261
276 def closeEvent(self, e): 262 def closeEvent(self, e):
277 """ 263 """
278 Protected slot implementing a close event handler. 264 Protected slot implementing a close event handler.
279 265

eric ide

mercurial