QWidget in QGraphicsView not scaled correctly in OSX
-
@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.
-
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 ?
-
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.
-
Do you have a small code sample that triggers this behavior ?
-
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(); }
-
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.
-
I think, somebody have already found it: https://bugreports.qt.io/browse/QTBUG-48681
Thanks.
-
You can vote for that issue and also provide your own findings, the more data is gathered the better to help debug that problem.
-
I did that, vote and my findings.
-
Thanks !