QQml_colorProvider:未设置颜色提供程序

时间:2013-09-02 22:49:39

标签: c++ qt qml

我的项目中有奇怪的qml错误,

Warning: QQml_colorProvider: no color provider has been set! 
"qrc:/gui/FirstPage.qml:5 Type GuiPage unavailable
qrc:/gui/GuiPage.qml:4 Invalid property assignment: color expected

这是我的GuiPage.qml:

import QtQuick 2.1

Rectangle {
    color:"transparent"
    implicitWidth: 380
    implicitHeight:  350
    property string pageName: "sample"
    property bool active : false
    readonly  property int firstPage: 1
    readonly  property int lastPage: 2
    readonly property int normalPage : 3
    property int pageType : firstPage
    signal pageActivate
    signal pageClose

    property bool hasBlockers: false

    property int pageId: 0
    property QtObject fontLoader:  FontLoader{
        source: "font/Cuprum-Regular.ttf"
    }
}

我使用git stable branch的最后一个Qt,静态构建。

1 个答案:

答案 0 :(得分:0)

为了避免这个问题,需要在Qt5上放一个小补丁(Qt 5.1.1版本仍需要)

--- qtdeclarative/src/quick/qtquick2.cpp    2013-06-15 17:41:23.000000000 +0200
+++ qtdeclarative/src/quick/qtquick2.cpp    2013-07-01 15:12:23.414228504 +0200
@@ -39,6 +39,8 @@
 **
 ****************************************************************************/

+#include "util/qquickglobal.cpp"
+
 #include "qtquick2_p.h"
 #include <private/qqmlengine_p.h>
 #include <private/qquickutilmodule_p.h>

此处详细介绍了此问题:QTBUG-28357