QtQuick/Qml系列教程

Qml选择颜色对话框

2018-11-29  本文已影响0人  zhengtianzuo

使用Qt.labs.platform 1.0中的ColorDialog
代码非常的简单

ApplicationWindow {
    id: root
    visible: true
    width: 400
    height: 300
    title: qsTr("Qml选择颜色对话框")
    color: colorDialog.color

    Button{
        text: qsTr("选择颜色")
        height: 48
        width: 120
        anchors.centerIn: parent
        MouseArea{
            anchors.fill: parent
            onClicked: {
                colorDialog.open();
            }
        }
    }

    ColorDialog {
        id: colorDialog
        title: qsTr("选择颜色")
        color: "#AAAAAA"
    }
}
show.gif

需要完整代码请访问QtQuickExamples

上一篇 下一篇

猜你喜欢

热点阅读