Qt Creator ignores QML-Prototype in custom Module
-
Hi all,
I've written a custom QML-Module and therein is a type called MyTextBlock.qml
import QtQuick 2.3 Text { verticalAlignment: Text.AlignVCenter font.pixelSize: 34 font.weight: Font.Bold; }
This type is inside a qrc file and is registered via a
QQmlExtensionPlugin
in the 'registerTypes' method in the following wayqmlRegisterType(QUrl("qrc:/MyTextBlock.qml"), uri, 1, 0, "MyTextBlock");
The
qmldir
of the extension plugin ismodule UiComponents plugin UiComponents typeinfo plugins.qmltypes
and the generated plugins.types is
import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // // This file was auto-generated by: // 'qmlplugindump.exe UiComponents 1.0 D:\plugin\release\' Module { Component { prototype: "QQuickText" name: "UiComponents/MyTextBlock" exports: ["MyTextBlock 1.0"] exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "data" } }
Now I create a new QML-App and import the module and set the QML_IMPORT_PATH property inside the .pro file
The main.qml file looks likeimport QtQuick 2.3 import QtQuick.Window 2.2 import UiComponents 1.0 Window { visible: true width: 360 height: 360 MyTextBlock { color:"red" }
The type MyTextBlock is recognized by QT-Creator and when I hover over the import statement QT-Creator gives me a "Read typeinfo file successfully" but it complains about the color property with the message
Invalid property name "color"
The applications itself runs fine but the error messages in QT-Creator are annoying. Is here something missing that must be done to support Qt-Creator?
As a side note. I've also a pure c++ based QObject inside the module that's also registered and when I uses this object inside an application it's properties are not marked as invalid. Somehow I think QT-Creator ignorest the "inherited" parameters of the prototype of the type. (
QQuickText
in case ofMyTextBlock
)Regards
Tobias -
Indeed, QtCreator seems to ignore the "prototype" member in .qmltypes because the file is generated correctly.