Santa.fat
29th October 2015, 22:52
hi friends.
i have a QGraphicsScene with around 400 labels in it. when i increase initial size of labels program crashes.
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()
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.
i have a QGraphicsScene with around 400 labels in it. when i increase initial size of labels program crashes.
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()
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.