15 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ |
15 from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ |
16 QSize, QPoint, QFileInfo |
16 QSize, QPoint, QFileInfo |
17 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QIcon, \ |
17 from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QIcon, \ |
18 QTextCursor |
18 QTextCursor |
19 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
19 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ |
20 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog, QToolTip |
20 QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog |
21 |
21 |
22 from E5Gui.E5Application import e5App |
22 from E5Gui.E5Application import e5App |
23 from E5Gui import E5MessageBox, E5FileDialog |
23 from E5Gui import E5MessageBox, E5FileDialog |
24 |
24 |
25 from Globals import qVersionTuple, strToQByteArray |
25 from Globals import strToQByteArray |
26 |
26 |
27 from .Ui_GitLogBrowserDialog import Ui_GitLogBrowserDialog |
27 from .Ui_GitLogBrowserDialog import Ui_GitLogBrowserDialog |
28 |
28 |
29 from .GitDiffHighlighter import GitDiffHighlighter |
29 from .GitDiffHighlighter import GitDiffHighlighter |
30 from .GitDiffGenerator import GitDiffGenerator |
30 from .GitDiffGenerator import GitDiffGenerator |
299 """ |
299 """ |
300 Private method to initialize the actions menu. |
300 Private method to initialize the actions menu. |
301 """ |
301 """ |
302 self.__actionsMenu = QMenu() |
302 self.__actionsMenu = QMenu() |
303 self.__actionsMenu.setTearOffEnabled(True) |
303 self.__actionsMenu.setTearOffEnabled(True) |
304 if qVersionTuple() >= (5, 1, 0): |
304 self.__actionsMenu.setToolTipsVisible(True) |
305 self.__actionsMenu.setToolTipsVisible(True) |
|
306 else: |
|
307 self.__actionsMenu.hovered.connect(self.__actionsMenuHovered) |
|
308 |
305 |
309 self.__cherryAct = self.__actionsMenu.addAction( |
306 self.__cherryAct = self.__actionsMenu.addAction( |
310 self.tr("Copy Commits"), self.__cherryActTriggered) |
307 self.tr("Copy Commits"), self.__cherryActTriggered) |
311 self.__cherryAct.setToolTip(self.tr( |
308 self.__cherryAct.setToolTip(self.tr( |
312 "Cherry-pick the selected commits to the current branch")) |
309 "Cherry-pick the selected commits to the current branch")) |
344 "Show the most recent tag reachable from a commit")) |
341 "Show the most recent tag reachable from a commit")) |
345 |
342 |
346 self.actionsButton.setIcon( |
343 self.actionsButton.setIcon( |
347 UI.PixmapCache.getIcon("actionsToolButton.png")) |
344 UI.PixmapCache.getIcon("actionsToolButton.png")) |
348 self.actionsButton.setMenu(self.__actionsMenu) |
345 self.actionsButton.setMenu(self.__actionsMenu) |
349 |
|
350 def __actionsMenuHovered(self, action): |
|
351 """ |
|
352 Private slot to show the tooltip for an action menu entry. |
|
353 |
|
354 @param action action to show tooltip for |
|
355 @type QAction |
|
356 """ |
|
357 QToolTip.showText( |
|
358 QCursor.pos(), action.toolTip(), |
|
359 self.__actionsMenu, self.__actionsMenu.actionGeometry(action)) |
|
360 |
346 |
361 def __initData(self): |
347 def __initData(self): |
362 """ |
348 """ |
363 Private method to (re-)initialize some data. |
349 Private method to (re-)initialize some data. |
364 """ |
350 """ |