材质主题似乎不适用于QML

Vio*_*ffe 6 qt themes qml qtquickcontrols2

我有一个简单的QML用ApplicationWindow,RowLayout和一堆Buttons里面.我根据文档应用了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"
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Yoa*_*ann 9

导入QtQuick.Controls.Material 2.0和设置某些材料特定属性不适用材质主题.如果使用此处描述的方法之一设置主题,则将使用它们:

http://doc.qt.io/qt-5/qtquickcontrols2-styles.html