1

我的项目中有奇怪的 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 分支的最后一个 Qt,静态构建。

4

1 回答 1

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

于 2013-09-12T02:39:22.400 回答