Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 5.0.2, PyQt5, Linux, QPageSetupDialog empty or missing



  • The QPageSetupDialog fails to appear (or is empty).

    I think this is a bug, since similar code was working before.

    Here is a reduced version that demonstrates the bug.
    @import sys

    from PyQt5.QtCore import Qt, QObject
    from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
    from PyQt5.QtPrintSupport import QPrinter, QPageSetupDialog

    class PrintConverser(QObject):

    def doPageSetup(self):
    print("Opening page setup dialog")
    printer = QPrinter()
    assert printer.isValid()
    dialog = QPageSetupDialog(printer)

    dialog.accepted.connect(self.acceptSlot)
    dialog.rejected.connect(self.acceptSlot)
    
    # Choose one: all are broken:
    #dialog.open() # window modal, but no dialog appears
    #dialog.show()  # modeless, but no dialog appears
    dialog.exec_()  # app modal, dialog box appears but is empty
    

    def acceptSlot(self):
    print('accepted or canceled')

    def main():
    app = QApplication(sys.argv)
    mainWindow = QMainWindow()
    mainWindow.setGeometry(100, 100, 500, 40)

    printConverser = PrintConverser()

    button = QPushButton("Setup page")
    button.clicked.connect(printConverser.doPageSetup)
    mainWindow.setCentralWidget(button)
    mainWindow.show()

    sys.exit(app.exec_())

    if name=="main":
    main()@



  • This was also reported by someone else and fixed here: https://bugreports.qt-project.org/browse/QTBUG-31790.

    It affects Qt5.0.x up to 5.1.1 where it was fixed. Ubuntu 13.4 ships with Qt5.02 and doesn't seem to update with the bug fix. I suppose there are not many Qt apps on Ubuntu. I am surprised this bug wasn't found or reported by KDE, maybe KDE is not on Qt5.02 yet.


Log in to reply