Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.0.2
-
None
-
Ubuntu Precise 12.04 64 bit
Qt version: 5.0.2
PyQt version: 5.0
Description
In the example below, if I don't set the maximum size for the viewer, I've a view with the size 524278 x 524278. The MainWindow.resize(x, y) has no effect.
This example demonstrate the issue with QGraphicsView, QScrollArea, QPlainTextEdit, etc
----------------------------------------------------------------------------
coding: utf-8
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.resize(460, 430)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.grid = QtWidgets.QGridLayout(self.centralwidget)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.view = QtWidgets.QGraphicsView(self.centralwidget)
self.view.setMaximumSize(QtCore.QSize(1000, 600))
self.grid.addWidget(self.view, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
if _name_ == "_main_":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
QtCore.QCoreApplication.processEvents()
print('Viewer size:', ui.view.geometry())
sys.exit(app.exec_())
----------------------------------------------------------------------------
Comment the line self.view.setMaximumSize(QtCore.QSize(1000, 600))`to see the issue.