mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Update tooltip() in utils.py
Allow x,y offsets to be specified for tooltip(), useful for accomodating longer tooltips.
This commit is contained in:
parent
63201d450d
commit
26b94e1948
1 changed files with 2 additions and 2 deletions
|
@ -540,7 +540,7 @@ _tooltipTimer: Optional[QTimer] = None
|
||||||
_tooltipLabel: Optional[QLabel] = None
|
_tooltipLabel: Optional[QLabel] = None
|
||||||
|
|
||||||
|
|
||||||
def tooltip(msg, period=3000, parent=None):
|
def tooltip(msg, period=3000, parent=None, x_offset=0, y_offset=100):
|
||||||
global _tooltipTimer, _tooltipLabel
|
global _tooltipTimer, _tooltipLabel
|
||||||
|
|
||||||
class CustomLabel(QLabel):
|
class CustomLabel(QLabel):
|
||||||
|
@ -570,7 +570,7 @@ def tooltip(msg, period=3000, parent=None):
|
||||||
p.setColor(QPalette.Window, QColor("#feffc4"))
|
p.setColor(QPalette.Window, QColor("#feffc4"))
|
||||||
p.setColor(QPalette.WindowText, QColor("#000000"))
|
p.setColor(QPalette.WindowText, QColor("#000000"))
|
||||||
lab.setPalette(p)
|
lab.setPalette(p)
|
||||||
lab.move(aw.mapToGlobal(QPoint(0, -100 + aw.height())))
|
lab.move(aw.mapToGlobal(QPoint(0 + x_offset, aw.height() - y_offset)))
|
||||||
lab.show()
|
lab.show()
|
||||||
_tooltipTimer = aqt.mw.progress.timer(
|
_tooltipTimer = aqt.mw.progress.timer(
|
||||||
period, closeTooltip, False, requiresCollection=False
|
period, closeTooltip, False, requiresCollection=False
|
||||||
|
|
Loading…
Reference in a new issue