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. how to add a suffix to a file after saving it on filedialog in qml
QtWS25 Last Chance

how to add a suffix to a file after saving it on filedialog in qml

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5qmlfiledialogfile
3 Posts 3 Posters 834 Views
  • 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
    vinaygopal
    wrote on last edited by
    #1

    i have a file dialog which will open up to a perticular location and when the user gives the name i have to add some text to the name of the file and save it how can i do this in filedialog qml object.

    FileDialog{
            id: fileOpenDialog
            objectName: "save_file"
            title: "Save the File"
            folder: defaultpath  // comes from the c++ side
            fileMode: FileDialog.SaveFile
            currentFile: "Export_Script_"+time_stamp 
            nameFilters: [ "Text files (*.txt)" ]
            onAccepted: {
                fileOpenDialog.close()
                var filePath = fileOpenDialog.file
                // how to add a suffix to the filename?
    
            }
            onRejected: {
                fileOpenDialog.close()
            }
            Component.onCompleted: visible = false
    
        }
    
    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Like this?

      filePath = filePath + '.txt'
      
      JuniorMLedesmaJ 1 Reply Last reply
      2
      • C ChrisW67

        Like this?

        filePath = filePath + '.txt'
        
        JuniorMLedesmaJ Offline
        JuniorMLedesmaJ Offline
        JuniorMLedesma
        wrote on last edited by JuniorMLedesma
        #3

        Hello, I want to know how to add a suffix to a file after saving it on filedialog in qml and I came here in hope to find my answer. But It makes me sad when I can't find it. I tried filePath = filePath + '.txt' but isn't working for me. Can anyone share a website with me in which I can find the solution? I will be very much thankful to you.

        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