Create window on top of taskbar/menubar
-
I want to create a window on top of macos system menubar in pyside6, here is my code, but keyPressEvent is not working at all.
When I remove
Qt.WindowType.ToolTip
, keyPressEvent works well, but window cannot display on top of menubar.import sys from PySide6.QtCore import Qt from PySide6.QtWidgets import QApplication, QWidget class RadarWindow(QWidget): def __init__(self, parent=None): super().__init__(parent) self.setWindowFlags( self.windowFlags() | Qt.WindowType.ToolTip | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.NoDropShadowWindowHint ) screen = QApplication.screens()[0] self.setGeometry(0, 0, screen.size().width(), screen.size().height()) def keyPressEvent(self, event): print(event) if __name__ == "__main__": app = QApplication(sys.argv) radar = RadarWindow() radar.show() sys.exit(app.exec())
-
@norepeat
https://doc.qt.io/qt-6/qt.html#WindowType-enum saysToolTip
Indicates that the widget is a tooltip. This is used internally to implement tooltips.
So perhaps it is set to ignore key events.
Have a play with Window Flags Example . Python for it might be here: https://github.com/pyside/Examples/blob/master/examples/widgets/windowflags.py ? And look at docs to see other flags or Mac-specific there might be.
-
S SGaist moved this topic from General and Desktop on
-
Hi,
Out of curiosity, why not make your application fullscreen so it will be shown in its own dedicated desktop with the menu bar only showing if you move the mouse at the top of the screen ?