最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Qt6基于Qml的文件對話框演示效果

 更新時間:2022年10月14日 15:10:09   作者:江鳥木又  
這篇文章主要介紹了Qt6基于Qml的文件對話框演示,包括打開單個文件配置和打開多個文件配置及保存文件配置的方法,本文通過實例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下

主界面如下 

 打開單個文件配置

FileDialog {
        id: idFileOpenOne
        fileMode: FileDialog.OpenFile
        nameFilters: ["Pictures (*.png *.jpg *.gif *.bmp)", "All (*.*)"]
        options :FileDialog.ReadOnly
    }

打開多個文件配置

FileDialog {
        id: idFileOpenMore
        fileMode: FileDialog.OpenFiles
        nameFilters: ["Pictures (*.png *.jpg *.gif *.bmp)", "All (*.*)"]
        options :FileDialog.ReadOnly
    }

保存文件配置

FileDialog {
        id: idFileSave
        nameFilters: ["Pictures (*.png *.jpg *.gif *.bmp)", "All (*.*)"]
        fileMode: FileDialog.SaveFile
    }

三個按鈕布局

Row{
        anchors.centerIn: parent
        spacing: 30
        Button{
            text: qsTr("Open")
            height: 48
            width: 120
            MouseArea{
                anchors.fill: parent
                onClicked: {
                   idFileOpenOne.open();
                }
            }
        }
        Button{
            text: qsTr("Open More ...")
            height: 48
            width: 120
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    idFileOpenMore.open();
                }
            }
        }
        Button{
            text: qsTr("Save")
            height: 48
            width: 120
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    idFileSave.open();
                }
            }
        }
    }

點擊效果展示:

完整源碼:

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Qt.labs.platform 1.1
 
ApplicationWindow {
    visible: true
    width: 600
    height: 200
    title: qsTr("Qt6基于Qml的文件對話框演示")
    Row{
        anchors.centerIn: parent
        spacing: 30
        Button{
            text: qsTr("Open")
            height: 48
            width: 120
            MouseArea{
                anchors.fill: parent
                onClicked: {
                   idFileOpenOne.open();
                }
            }
        }
        Button{
            text: qsTr("Open More ...")
            height: 48
            width: 120
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    idFileOpenMore.open();
                }
            }
        }
        Button{
            text: qsTr("Save")
            height: 48
            width: 120
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    idFileSave.open();
                }
            }
        }
    }
 
    FileDialog {
        id: idFileOpenOne
        fileMode: FileDialog.OpenFile
        nameFilters: ["Pictures (*.png *.jpg *.gif *.bmp)", "All (*.*)"]
        options :FileDialog.ReadOnly
    }
 
    FileDialog {
        id: idFileOpenMore
        fileMode: FileDialog.OpenFiles
        nameFilters: ["Pictures (*.png *.jpg *.gif *.bmp)", "All (*.*)"]
        options :FileDialog.ReadOnly
    }
    FileDialog {
        id: idFileSave
        nameFilters: ["Pictures (*.png *.jpg *.gif *.bmp)", "All (*.*)"]
        fileMode: FileDialog.SaveFile
    }
}

到此這篇關(guān)于Qt6基于Qml的文件對話框演示的文章就介紹到這了,更多相關(guān)Qml文件對話框內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

新乐市| 辛集市| 长海县| 库尔勒市| 云霄县| 凤翔县| 略阳县| 铜鼓县| 南城县| 龙海市| 罗源县| 衡水市| 铜陵市| 嘉鱼县| 阜阳市| 青川县| 柘城县| 兴安县| 南康市| 望奎县| 丰台区| 辽宁省| 杭锦后旗| 成安县| 集贤县| 景泰县| 黔西| 广安市| 三穗县| 济南市| 榆树市| 黑龙江省| 楚雄市| 繁昌县| 明溪县| 三穗县| 武川县| 花莲县| 延吉市| 隆安县| 东乡族自治县|