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. TextField not editable after opening and canceling FileDialog

TextField not editable after opening and canceling FileDialog

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 193 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.
  • R Offline
    R Offline
    rowild
    wrote on last edited by
    #1

    Hi!

    Newbie here! - I am confused by the following behaviours:

    I have set up a TextField and a button, which calls a fileDialog's open() method. When I cancel the fileDialog and go back to my TextField, I cannot edit it anymore (no deletion, no insertion of text possible). Why is that?

    Also, since I am on the topic: How can I pass text from the TextField to the fileDialog's save field, so that the field that determines the NAME of the file is already prefilled? (Currently "TextField.text" saves the text to the file, but instead I want the text to be the name of the file.)

    ColumnLayout {
            [...]
    	TextField {
    	        id: staffListTitle
    		width: 300
    		height: 28
    	}
            Button {
            	id: btnCreateStaffList
            	text: qsTr("Create Staff List")
            	onClicked: {
            		console.log("Clicked btnCreateStaffList")
            		createNewStaffList()
            	}
                    [...]
             }
    }
    
    function createNewStaffList() {
      [...]
      console.log("staffListTitle.text ", staffListTitle.text)
      saveFileDialog.open()
    }
    
    FileDialog {
      id: saveFileDialog
      folder: shortcuts.home
      selectExisting: false
      nameFilters: ["Text files (*.txt)", "All files (*)"]
      onAccepted: {
        //saveFile(saveFileDialog.fileUrl, staffListTitle.text)
      }
    }
    
    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