您现在的位置是:网站首页> 编程资料编程资料
Qt6基于Qml的文件对话框演示效果_javascript技巧_
2023-05-24
343人已围观
简介 Qt6基于Qml的文件对话框演示效果_javascript技巧_
主界面如下

打开单个文件配置
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 } }到此这篇关于Qt6基于Qml的文件对话框演示的文章就介绍到这了,更多相关Qml文件对话框内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
您可能感兴趣的文章:
相关内容
- JavaScript中innerHTML使用方法实例_javascript技巧_
- nodejs express实现中间件_node.js_
- vue-cli3中如何打包成zip压缩文件_vue.js_
- 前端必会的nodejs知识工具模块使用示例详解_node.js_
- Vue如何实现多页面配置以及打包方式_vue.js_
- nodejs express路由匹配控制及Router模块化使用详解_node.js_
- Vue项目打包(build)时,自动打以时间命名的压缩包方式_vue.js_
- Vue FileManagerPlugin 报错问题及解决_vue.js_
- vue3+vite引入插件unplugin-auto-import的方法_vue.js_
- React 数据获取与性能优化详解_React_
