Qt World Summit: Submit your Presentation

Syntax : QFileDialog.Options()

  • Hi, I'm a newbie who want to learn how to use Qt for my project.
    I found several online examples of using QFileDialog.Options something like this :

    def saveFileDialog(self):
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog

    I'm just curious of the notation "|=", what's its use in these context? Or, it's just a typo?
    Hopefully someone in the forum willing to answer my curiosity.... :-)
    Many thanks in advance.

  • Lifetime Qt Champion

    @Catacomb said in Syntax : QFileDialog.Options():

    options |= QFileDialog.DontUseNativeDialog

    This is not Qt specific. This line is same as

    options = options | QFileDialog.DontUseNativeDialog

    but shorter.
    You should read about Python operators.

Log in to reply