QPrintDialog.open(receiver, slot), nonmodal dialog, OSX, PySide binding problem?

  • QPrintDialog.open(receiver, slot) is supposed to show the dialog non-modally, automatically connecting the accepted signal to receiver, slot. The documentation says this is an overloaded function, but I can't find any other signature for open(), even in inherited methods. Is that a bug in the documentation?

    I tried:

    def showPrintDialogNonmodal(self, dialog):
    dialog.open(self, self.doPrint) # nonmodal, asynchronous

    def doPrint(self, printer):@

    But get:

    Program error: TypeError'>: 'PySide.QtGui.QPrintDialog.open' called with wrong argument types: PySide.QtGui.QPrintDialog.open(Document, instancemethod) Supported signatures: PySide.QtGui.QPrintDialog.open() PySide.QtGui.QPrintDialog.open(PySide.QtCore.QObject, str) on line 53, file printable.py

    My Document class is not derived from QObject, which might explain part of it, but should the second parameter really be a string, the name of the method? I can't find an example of this at the tutorial about "PySide signals":http://qt-project.org/wiki/Signals_and_Slots_in_PySide.

    So another approach might be to connect the signal myself, and call QPrintDialog.show() (also non-modal):

    def showPrintDialogNonmodal(self, dialog):

    And that seems to work.

    My real problem is getting QPrintDialog to work on OSX, there was or is a known issue about native dialogs shown modally, I am experimenting to see whether it works non-modally.

  • I can confirm that the QPrintDialog used as above does work (whereas modally it did not) on Qt 4.8.2(?). So my question is now academic, about how Qt signals in PySide would bind the string parameter to QPrintDialog.open() to a method.

    Also, in OSX, the dialog appears hung down off the mainwindow title bar, and IS non-modal in the sense that the app still gets events in the main window that is not obscured by the print dialog. So now I need to read up on whether the fact that the dialog will not go behind the main window, or say off to the side, is a feature of OSX in general for all non-modal dialogs, or just a feature of their native print dialog. If I open a second non-modal dialog (but not a native OSX dialog), where will it appear?

    Can you say that as far as Qt is concerned, the dialog is non-modal, but as a native OSX dialog, it has a restricted sense of non-modal? Is there another word for such behaviour, such as pull-down dialog, or tear-off (I'm not sure it will tear off?)

    My original attempt to make the dialog modal is laziness? Now I must test that anything the user does while the print dialog is open has no harmful effect. Including testing that if the user asks to print again, another print dialog should not open.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.