Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main: omit QML Screen type, use QGuiApplication::primaryScreen() instead #3404

Merged

Conversation

xiphon
Copy link
Collaborator

@xiphon xiphon commented Apr 15, 2021

No description provided.

@xiphon xiphon force-pushed the fix-desktopAvailableWidth-edge-case branch from 3125ca8 to f9a04f7 Compare April 15, 2021 19:38
@xiphon xiphon changed the title main: use Screen.width/height if Screen.desktopAvailableWidth/Height == 0 main: omit QML Screen type, use QGuiApplication::primaryScreen() instead Apr 15, 2021
@xiphon xiphon force-pushed the fix-desktopAvailableWidth-edge-case branch from f9a04f7 to ba62f9c Compare April 15, 2021 19:50
@selsta
Copy link
Collaborator

selsta commented Apr 15, 2021

Something like this might also work if it auto centers on Linux.

diff --git a/main.qml b/main.qml
index 6701d7e2..62b71204 100644
--- a/main.qml
+++ b/main.qml
@@ -1121,12 +1121,12 @@ ApplicationWindow {
 
     objectName: "appWindow"
     visible: true
-    width: Screen.desktopAvailableWidth > 980
+    width: appWindow.screen.desktopAvailableWidth > 980
         ? 980
-        : Math.min(Screen.desktopAvailableWidth, 800)
-    height: Screen.desktopAvailableHeight > maxWindowHeight
+        : Math.min(appWindow.screen.desktopAvailableWidth, 800)
+    height: appWindow.screen.desktopAvailableHeight > maxWindowHeight
         ? maxWindowHeight
-        : Math.min(Screen.desktopAvailableHeight, 700)
+        : Math.min(appWindow.screen.desktopAvailableHeight, 700)
     color: MoneroComponents.Style.appWindowBackgroundColor
     flags: persistentSettings.customDecorations ? Windows.flagsCustomDecorations : Windows.flags
 
@@ -1285,9 +1285,6 @@ ApplicationWindow {
     }
 
     Component.onCompleted: {
-        x = (Screen.desktopAvailableWidth - width) / 2;
-        y = (Screen.desktopAvailableHeight - height) / 2;
-
         translationManager.setLanguage(persistentSettings.locale.split("_")[0]);
 
         applyWalletMode(persistentSettings.walletMode);

@xiphon
Copy link
Collaborator Author

xiphon commented Apr 15, 2021

Something like this might also work if it auto centers on Linux.

Won't work. It doesn't auto center on Linux, at least on the one i tested.

@luigi1111 luigi1111 merged commit a84d7bd into monero-project:master Apr 16, 2021
@xiphon xiphon deleted the fix-desktopAvailableWidth-edge-case branch April 22, 2021 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants