18 flags = Qt.WindowType.ToolTip
19 flags = Qt.WindowType.Window | Qt.WindowType.FramelessWindowHint | \
20 Qt.WindowType.CustomizeWindowHint | Qt.WindowType.X11BypassWindowManagerHint
21 QWidget.__init__(self,
None, flags)
24 self.
vlayout.setContentsMargins(0, 0, 0, 0)
30 def show(self, timeout=0, above=False):
32 desktop = QApplication.instance().desktop()
33 screen = desktop.screen(desktop.screenNumber(self))
34 screen_width = screen.width()
35 screen_height = screen.height()
36 win_width = self.width()
37 win_height = self.height()
38 cursorRect = self.
textedit.cursorRect()
40 pos = self.
textedit.mapToGlobal(cursorRect.topLeft())
41 pos.setY(pos.y() - win_height)
43 pos = self.
textedit.mapToGlobal(cursorRect.bottomLeft())
45 pos = self.
textedit.mapToGlobal(cursorRect.bottomLeft())
46 if pos.y() + win_height > screen_height:
47 pos = self.
textedit.mapToGlobal(cursorRect.topLeft())
48 pos.setY(pos.y() - win_height)
49 if pos.x() + win_width > screen_width:
50 pos.setX(screen_width - win_width)
56 QTimer.singleShot(timeout * 1000, self.
hidehide)