Skip to content Skip to sidebar Skip to footer

Python Qt Bindings: Setcosmetic() And Scenerect(), Problems With Margins

With the following simple example (which works well with either PySide or PyQt4): import sys import random import numpy from PySide import QtGui, QtCore class Window(QtGui.QWidget

Solution 1:

This isn't quite the answer but I thought it might help:

I did this in C++ but it's easy enough to translate. In your QGraphicsView, set the scrollbar policies:

view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

Then in your call to fitInView, add the following flag:

view->fitInView(scene->sceneRect(), Qt::KeepAspectRatioByExpanding);

Post a Comment for "Python Qt Bindings: Setcosmetic() And Scenerect(), Problems With Margins"