Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Coordinates for QGraphicsView
Qt 6.12 LTS is out! See what's new in the release blog

Coordinates for QGraphicsView

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 2 Posters 1.9k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    When are you requesting these values ?

    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
    • L Offline
      L Offline
      leinad
      wrote on last edited by
      #3

      In the constructor

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

        Until the widgets are shown they have no "physical" dimensions.

        Also note that the size of the scene and the view do not necessarily match unless you made it so.

        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
        • L Offline
          L Offline
          leinad
          wrote on last edited by
          #5

          This is what I did when I created the scene.
          //create the scene
          scene_ = new QGraphicsScene(sceneStartCornerX_,
          sceneStartCornerY_,
          sceneEndCornerX,
          sceneEndCornerY,
          ui->testGridGraphicsView);

          ui->testGridGraphicsView->setScene(scene_); //attach the scene to the view (QGraphicsView)

          //smooth graphics
          ui->testGridGraphicsView->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::TextAntialiasing);
          
          1 Reply Last reply
          0
          • L Offline
            L Offline
            leinad
            wrote on last edited by
            #6

            What do you mean until the widgets are shown? I assume the user must click on the tab. Is there a way to force it to see the dimensions without clicking on the tab?

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

              Why not just build a "size less" scene ?

              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
              • L Offline
                L Offline
                leinad
                wrote on last edited by
                #8

                You mean don't set the dimensions when setting up the scene?
                scene = new QGraphicsScene(ui->testGridGraphicsView);

                I did that with the same results.

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

                  How are you placing the items on your scene ?

                  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
                  • L Offline
                    L Offline
                    leinad
                    wrote on last edited by
                    #10

                    Programmatically using dimensions. It looks fine but skewed because the original sizes are incorrect.

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

                      Please provide a minimal compilable example that reproduces that issue.

                      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
                      • L Offline
                        L Offline
                        leinad
                        wrote on last edited by
                        #12

                        Thanks, you actually helped me resolve the issue. I created a signal/slot when the tab is selected which now shows the view. At that point I get the coordinates and they show properly.

                        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
                        • Unsolved