|
16 | 16 | from pathlib import Path |
17 | 17 |
|
18 | 18 | import __main__ |
19 | | -import Qt as Qt_py |
20 | 19 | from Qt import QtCompat, QtCore, QtWidgets |
21 | 20 | from Qt.QtCore import QByteArray, QFileSystemWatcher, QObject, Qt, QTimer, Signal, Slot |
22 | | -from Qt.QtGui import QCursor, QFont, QIcon, QKeySequence, QTextCursor |
| 21 | +from Qt.QtGui import QFont, QIcon, QKeySequence, QTextCursor |
23 | 22 | from Qt.QtWidgets import ( |
24 | 23 | QApplication, |
25 | 24 | QFontDialog, |
|
45 | 44 | resourcePath, |
46 | 45 | ) |
47 | 46 | from ..delayable_engine import DelayableEngine |
48 | | -from ..gui import Dialog, Window, loadUi, tab_widget_for_tab |
| 47 | +from ..gui import Dialog, Window, handleMenuHovered, loadUi, tab_widget_for_tab |
49 | 48 | from ..gui.fuzzy_search.fuzzy_search import FuzzySearch |
50 | 49 | from ..gui.group_tab_widget.grouped_tab_models import GroupTabListItemModel |
51 | 50 | from ..logging_config import LoggingConfig |
@@ -210,7 +209,7 @@ def __init__(self, parent, name=None, run_workbox=False, standalone=False): |
210 | 209 | action.setObjectName('uiCycleModeACT') |
211 | 210 | action.setShortcut(QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_M)) |
212 | 211 | action.triggered.connect(self.cycleCompleterMode) |
213 | | - self.uiCompleterModeMENU.hovered.connect(self.handleMenuHovered) |
| 212 | + self.uiCompleterModeMENU.hovered.connect(handleMenuHovered) |
214 | 213 |
|
215 | 214 | # Workbox add/remove |
216 | 215 | self.uiNewWorkboxACT.triggered.connect( |
@@ -293,7 +292,7 @@ def __init__(self, parent, name=None, run_workbox=False, standalone=False): |
293 | 292 | regEx = ".*" |
294 | 293 | menus = self.findChildren(QtWidgets.QMenu, QtCore.QRegExp(regEx)) |
295 | 294 | for menu in menus: |
296 | | - menu.hovered.connect(self.handleMenuHovered) |
| 295 | + menu.hovered.connect(handleMenuHovered) |
297 | 296 |
|
298 | 297 | # Preferences window |
299 | 298 | self.uiClosePreferencesBTN.clicked.connect(self.update_workbox_stack) |
@@ -809,23 +808,6 @@ def adjustFontSize(self, kind, delta): |
809 | 808 | size += delta |
810 | 809 | self.setGuiFont(newSize=size) |
811 | 810 |
|
812 | | - def handleMenuHovered(self, action): |
813 | | - """Qt4 doesn't have a ToolTipsVisible method, so we fake it""" |
814 | | - # Don't show if it's just the text of the action |
815 | | - text = re.sub(r"(?<!&)&(?!&)", "", action.text()) |
816 | | - text = text.replace('...', '') |
817 | | - |
818 | | - if text == action.toolTip(): |
819 | | - text = '' |
820 | | - else: |
821 | | - text = action.toolTip() |
822 | | - |
823 | | - if Qt_py.IsPyQt4: |
824 | | - menu = action.parentWidget() |
825 | | - else: |
826 | | - menu = action.parent() |
827 | | - QToolTip.showText(QCursor.pos(), text, menu) |
828 | | - |
829 | 811 | def selectFont( |
830 | 812 | self, origFont=None, monospace=False, proportional=False, doGui=False |
831 | 813 | ): |
|
0 commit comments