Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. FileDialog locks drive
Qt 6.11 is out! See what's new in the release blog

FileDialog locks drive

Scheduled Pinned Locked Moved QML and Qt Quick
filedialogqml
1 Posts 1 Posters 1.0k 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.
  • K Offline
    K Offline
    krobinson
    wrote on last edited by
    #1

    I noticed something today that it causing an issue for me. I think it is by design, but I am not sure how to work around it. I am using a FileDialog to select a folder. Once the folder is selected I dont really need it until another selection is required, but it is a Qml element so it sticks around. The problem is that it grabs a handle to the folder and hangs onto it. I found the process in Process Explorer and verified that the handle stays open. I force closed the handle using Process Explorer and got the warning below.

    QFileSystemWatcher: FindNextChangeNotification failed for "G:\"  (The handle is invalid.)
    

    So it seems that its creating a QFileSystemWatcher and watching for changes. This is an issue for me because I need to modify the drive and it is blocking it. Is there any way to turn this off. Can I just create a FileDialog on the fly and dispose of it when I am done? It doesn't seem like I can manually change the location without user interaction either. Any ideas would be appreciated. I will include my demo project qml file for reference as well.

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2
    import QtQuick.Dialogs 1.2
    
    ApplicationWindow {
        title: qsTr("Hello World")
        width: 640
        height: 480
        visible: true
    
        FileDialog
        {
            id: folderDialog
            title: qsTr("Please choose a folder")
            selectFolder: true
            
            onAccepted:
            {
                close();
            }
            onRejected:
            {
                close();
            }
        }
        Button
        {
            text: "Test"
            onClicked:
            {
                folderDialog.open();
            }
        }
    }
    
    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