当前位置:网站首页>QT入门篇(2.1初入QT的开始第一个程序)
QT入门篇(2.1初入QT的开始第一个程序)
2022-07-24 00:35:00 【被遗忘的梦想】
一.项目创建步骤
1.点击QT软件里面的 New Project(新建项目)
2.点击Application(应用)->Qt Widgets Application(Qt 小部件应用程序)->choos(选择)
3.创建名字和路径->下一步。名字不能是中文
4.下一步
5.下一步
6.完成
二.各个文件的作用生成了
mainwindows.h头文件
main.cpp主函数
mainwindows.cpp头文件对应的函数
mainwindows.ui界面文件
三.代码
mainwindows.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
mainwindows.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
main.cpp
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
运行结果

最终得到一个对话框
边栏推荐
- Redis data structure
- English语法_指示代词 - So
- Intelligent OCR identification of express documents helps the logistics industry to upgrade Digitalization
- Delete all data of specified query criteria in Oracle
- 数仓数据指标和标签体系区别
- GBase 8c 访问权限查询函数(一)
- Sed in-depth understanding and use
- MariaDB database upgrade version
- Gbase 8C access authority query function (6)
- AWS Part 4 one machine and one secret
猜你喜欢

Classic example of C language - convert the input two digits into English

Classic examples of C language - adding two scores

Coloring old photos - deoldify get started quickly

Implementation of singleton mode in C #

Redis | very important Middleware

数据模型设计方法概述

二叉搜索树的简易实现及剖析

C language: deep analysis of const keyword

Robot dog back submachine gun shooting video fire, netizens shivering: stoooooooopppp!

Comparison of the shortcomings of redis master-slave, sentinel and cluster architectures
随机推荐
GBase 8c访问权限查询函数(六)
網絡系統實驗:ping不通的問題解决
Generic mechanism and enhanced for loop
Gbase 8C access authority query function (6)
Gbase 8C binary string operator
Development of main applet for business card traffic near the map
Blog expression Encyclopedia
Blockbuster | certik: Web3.0 industry safety report release in the second quarter of 2022 (PDF download link attached)
Gbase 8C session information function (4)
Interviewer: if the order is not paid within 30 minutes after it is generated, it will be automatically cancelled. How to realize it?
Comparison of the shortcomings of redis master-slave, sentinel and cluster architectures
泛型机制和增强for循环
Classic example of C language - find the minimum number of banknotes
数仓数据标准详解-2022
GBase 8c系统表信息函数(二)
Detailed overview of data standards -2022
Notes and Thoughts on the red dust of the sky (VI) due to lack
Gbase 8C session information function (III)
MySQL table field quantity limit and row size limit
GBase 8c 访问权限查询函数(三)