一.简介

在项目Application中:

QT Widgets Application(桌面QT应用)

QT Console Application(控制台QT应用)

QT for Python-Empty / Window(用Python开发QT应用)

QT Quick Application-Empty / Scroll / Stack /Swipe(移动平台开发QT应用)

1.Location

填一下项目名和项目地址

2.Kits

3.Details

类名(C):

基类(B):QMainWindow/QWidget/QDialog

头文件(H):

源文件(S):

创建界面(G):勾选

界面文件(F):

4.汇总

二.QMainWindow

三.QWidget

1.窗口框架

2.附加窗口

QWidget widget;
widget.setWindowTitle(QObject::tr("k5"));
widget.resize(, );
widget.move(, );
widget.show(); int x = widget.x();
qDebug("x:%d", x); int y = widget.y();
qDebug("y:%d", y);

四.QDialog

QDialog类继承与QWidget类

注意:添加hellodialog.ui文件的时候,要把里面的 <class>HelloDialog</class>

                       <widget class = "QDialog" name = "HelloDialog"> 改过来,不然会无法识别 ui 这个指针

1.窗口框架

// hellodialog.h

#ifndef HELLODIALOG_H
#define HELLODIALOG_H #include <QDialog> namespace Ui{
class HelloDialog;
} class HelloDialog : public QDialog{ Q_OBJECT
public:
explicit HelloDialog(QWidget* parent = nullptr);
~HelloDialog(); private:
Ui::HelloDialog* ui;
}; #endif // HELLODIALOG_H
// hellodialog.cpp

#include "hellodialog.h"
#include "ui_hellodialog.h" HelloDialog::HelloDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::HelloDialog)
{
ui->setupUi(this); } HelloDialog::~HelloDialog()
{
delete ui;
}
// main.cpp

#include "hellodialog.h"
#include <QApplication> int main(int argc, char* argv[])
{
QApplication a(argc, argv);
HelloDialog w;
w.show(); return a.exec();
}

2.附加窗口

(1)模态对话框
QDialog* dialog = new QDialog(this);
dialog->setModal(true);
dialog->show(); QDialog dialog;
dialog.setModal(true);
dialog.show()
(2)非模态对话框
QDialog* dialog = new QDialog(this);
dialog->show(); QDialog dialog;
dialog.show()

3.对话框状态

QDialog dialog;
if (dialog.exec() == QDialog::Accepted)

最新文章

  1. 基础知识javascript--事件
  2. .Net生成HTML的三种方法
  3. 最大M子段和 V2
  4. python中的列表(list) 切片详解
  5. 使用CSS修改HTML5 input placeholder颜色( 转载 )
  6. Linux 设备模型浅析之 uevent 篇(2)
  7. HDU 5266 pog loves szh III (线段树+在线LCA转RMQ)
  8. git的使用与积累
  9. Aop编程--注解与xml的实现
  10. clob字段的值插入和查询N种方法【包括java调用存储过程传入clob参数】
  11. etectMultiScale(gray, 1.2,3,CV_HAAR_SCALE_IMAGE,Size(30, 30))
  12. canvas-7globleCompositeOperation.html
  13. group by 和where 条件后面不能用刚设置的别名。
  14. centos6启动服务说明
  15. setting.xml配置文件
  16. samba服务和nginx服务
  17. 运放参数的详细解释和分析-part3,输入失调电压Vos及温漂
  18. 11JavaScript事件
  19. PTA基础编程题目集6-3简单求和 (函数题)
  20. 软工网络15团队作业4-DAY3

热门文章

  1. html页面渲染过程
  2. js call apply bind
  3. Unity ShaderLab 光照随笔
  4. UOJ #32. 【UR #2】跳蚤公路【Floydbellman-ford】
  5. Kaggle 数据挖掘比赛经验分享
  6. CC22:检查是否为BST
  7. background-attachment:fixed不兼容性
  8. HDU-1827-Summer Holiday(强连通分量,贪心)
  9. Ubuntu上k8s集群里创建证书
  10. 关于byte[]和字符串的转换