I have a Qt QML application written in the QtCreator and I want to add a button that gives users the ability to toggle the window flag 'StayOnTop'. I'm not looking for specifics on how to create a button and all that jazz, im simply looking for help on the function that does the window flag toggles. I know how todo this in Python/Pyside but not QML C++.
For example how do i translate this into my qml application?
def toggle_stay_on_top(self):
if self.stayOpTopAct.isChecked():
# enabled
self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
else:
# disable
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
I tried using this but the title bar and min/max/close buttons disappeared.
flags: Settings.stayOnTop ? flags | Qt.WindowStaysOnTopHint : flags & ~Qt.WindowStaysOnTopHint