Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtQuick app Screen Affinity?

QtQuick app Screen Affinity?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 388 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #1

    We have an app that has had a lot of developers work on it so I am not sure where to look. It is a QtQuick app. When we launch this app on a computer with multiple screens it always starts in the main desktop screen, screen 1. When trying to move to a second screen (screen 2) it snaps back to the center of screen 1. I tested a regular QtQuick app generated by Qt Creator and it does not do this.

    I tested this behavior on Windows 10 Pro and on Ubuntu 18.04 with our app. It snaps back on both OSes. So I think this is not related to a particular OS configuration.

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      Okay, after careful scrutiny I found this gem:

      x: (Screen.width - main_window.width) / 2
      y: (Screen.height - main_window.height) / 2
      

      So I put this code in a Component.onCompleted function instead:

      main_window.x = (Screen.width - main_window.width) / 2
      main_window.y = (Screen.height - main_window.height) / 2
      

      The issue went away in Ubuntu. So I will be testing Windows next.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved