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. Managing multiple application windows on multiple monitors
Forum Updated to NodeBB v4.3 + New Features

Managing multiple application windows on multiple monitors

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 4 Posters 9.5k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    miroslav
    wrote on last edited by
    #2

    Hi,

    have a look at the screenGeometry method of QDesktopWidget. It will give you information about the available screens, and their individual geometry. You can move() a widget to a position inside the screen it is supposed to show on (topLeft() works). You need to know the integer Id of the target screen, or you can call it with the widget pointer of the window that is already showing on the target screen.

    If the child has no parent, it will show up on the primary screen unless told otherwise.

    Mirko Boehm | mirko@kde.org | KDE e.V.
    FSFE Fellow
    Qt Certified Specialist

    1 Reply Last reply
    0
    • S Offline
      S Offline
      starbearer
      wrote on last edited by
      #3

      Thank you very much. I'll try it out.

      Is there any way to manage the screens without using QDesktopWidget?

      It causes several ambiguity problems in my code.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #4

        No, that is what that class is for. How do you mean that it causes ambiguity?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          starbearer
          wrote on last edited by
          #5

          It's an issue which I'm having with this line..

          @connect(this, SIGNAL(setNodeitemAlive(bool)), criteria, SLOT(update(bool)));@

          this--------Object of a class type inheriting from QObject
          criteria----Object of a class type inheriting from QObject,QStandardItem and as I want, QDesktopWidget.

          Error:-ambiguous access of 'connect'
          Error 2:-argument : ambiguous conversions from 'Transition *const ' to 'const QObject *
          Error 3 'connect': identifier not found

          These are probably novice errors, but I'm new to all this.
          Thanks a lot for helping me.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #6

            QDesktopWidget is not meant to be subclassed. Use QApplication::desktop() to retrieve an instance and the information you need.

            QObject in general does not support multiple inheritance.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              miroslav
              wrote on last edited by
              #7

              Yeah, you should generally try to inherit only if you need to, and otherwise just use or compose the classes that exist. What I forgot to mention is that you retrieve the desktop widget from QApplication, instead of instantiating it directly.

              Mirko Boehm | mirko@kde.org | KDE e.V.
              FSFE Fellow
              Qt Certified Specialist

              1 Reply Last reply
              0
              • S Offline
                S Offline
                starbearer
                wrote on last edited by
                #8

                Once I get the QDesktopwidget thingy, can I exploit PrimaryScreen property?
                The PrimaryScreen is supposed to return an integer value of the screen which is in use by the parent window at the time.

                Once i move the parent window over to the other screen, and then launch a child window from there, is there a way to force the child window to use the same screen using the parentScreen() property? Something like Setscreen(parentscreen())?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  starbearer
                  wrote on last edited by
                  #9

                  The widget I'm referring to, now does not have a parent. I've removed that part.

                  I can get the screenID of the target screen where I want the window to launch based on the position of the cursor in that screen.

                  Once I have this, how do I force the window to launch in that screen?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    miroslav
                    wrote on last edited by
                    #10

                    What I did in a similar program is to get the screen number of the main window using the screenNumber(QWidget*) method. Then I move the new window to a coordinate on the target screen before showing.

                    Mirko Boehm | mirko@kde.org | KDE e.V.
                    FSFE Fellow
                    Qt Certified Specialist

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      starbearer
                      wrote on last edited by
                      #11

                      Thanks a lot for your help everyone.
                      I finally got it working fine.

                      Much obliged, I'm sure.

                      1 Reply Last reply
                      0

                      • Login

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