Material 主题在 QML 中似乎不起作用
Material theme doesn't seem to work in QML
我有一个简单的 QML,里面有一个 ApplicationWindow
、RowLayout
和一堆 Buttons
。我已经按照 the docs 应用了 Qt Quick Controls 2 Material
主题,但没有任何改变。怎么了?
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
Material.theme: Material.Dark
Material.accent: Material.Orange
id: window
visible: true
RowLayout {
anchors.horizontalCenter: window.horizontalCenter
anchors.bottomMargin: 32
Button {
text: "A"
}
Button {
text: "B"
}
Button {
text: "C"
}
}
}
导入 QtQuick.Controls.Material 2.0
并设置一些 Material 特定属性不应用 Material 主题。如果使用此处描述的方法之一设置主题,将使用它们:
我有一个简单的 QML,里面有一个 ApplicationWindow
、RowLayout
和一堆 Buttons
。我已经按照 the docs 应用了 Qt Quick Controls 2 Material
主题,但没有任何改变。怎么了?
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
Material.theme: Material.Dark
Material.accent: Material.Orange
id: window
visible: true
RowLayout {
anchors.horizontalCenter: window.horizontalCenter
anchors.bottomMargin: 32
Button {
text: "A"
}
Button {
text: "B"
}
Button {
text: "C"
}
}
}
导入 QtQuick.Controls.Material 2.0
并设置一些 Material 特定属性不应用 Material 主题。如果使用此处描述的方法之一设置主题,将使用它们: