QT Quick 使用ComboBox使用Flat效果报错
代码中使用 if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) {
qputenv("QT_QUICK_CONTROLS_STYLE", "Flat");
}
让控件使用“Flat”效果,Button什么的控件都可用,但是使用ComboBox会报错,显示如下信息:
qrc:/ExtrasImports/QtQuick/Controls/Styles/Flat/ComboBoxStyle.qml:42:1: module "QtQuick.Extras.Private" is not installed
qml: Failed to load Style for ComboBox_QMLTYPE_42(0x4e90ee8)
file:///C:/Qt/Qt5.7.0_MSVC/5.7/msvc2013/qml/QtQuick/Controls/ComboBox.qml:585: TypeError: Cannot read property of null
file:///C:/Qt/Qt5.7.0_MSVC/5.7/msvc2013/qml/QtQuick/Controls/ComboBox.qml:568: TypeError: Cannot read property '__dropDownStyle' of null
感觉问题出在这里:module "QtQuick.Extras.Private" is not installed,但是不知道怎么更改