mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
Merge pull request #660 from brownbat/tooltip-positioning
Update tooltip() in utils.py
This commit is contained in:
commit
a0c1b68b86
2 changed files with 3 additions and 2 deletions
|
@ -36,6 +36,7 @@ Zeno Gantner <zeno.gantner@gmail.com>
|
||||||
Henrik Giesel <hengiesel@gmail.com>
|
Henrik Giesel <hengiesel@gmail.com>
|
||||||
Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
|
Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
|
||||||
Sander Santema <github.com/sandersantema/>
|
Sander Santema <github.com/sandersantema/>
|
||||||
|
Thomas Brownback <https://github.com/brownbat/>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -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