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. QWidget in QGraphicsView not scaled correctly in OSX
QtWS25 Last Chance

QWidget in QGraphicsView not scaled correctly in OSX

Scheduled Pinned Locked Moved Unsolved General and Desktop
qgraphicsviewscalingosx
12 Posts 2 Posters 3.8k 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.
  • S Offline
    S Offline
    szergejbubka
    wrote on 22 Jan 2016, 21:46 last edited by szergejbubka
    #1

    Hi,

    My program uses QWidgets within a QGraphicsView. The view can be scaled, and it shows the widgets scaled perfectly in Windows and Linux, but not in OSX. The painted parts are not scaled, just the texts. Here are the same situation in Windows, Linux and OSX.

    Is there something to be specially treated in OSX?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 22 Jan 2016, 22:13 last edited by
      #2

      Hi,

      Any chance you are experiencing this on a retina display ?

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

      S 1 Reply Last reply 23 Jan 2016, 09:46
      0
      • S SGaist
        22 Jan 2016, 22:13

        Hi,

        Any chance you are experiencing this on a retina display ?

        S Offline
        S Offline
        szergejbubka
        wrote on 23 Jan 2016, 09:46 last edited by
        #3

        @SGaist I do not know how to test it. I use it in a VirtualBox, the resolution of which is not retina, and I do not have a real mac. But the effect depends on scaling. When scaled to 1, the painted parts and the text match. If I "zoom out", the unscaled painted parts become large relative to the properly scaled text.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 23 Jan 2016, 20:18 last edited by
          #4

          I'm not sure I'm understanding you correctly: are you running a virtual machine on e.g. a Linux host with OS X installed in it ?

          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
          • S Offline
            S Offline
            szergejbubka
            wrote on 23 Jan 2016, 21:02 last edited by szergejbubka
            #5

            Yes, on Win7 host I am running OS X guest (El Capitan, if it matters), in VMWare, to be precise. I do not know very well either OS X or VMWare, so I cannot change the display resolution other than what is the normal resolution of my monitor (minus the window decorations of the virtual machine), which is a standard 1920x1080 or something.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 23 Jan 2016, 23:53 last edited by
              #6

              Do you have a small code sample that triggers this behavior ?

              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
              • S Offline
                S Offline
                szergejbubka
                wrote on 24 Jan 2016, 10:09 last edited by
                #7

                Ok, so here is the minimal one-file example. It crashes after closing the window, obviously I should have created something with 'new'. But while it is running, it shows the bad behaviour on osx. By changing the parameters of scale(), the text of the button scales properly, but not the painted parts.

                // main.cpp
                #include <QApplication>
                #include <QMainWindow>
                #include <QGraphicsView>
                #include <QPushButton>
                #include <QGraphicsProxyWidget>
                
                int main(int argc, char *argv[])
                {
                    QApplication a(argc, argv);
                
                    QMainWindow window;
                    QGraphicsScene scene;
                    QGraphicsProxyWidget widget;
                    QPushButton button;
                    button.setText("TEXT");
                    widget.setWidget(&button);
                    scene.addItem(&widget);
                    QGraphicsView view;
                    view.setScene(&scene);
                    view.scale(2, 2); // .5 or 2
                    window.setCentralWidget(&view);
                
                    window.show();
                
                    return a.exec();
                }
                
                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 24 Jan 2016, 21:56 last edited by
                  #8

                  Ok, I can reproduce it also.

                  Seems you have found a bug. You should go to the bug report system and check whether it's something known, if not please consider opening a new report providing your code as a compilable project.

                  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
                  • S Offline
                    S Offline
                    szergejbubka
                    wrote on 24 Jan 2016, 22:19 last edited by
                    #9

                    I think, somebody have already found it: https://bugreports.qt.io/browse/QTBUG-48681

                    Thanks.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 24 Jan 2016, 22:24 last edited by
                      #10

                      You can vote for that issue and also provide your own findings, the more data is gathered the better to help debug that problem.

                      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
                      • S Offline
                        S Offline
                        szergejbubka
                        wrote on 24 Jan 2016, 22:26 last edited by
                        #11

                        I did that, vote and my findings.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 24 Jan 2016, 22:29 last edited by
                          #12

                          Thanks !

                          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

                          2/12

                          22 Jan 2016, 22:13

                          10 unread
                          • Login

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