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 filemode not working
Forum Updated to NodeBB v4.3 + New Features

FileDialog filemode not working

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 354 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.
  • V Offline
    V Offline
    Vijaykarthikeyan
    wrote on last edited by
    #1

    I'm trying to save the video file using FileDialog component in QML.For that,I have been using
    this statement.
    import Qt.labs.platform 1.1

    FileDialog {
           id: save_vid_Dialog
           title: "Please choose a file"
           folder: StandardPaths.writableLocation(StandardPaths.MoviesLocation)
           fileMode:FileDialog.SaveFile
           nameFilters: ["AVI files (*.avi)", "Mp4 files (*.mp4)", "MKV files (*.mkv)"]
           onAccepted: {
               console.log(FileDialog.SaveFile)
               save_vid_Dialog.close()
           }
           onRejected: {
               save_vid_Dialog.close()
           }
       }
    

    But,I'm receving this error qrc:/LiveStream.qml:501:8: Unable to assign [undefined] to int
    for the line : fileMode:FileDialog.SaveFile
    why the filemode is not accepting the value

    V 1 Reply Last reply
    0
    • V Vijaykarthikeyan

      I'm trying to save the video file using FileDialog component in QML.For that,I have been using
      this statement.
      import Qt.labs.platform 1.1

      FileDialog {
             id: save_vid_Dialog
             title: "Please choose a file"
             folder: StandardPaths.writableLocation(StandardPaths.MoviesLocation)
             fileMode:FileDialog.SaveFile
             nameFilters: ["AVI files (*.avi)", "Mp4 files (*.mp4)", "MKV files (*.mkv)"]
             onAccepted: {
                 console.log(FileDialog.SaveFile)
                 save_vid_Dialog.close()
             }
             onRejected: {
                 save_vid_Dialog.close()
             }
         }
      

      But,I'm receving this error qrc:/LiveStream.qml:501:8: Unable to assign [undefined] to int
      for the line : fileMode:FileDialog.SaveFile
      why the filemode is not accepting the value

      V Offline
      V Offline
      Vijaykarthikeyan
      wrote on last edited by
      #2

      we have to define only one import statement for dialog component at a time. For my work, Qt.labs.platform 1.1 works fine so I discarded the other one. Like this,I have commented out the Dialogs component

      import QtQuick 2.15
      import Qt.labs.platform 1.1
      import QtQuick.Controls 2.15
      import QtGraphicalEffects 1.15
      import QtQuick.Layouts 1.15
      //import QtQuick.Dialogs 1.3
      
      1 Reply Last reply
      0
      • V Vijaykarthikeyan has marked this topic as solved on

      • Login

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