Codes:
//main.qml
import im.sniper.DgConfigFileHandler 1.0
import QtQuick.Dialogs 1.2
...
FileDialog{
id: fileDlg
DgConfigFileHandler {id: dgCfgFileHandler2}
}
I complie codes well and run, then get errors like:
QML debugging is enabled. Only use this in a safe environment.(Crawl: That's a another problem, you can ignore)
QQmlApplicationEngine failed to load component
qrc:/main.qml:22 Cannot assign object to property
And another component like Page, Window, Button, can Instantiate the C++ class. What's wrong?
That's because some components inherits
Item
which own containers, which can be used for storageFileDialog
. See the official documentation for details, Item QML Type's property data.AndFileDialog
can be added any Item-based type implicitly for Default Properties(as @folibis referred to).