hi friends.
i have a QGraphicsScene with around 400 labels in it. when i increase initial size of labels program crashes.
scene.
setBackgroundBrush(QtGui.
QColor('white'))graphics_widget = QtGui.QGraphicsWidget()
layout = QtGui.QGraphicsLinearLayout(QtCore.Qt.Vertical)
page_size
= QtCore.
QSize(995,
1242)for number in xrange(400):
lbl.setFixedSize(page_size)
lbl.setContentsMargins(0, 0, 0, 0)
lbl.setScaledContents(True)
widget = scene.addWidget(lbl)
layout.addItem(widget)
graphics_widget.setLayout(layout)
scene.addItem(graphics_widget)
self.gs_view.setScene(scene)
self.gs_view.show()
scene = QtGui.QGraphicsScene()
scene.setBackgroundBrush(QtGui.QColor('white'))
graphics_widget = QtGui.QGraphicsWidget()
layout = QtGui.QGraphicsLinearLayout(QtCore.Qt.Vertical)
page_size = QtCore.QSize(995, 1242)
for number in xrange(400):
lbl = QtGui.QLabel()
lbl.setFixedSize(page_size)
lbl.setContentsMargins(0, 0, 0, 0)
lbl.setScaledContents(True)
widget = scene.addWidget(lbl)
layout.addItem(widget)
graphics_widget.setLayout(layout)
scene.addItem(graphics_widget)
self.gs_view.setScene(scene)
self.gs_view.show()
To copy to clipboard, switch view to plain text mode
but when i decrease initial size of labels to ie QtCore.QSize(695, 942) it does not crash. sometimes when i scale QGraphicsView and my application memory usage is around 250mb i get and out of memory error and application exits automatically.
thank you.
Bookmarks