Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileDialog getOpenFileName DontUseNativeDialog strange effect when dragging window
Qt 6.11 is out! See what's new in the release blog

QFileDialog getOpenFileName DontUseNativeDialog strange effect when dragging window

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jureq
    wrote on last edited by
    #1

    I use QFileDialog.getOpenFileName with option DontUseNativeDialog and not null parent. When I try to drag dialog window it is dragged together with parent widget window underneath (in my case qapp window). If parent window was maximized it is restored to previous size first. Is it planned behavior or a bug?

    My environment: Qt 5.15.0, Ubuntu 20, Python 3.8.0, PyCharm. The same effect using PyQt5 and PySide2.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Since you gave it a parent, I am not surprised to see both move together as the dialog is modal to the parent widget.. Can you provide a minimal example script that shows this ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Since you gave it a parent, I am not surprised to see both move together as the dialog is modal to the parent widget.. Can you provide a minimal example script that shows this ?

        J Offline
        J Offline
        Jureq
        wrote on last edited by Jureq
        #3

        @SGaist

        After upgrading PyQt5 to latest, PyQt version works as expected. In PySide2 windows are still pinned together.

        from PySide2.QtWidgets import (QMainWindow, QAction, QFileDialog, QApplication)
        import sys
        
        class Example(QMainWindow):
        
            def __init__(self):
                super().__init__()
                self.initUI()
        
            def initUI(self):
                openFile = QAction('Open', self)
                openFile.triggered.connect(self.showDialog)
                menubar = self.menuBar()
                fileMenu = menubar.addMenu('&File')
                fileMenu.addAction(openFile)
                self.show()
        
            def showDialog(self):
                fname = QFileDialog.getOpenFileName(self, 'Open file', '/', options=QFileDialog.DontUseNativeDialog)
        
        app = QApplication()
        ex = Example()
        sys.exit(app.exec_())
        
        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved