text: "FS"
checkable: true
onCheckedChanged: {
- if (!checked) {
- controlledWindow.showNormal();
- } else {
- controlledWindow.showFullScreen();
- }
+ controlledWindow.borderlessFullScreen = checked
}
}
BasicButton {
text: "OnTop"
enabled: !controlledWindow.isFullScreen()
checkable: true
- onCheckedChanged: {
- if (!checked) {
- controlledWindow.flags = controlledWindow.flags & ~Qt.WindowStaysOnTopHint
- } else {
- controlledWindow.flags = controlledWindow.flags
- | Qt.WindowStaysOnTopHint
- | Qt.WindowTitleHint
- | Qt.WindowSystemMenuHint
- | Qt.WindowMinMaxButtonsHint
- | Qt.WindowCloseButtonHint
- }
- }
+ onCheckedChanged: controlledWindow.stayOnTop = checked
}
BasicButton {
id: framelessButton
text: "Frameless"
enabled: !controlledWindow.isFullScreen()
checkable: true
- onCheckedChanged: {
- if (!checked) {
- controlledWindow.flags = controlledWindow.flags & ~Qt.FramelessWindowHint
- } else {
- controlledWindow.flags = controlledWindow.flags | Qt.FramelessWindowHint
- }
- }
+ onCheckedChanged: controlledWindow.borderless = checked
}
SeekSlider {
width: 800
-import QtQuick.Window 2.2
import org.aptx.aniplayer 1.0
+import QtQuick.Window 2.13
import QtQuick 2.7
Window {
width: 300
height: 300
property bool controlsVisible: true
- //property Visibility previousVisibility: Window.Normal
+ property bool borderlessFullScreen: false
+ property bool stayOnTop: false
+ property bool borderless: false
+
+ title: player.displayTitle
Component.onCompleted: {
loadSettings();
window.visible = true
}
+ // TODO remove this once QTBUG-47917/QTCREATORBUG-13347 is actually fixed
+ // @disable-check M16
onClosing: saveSettings()
function isFullScreen() {
- return visibility === Window.FullScreen
+ return visibility === Window.FullScreen || borderlessFullScreen
+ }
+
+ StateGroup {
+ states: [
+ State {
+ name: "borderlessFullScreen"
+ when: borderlessFullScreen
+ PropertyChanges {
+ target: window
+ borderless: true
+ stayOnTop: true
+ x: screen.virtualX
+ y: screen.virtualY
+ width: screen.width
+ height: screen.height
+ }
+ },
+ State {
+ name: "borderlessFullScreenInactive"
+ when: borderlessFullScreen && !active
+ extend: "borderlessFullScreen"
+ PropertyChanges {
+ target: window
+ stayOnTop: false
+ }
+ }
+ ]
+ }
+/*
+ onBorderlessFullScreenChanged: {
+ if (borderlessFullScreen) {
+ console.log("Turnning borderlessFullScreen on");
+ console.log("Window.x: ", x);
+ console.log("Window.y: ", y);
+ console.log("Window.width: ", width);
+ console.log("Window.height: ", height);
+ nonFullScreenData.x = x;
+ nonFullScreenData.y = y;
+ nonFullScreenData.width = width;
+ nonFullScreenData.height = height;
+ nonFullScreenData.stayOnTop = stayOnTop;
+ nonFullScreenData.borderless = borderless;
+
+ borderless = true;
+ stayOnTop = true;
+ x = screen.virtualX;
+ y = screen.virtualY;
+ console.log("Screen: ", screen);
+ console.log("Screen.w: ", screen.width);
+ console.log("Screen.h: ", screen.height);
+ width = screen.width;
+ height = screen.height;
+ } else {
+ console.log("Turnning borderlessFullScreen off");
+ console.log("x: ", x);
+ console.log("y: ", y);
+ console.log("width: ", width);
+ console.log("height: ", height);
+ width = nonFullScreenData.width;
+ height = nonFullScreenData.height;
+ x = nonFullScreenData.x;
+ y = nonFullScreenData.y;
+ borderless = nonFullScreenData.borderless;
+ stayOnTop = nonFullScreenData.stayOnTop;
+ }
+ }
+*/
+ onBorderlessChanged: {
+ if (borderless) {
+ flags = flags | Qt.FramelessWindowHint
+ } else {
+ flags = flags & ~Qt.FramelessWindowHint
+ }
+ }
+
+ onStayOnTopChanged: {
+ if (stayOnTop) {
+ flags = flags
+ | Qt.WindowStaysOnTopHint
+ | Qt.WindowTitleHint
+ | Qt.WindowSystemMenuHint
+ | Qt.WindowMinMaxButtonsHint
+ | Qt.WindowCloseButtonHint
+ } else {
+ flags = flags & ~Qt.WindowStaysOnTopHint
+ }
}
function saveSettings() {
console.log("Saving settings");
+ controls.saveSettings();
+ // Exit fullscreen here to save geometry without fullscreen
+ // Fullscreen enabled/disabled state is saved by controls
+ window.borderlessFullScreen = false;
settings.savePlayerState(player);
settings.set("x", x);
settings.set("y", y);
settings.set("width", width);
settings.set("height", height);
settings.set("controlsVisible", controls.visible);
- controls.saveSettings();
+
}
function loadSettings() {
else if (mouse.button === Qt.MiddleButton)
player.togglePlay();
}
- cursorShape: !controls.visible && window.visibility === Window.FullScreen ? Qt.BlankCursor : Qt.ArrowCursor;
+ cursorShape: !controls.visible && window.isFullScreen() ? Qt.BlankCursor : Qt.ArrowCursor;
}
DropArea {