0
我正在使用Qt 5.7。我的操作系統是Ubuntu 16.04。我的基本代碼是在這裏:Qt:Material Design未運行
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.0
ApplicationWindow {
visible: true
width: 300
height: 300
title: qsTr("Hello World")
Material.theme: Material.Dark
Material.accent: Material.Green
Column {
anchors.centerIn: parent
RadioButton { text: qsTr("Radio Button 1") }
RadioButton { text: qsTr("Radio Button 2") }
RadioButton { text: qsTr("Radio Button 3") }
}
}
我用料設計,但是當我跑在桌面上這個程序,我看到Qt的默認樣式,而不是材料設計:Image Link。我沒有收到任何錯誤或警告。當我在Android設備(平板電腦)和Genymotion上運行此應用程序時,我看到了相同的結果。我正在使用NVIDIA卡,我的驅動程序是X.Org(開源)。但是當我使用NVIDIA 340.98驅動程序時,我收到了這個警告:"NV-GLX" missing on display ":0"
,我發現這款應用程序的風格不是桌面,Android設備或Genymotion上的材質設計。我怎麼解決這個問題?我如何在Qt/QML上使用材料設計?
謝謝,我用[qputenv](http://doc.qt.io/qt-5/qtglobal.html#qputenv):'qputenv(「QT_QUICK_CONTROLS_STYLE」,「material」);'' –