I can't add a qmldir file to my QML project
-
i want to store locations of plugins and others resources that i use in my projet.Project set up of
2 folders:core and images that contains especially (Button.qml,FileDialog.qml,TextArea.qml,TextEditor.qml/EditMenu.qml/MenuBar.qml) and an image (arrow.png),i have also a folder nammed plugins which contains my plugin i want to import .this is qmlproject file:
@
import QmlProject 1.1Project {
mainFile: "testQML1.qml"/* Include .qml, .js, and image files from current directory and subdirectories */ QmlFiles { directory: "." } JavaScriptFiles { directory: "." } ImageFiles { directory: "." } /* List of plugin directories passed to QML runtime */ importPaths: [ "./plugins" ]
@
this is qmldir file:
@
Button ./Button.qml
FileDialog ./FileDialog.qml
TextArea ./TextArea.qml
TextEditor ./TextEditor.qml
EditMenu ./EditMenu.qmlplugin FileDialog plugins
@
Now,when i tried to do Add New File > General >create (.txt), i am getting error "Failure to add one or more files to project".
So,when i run program,the application output displays:
@
file:///C:/Users/MAXORELI/Documents/QtPrograms/QtQuickTraining/testQML1/TextEditor.qml:20:5: Type MenuBar unavailable
MenuBar{
^
file:///C:/Users/MAXORELI/Documents/QtPrograms/QtQuickTraining/testQML1/core/MenuBar.qml:81:9: Type FileMenu unavailable
FileMenu{
^
file:///C:/Users/MAXORELI/Documents/QtPrograms/QtQuickTraining/testQML1/core/FileMenu.qml:55:5: Directory is not a type
Directory{
@i would resolve it,thanks for advance
-
In the FileMenu.qml, it cant find the definition of the Directory. The other 2 say that they are unavailable because they depend on a child that doesn't exist.
So you only problem is that it can't find Directory. From what i see you haven't mentioned anywhere a Directory component so it is logical.
-
Also i forgot to mention that you could remove the plugin path from qmlproject file and add an import statement in any file you plan to use a component from the plugin. For example if you plan to use the plugin in the core/FileMenu.qml then you could write:
@
import "../plugin"
@That would make anything in plugin folder available to your qml file.
-
Directory is a class contained in my plugin.
[quote author="favoritas37" date="1324029741"]In the FileMenu.qml, it cant find the definition of the Directory. The other 2 say that they are unavailable because they depend on a child that doesn't exist.So you only problem is that it can't find Directory. From what i see you haven't mentioned anywhere a Directory component so it is logical.[/quote]