Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Embedded: displaying on two screens using QGraphicsView and QGraphicsWidget
Forum Updated to NodeBB v4.3 + New Features

Qt Embedded: displaying on two screens using QGraphicsView and QGraphicsWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 1.4k 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.
  • D Offline
    D Offline
    dmudric
    wrote on last edited by
    #1

    I am using Embedded QT 4.8..7. Widgets are based on QGraphicsView and QGraphicsWidget. Need to control two displays.

    So far I was able to find suggestions how to control two displays using QDesktopWidget, which is QWidget. I assume there must be a way to control two screens, using two frame buffers, via QGraphicsWidget.

    Can somebody please give me a reference with examples how to paint on two screens using QGraphicsView and QGraphicsWidget, and two frame buffers?
    Can all the widgets still be added to the same QGraphicsScene?

    Is there a need to offset widget rectangles for the second display, before adding them to the scene?

    How and when to move between the screens? Using QRect geometry = pDesktop->availableScreenGeometry(screen_number); pQGraphicsView->move(geometry.topLeft())?

    Thanks,
    Dusan Mudric.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean you want to have a single QGraphicsView spanning both screens ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dmudric
        wrote on last edited by dmudric
        #3

        Yes, something like this:

                MainWindow Display0;
                MainWindow Display1;
                QGraphicsScene* pScene = new QGraphicsScene();
                pScene->setSceneRect(0, 0, screen1_X+screen2_X, max(screen1_Y, screen2_Y);
                QGraphicsView* pView =  new QGraphicsView(pScene)
                QDesktopWidget *pDesktop = QApplication::desktop();
                QRect geometry = pDesktop->availableScreenGeometry(1);
                // Move screen1 Display to the second screen. This should allow to place widgets from the scene the second screen. For the widgets on the second screen, do widgets rectangles need to be shifted by screen1_X?
                Display1->move(geometry.topLeft());
                pView->move(geometry.topLeft()); // luckily QGraphicsView is QWidget and call move(). Does this move from one to another screen has to happen every time screen0 or screen1 widgets are painted?
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Are you using the QWS system ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          0
          • SGaistS SGaist

            Are you using the QWS system ?

            D Offline
            D Offline
            dmudric
            wrote on last edited by
            #5

            I am not using anything yet. Still looking for the options. What is QWS supposed to do and how? Is it related to https://doc.qt.io/archives/qtextended4.4/tut-dualdisplay.html?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Since you're using Qt for Embedded, you should read the corresponding documentation.

              By the way, are you tied to that version ? Qt 4 has reached end of life a long time ago therefore you should consider going with Qt 5.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • D Offline
                D Offline
                dmudric
                wrote on last edited by dmudric
                #7

                I am not using QWS Client-Server architecture. Only MainWindow, QGraphicsScene and QGraphicsView. I want to avoid any major redesign to support two screens. Qt5 is not an option. Have to stay with 4.8.

                http://doc.qt.io/archives/qt-4.8/qt-embedded-running.html ("Using the Multi screen driver, on the other hand, applications can easiliy be moved between the various screens."). Where are the examples of this easy implementation?

                Is there somebody in QT who knows how to make it working with the pseudo code above?

                Thanks,
                Dusan.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Then what are you using to display your application ? An X.org server ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dmudric
                    wrote on last edited by
                    #9

                    QGraphicsWidget calls update(), QT calls back QGraphicsWidget::paint() with the pointer to the painter. This painter is used to draw images pPainter->drawPixmap();

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      I mean what backend are you using ? If not QWS, do you have an Xorg server running on your device ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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