QML使用Material风格


1、在pro里加入

QT += quickcontrols2

2、在main.cpp里加入

QQuickStyle::setStyle("Material");

3、在qml里

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls 2.2 import QtQuick.Controls.Material 2.2
ApplicationWindow {
    visible: true
    width: 480
    height: 360
    title: qsTr("Material Style")
    Material.theme: Material.Grey
    Material.accent: Material.color("red")
    Column {
        anchors.centerIn: parent
        RadioButton { text: qsTr("Small") }
        RadioButton { text: qsTr("Medium");  checked: true }
        RadioButton { text: qsTr("Large") }
    }
    Button {
        text: qsTr("Button")
        highlighted: true
        Material.background: Material.Teal
        anchors.horizontalCenter: parent.horizontalCenter
    }
}

 参考:https://uzshare.com/view/819927


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM