Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-131659

can't find the control by id

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.8.0
    • None
    • Linux/X11

      error:

      ReferenceError: control is not defined
      

      the key line:

      ListView.view.model.folder = fileUrl
      

      code:

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      import Qt.labs.folderlistmodel
      import Qt.labs.qmlmodels
      import QtQml.Models
      
      ApplicationWindow {
      	visible: true
      	width: 800
      	height: 480
      
      	Button {
      		text: "open"
      		onClicked: control.open()
      	}
      
      
      	Dialog {
      		id: control
      
      		FolderListModel {
      			id: folderModel
      			showDirsFirst: true
      		}
      
      		contentItem: ListView {
      			id: fileListView
      
      			clip: true
      
      			implicitWidth: 400
      			implicitHeight: 300
      
      			model: folderModel
      
      			delegate: ItemDelegate {
      				required property url fileUrl
      
      				width: ListView.view.width
      				text: fileUrl
      
      				onClicked: {
      					ListView.view.model.folder = fileUrl
      					console.log("access control: " + control.width)
      				}
      			}
      		}
      	}
      
      
      }
       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qtqmlteam Qt Qml Team User
            niqingliang2003 niqingliang2003
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes