Qt/QML学习-Dialog

ops/2024/9/23 9:36:44/

QML学习

  • Dialog例程
  • 视频讲解
  • 代码

main.qml

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15Window {width: 640height: 480visible: truetitle: qsTr("Dialog")Dialog {id: dialoganchors.centerIn: Overlay.overlaytitle: "这里是标题"standardButtons: Dialog.Ok | Dialog.Cancel // 设置标准按钮组合// 头视图header: Text {text: dialog.titlefont.pointSize: 15font.bold: truepadding: 10Rectangle {implicitWidth: parent.widthimplicitHeight: 2anchors.bottom: parent.bottomcolor: "green"}}// 尾视图footer: Text {text: "这里有小尾巴"font.pointSize: 10padding: 10Rectangle {implicitWidth: parent.widthimplicitHeight: 1anchors.top: parent.topcolor: "green"}}// 背景视图background: Rectangle {opacity: 0.3border.width: 1}// 内容视图Rectangle {implicitHeight: 200implicitWidth: 300color: "red"Text {anchors.centerIn: parenttext: "这里是内容"font.pointSize: 30}Button {id: cancelanchors.bottom: parent.bottomanchors.right: parent.righttext: "Cancel"font.pointSize: 20Rectangle {width: 1height: parent.heightanchors.left: parent.left}onClicked: {dialog.rejected()dialog.close()}}Button {id: okanchors.bottom: parent.bottomanchors.right: cancel.lefttext: "Ok"font.pointSize: 20onClicked: {dialog.accepted()dialog.close()}}}// 模态modal: trueonAccepted: {logText.text = "点击了Ok"}onRejected: {logText.text = "点击了Cancel"}}// 添加一个按钮来打开对话框Button {id: buttontext: "打开对话框"anchors.centerIn: parentonClicked: {dialog.open() // 打开对话框}}// 演示用Text {id: logTextanchors.top: button.bottomanchors.horizontalCenter: parent.horizontalCentertopPadding: 10text: "点击结果"font.pointSize: 20}
}

演示

视频讲解


http://www.ppmy.cn/ops/104654.html

相关文章

autosub:安装与使用

https://www.zhihu.com/question/662188521/answer/3607536719 题目描述:拿到了一段mp4文件。尝试了一下ffmpeg,发现里面没有字幕流。现在需要的是导出他的字幕。 搜索了一下,发现有很多公司有相关的产品。但是无一例外都是要付费的&#x…

vue手机端 搜索框调起带搜索键盘,点击确认自动关闭

效果如下图 步骤&#xff1a; 1.html,所需配置参数都在下图 <el-form :inline"true" :mode"serchFormf" class"searchForm" action"javascript:return true;"><el-form-item label"" ><el-inputsize"…

使用 `wget` 和 `curl` 命令行工具的全面指南

个人名片 &#x1f393;作者简介&#xff1a;java领域优质创作者 &#x1f310;个人主页&#xff1a;码农阿豪 &#x1f4de;工作室&#xff1a;新空间代码工作室&#xff08;提供各种软件服务&#xff09; &#x1f48c;个人邮箱&#xff1a;[2435024119qq.com] &#x1f4f1…

metagpt指南浅谈

MetaGPT多智能体框架概述 1.1 框架介绍 MetaGPT是一个创新的多智能体框架&#xff0c;旨在通过模拟和优化多智能体系统的行为来处理复杂的软件开发任务。该框架的核心优势在于其能够通过智能体之间的协作和交互&#xff0c;高效地解决单一智能体难以独立完成的复杂问题。Meta…

微服务间调用

一、restTemplate 1、先将restTemplate注册成为一个bean Configuration public class RemoteCallConfig {Beanpublic RestTemplate restTemplate() {return new RestTemplate();} }2、实现代码 private void handleCartItems(List<CartVO> vos) {// TODO 1.获取商品id…

测试建模的系统化方法

测试建模的系统化方法 前言一、测试建模的重要性二、四步测试设计方法概述2.1 建模2.1.1 流程类建模2.1.2 参数类建模2.1.3 数据类建模2.1.4 组合类建模 2.2 基础测试用例设计2.2.1 等价类分析2.2.2 边界值分析2.2.3 路径分析法2.2.4 判定表分析法2.2.5 正交分析法2.2.6 错误推…

CC工具箱使用指南:【整库计算YSDM】

一、简介 这是一个批量计算【YSDM】的小工具。 一般的数据库要素或表格都有一个【YSDM】字段&#xff0c;用来标识要素类或表格。 【YSDM】的值通常是固定的&#xff0c;入库标准都会给定一个YSDM表&#xff0c;如下&#xff1a; 我们需要将表的内容保存或转换为excel格式&a…

021集—— 数据的大小端序转换——C#学习笔记

整形数据的大小端序转换&#xff1a; 代码如下&#xff1a; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace ConsoleApp1 {class a {public static int EndianReverse(int oldvalue) {//in…