gmarull/qtmodern

Cannot resize main window

Opened this issue · 1 comments

Hi. I want to resize my main window by clicking a button, but it doesn't work with qtmodern.windows.ModernWindow. A minimum working example is as follows

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QStatusBar
import qtmodern.styles
import qtmodern.windows


class App(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.resize(560, 510)
        self.btn = QPushButton('resize', self)
        self.btn.setGeometry(40, 20, 120, 30)
        self.btn.clicked.connect(self.resizeWindow)
        self.status = QStatusBar()
        self.show()

    def resizeWindow(self):
        size = self.size()
        self.resize(560, 800)
        print('resize from ', size, 'to 560*800')


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = App()

    qtmodern.styles.dark(app)
    mw = qtmodern.windows.ModernWindow(window)
    mw.show()
    app.exec()

By clicking the button, it shows

resize from  PyQt5.QtCore.QSize(560, 482) to 560*800

but nothing happens, and click again I can see the size is actually modified

resize from  PyQt5.QtCore.QSize(560, 800) to 560*800

Dark style alone is OK.

Maybe related to the oldest issue #1