Qt联系方式界面设计

embedded/2024/10/21 10:17:37/

1 "显示用户的联系方式”设计

(1) 添加该工程的提供主要显示用户的联系方式界面的函数所在的文件,在"Example" 项目名上单击鼠标右键,在弹出的快捷菜单中选择“添加新文件…”选项,在弹出的对话框中选择

"C++ Class" 选项。单击"Choose…”按钮,在弹出的对话框的"Base class" 的下拉列表框中选择基类名为

"QWidget",

"Class name" 文本框中输入类的名称" Contact" 。

(2) 单击“下一步”按钮,单击“完成”按钮,添加

"contact.h" 头文件和

"contact.cpp"

源文件。

(3) 打开

"contact.h" 头文件,添加如下代码:

II添加的头文件

#include <QLabel> 

#include <QGridLayout> 

#include <QLineEdit> 

#include <QCheckBox> 

class Contact : public QWidget 

Q OBJECT 

public: 

explicit Contact(QWidget *parent=O); 

signals: 

public slots: 

private: 

) ; 

QLabel *EmailLabel; 

QLineEdit *EmailLineEdit; 

QLabel *AddrLabel; 

QLineEdit *AddrLineEdit; 

QLabel *CodeLabel; 

QLineEdit *CodeLineEdit; 

QLabel *MoviTelLabel; 

QLineEdit *MoviTelLineEdit; 

QCheckBox *MoviTelCheckBook; 

QLabel *ProTelLabel; 

QLineEdit *ProTelLineEdit; 

QGridLayout *mainLayout; 

(4) 打开

"contact.cpp" 文件,添加如下代码:

Contact::Contact(QWidget *parent) : QWidget(parent) 

EmailLabel =new QLabel(tr(" 电子邮件:"));

EmailLineEdit =new QLineEdit; 

AddrLabel =new QLabel(tr(" 联系地址:"));

AddrLineEdit =new QLineEdit; 

CodeLabel =new QLabel(tr(" 邮政编码:"));

CodeLineEdit =new QLineEdit; 

MoviTelLabel =new QLabel(tr(" 移动电话:")); 

MoviTelLineEdit =new QLineEdit; 

MoviTelCheckBook =new QCheckBox(tr(" 接收留言")) ; 

ProTelLabel =new QLabel(tr(" 办公电话:“));

ProTelLineEdit =new QLineEdit; 

mainLayout =new QGridLayout(this); 

mainLayout->setMargin (15); 

mainLayout->setSpacing(lO); 

mainLayout->addWidget(EmailLabel,0,0); 

mainLayout->addWidget(EmailLineEdit,0,:).); 

mainLayout->addWidget(AddrLabel,1,0); 

mainLayout->addWidget(AddrLineEdit,1,1); 

mainLayout->addWidget(CodeLabel,2,0); 

mainLayout->addWidget(CodeLineEdit,2,1); 

mainLayout->addWidget(MoviTelLabel,3,0); 

mainLayout->addWidget(MoviTelLineEdit,3,1); 

mainLayout->addWidget(MoviTelCheckBook,3,2); 

mainLayout->addWidget(ProTelLabel,4,0); 

mainLayout->addWidget(ProTelLineEdit,4,1); 

mainLayout->setSizeConstraint(QLayout::SetFixedSize); 

2. "显示用户的详细资料”设计

(1) 添加主要显示用户的详细资料界面的函数所在的文件,在"Example" 项目名上单击鼠

标右键,在弹出的快捷菜单中选择“添加新文件…”选项,在弹出的对话框中选择"C++ Class" 

选项,单击"Choose…”按钮,在弹出的对话框的

"Base

class" 的下拉列表框中选择基类名为

"QWidget", 在

"Class name" 后面的文本框中输入类的名称

"Detail" 。

(2) 单击“下一步”按钮,单击“完成“按钮,添加

"detail.h" 头文件和

"detail.cpp" 源

文件。

(3) 打开

"detail.h" 头文件,添加如一下代码:

//添加的头文件

#include <QLabel> 

#include <QComboBox> 

#include <QLineEdit> 

#include <QTextEdit> 

#include <QGridLayout> 

class Detail : public QWidget


http://www.ppmy.cn/embedded/114288.html

相关文章

全面解析性能测试中的瓶颈分析与优化策略!

在软件开发的生命周期中&#xff0c;性能测试是确保应用程序在不同负载下稳定运行的关键步骤。性能瓶颈是导致系统性能下降的主要原因&#xff0c;及时发现并解决这些瓶颈&#xff0c;能够显著提升系统的响应速度和用户体验。本文将深入探讨性能测试中的瓶颈分析方法与优化策略…

Android架构组件:MVVM模式的实战应用与数据绑定技巧

Android架构组件&#xff08;Android Architecture Components&#xff09;是Google推出的一组帮助开发者设计灵活、可维护应用的库。这些组件旨在解决生命周期管理、数据持久化、UI绑定等问题&#xff0c;促进应用的模块化开发。开发人员可以使用这些组件更容易地实现MVVM、MV…

机器视觉5 检测原理之视觉定位

在机器视觉检测中有一个非常重要的流程就是定位&#xff0c;检测区准确的检测效果的基础是精确的定位。以下是关于OpenCV中matchTemplate检测的详细说明&#xff0c;包括其原理、使用方法和应用场景。 1. matchTemplate 的原理 模板匹配的基本原理是通过滑动模板图像与源图像…

GoFly快速开发框架/Go语言封装的图像相似性比较插件使用说明

说明 图像相似性搜索应用广泛、除了使用搜索引擎搜索类似图片外&#xff0c;像淘宝可以让顾客直接拍照搜索类似的商品信息、应用在商品购物上&#xff0c;也可以应用物体识别比如拍图识花等领域。还有在调研图片鉴权的方案&#xff0c;通过一张图片和图片库中的图片进行比对&a…

Adobe出现This unlicensed Photoshop app has been disabled

Adobe Acrobat或Photoshop软件突然出现This unlicensed Photoshop app has been disabled 症状 解决方法 删除软件安装目录下的AcroCEF和acrocef_1l两个子文件夹。主要是为了删除AcroCEF.exe。 如果存在复发&#xff0c;则删除xxxxxxx\AdobeGCClient\AdobeGCClient.exe。 不…

Live800:从心出发,以情动人:构建深度客户服务文化

在当今这个竞争激烈的市场环境中&#xff0c;企业之间的较量已不仅仅局限于产品质量的比拼&#xff0c;更在于谁能提供更优质、更贴心的客户服务。在这个背景下&#xff0c;“从心出发&#xff0c;以情动人”成为了构建深度客户服务文化的核心理念&#xff0c;它要求企业不仅要…

python 实现average mean平均数算法

average mean平均数算法j介绍 “平均数”&#xff08;Mean&#xff09;或"平均数算法"是统计学中用于描述一组数据集中趋势的一个基本且重要的概念。它表示了数据集中所有数值的“平均”或“中心”位置。最常见的平均数是算术平均数&#xff08;Arithmetic Mean&…

滚雪球学SpringCloud[4.1讲]: Spring Cloud Gateway详解

全文目录&#xff1a; 前言API Gateway的概念与作用什么是API Gateway&#xff1f;API Gateway的作用&#xff1a; Spring Cloud Gateway的核心特性配置Spring Cloud Gateway1. 引入依赖2. 基本路由配置3. 路由与过滤器的使用示例&#xff1a;路径匹配与过滤器 4. 动态路由与负…