https://blog.csdn.net/a313827758/article/details/72736552

https://blog.csdn.net/xbcreal/article/details/52413007#comments

图标制作:https://jingyan.baidu.com/article/636f38bb664fc2d6b84610fa.html

认识QT

main.cpp基础框架:

#include "mywidget.h"
#include <QApplication> int main(int argc, char *argv[])
{
//有且只有一个应用程序累的对象
QApplication a(argc, argv);
//MyWeight继承QWeight,QWeight是一个窗口基类
//所以MyWeight也是窗口类
//w就是一个窗口
MyWidget w; //窗口创建默认是隐藏的,要人为显示
w.show(); //a.exec();
//return 0;
//让程序一直执行,等待用户操作
//等待事件的发生
return a.exec();
}

.pro基本框架:

#-------------------------------------------------
#
# Project created by QtCreator --17T12::
#
#-------------------------------------------------
#模块
#头文件按f1找
QT += core gui #高于qt4版本,添加QT += widgets,为了兼容qt4
greaterThan(QT_MAJOR_VERSION, ): QT += widgets #应用程序的名字
TARGET = 01Qt_test #指定makefile的类型,app,lib(库)
TEMPLATE = app # The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0. #源文件
SOURCES += \
main.cpp \
mywidget.cpp
#头文件
HEADERS += \
mywidget.h

QT 的 HelloWorld

main.cpp

#include<QApplication>
#include<QWidget>//窗口控件类型
#include<QPushButton>//按钮 int main(int argc,char **argv)
{
QApplication app(argc,argv); QWidget w;//窗口
w.setWindowTitle("Hello World!");//设置标题 /* 如果不指定父对象,对象和对象(窗口和窗口)没有关系,独立
* a指定b为它的父对象,a放在b上面
* 指定父对象有两种方法
* 1、setParent
* 2、通过构造函数传参
* 指定父对象,只要父对象显示,上面的子对象自动显示
*/ QPushButton but;//按钮
but.setText("^_^");//给按钮设置内容
but.setParent(&w);//设置父对象
but.move(,);//设置坐标 QPushButton but1(&w);
but1.setText("Hello!"); w.show(); app.exec();
return ;
}

.pro

QT += widgets

SOURCES += \
main.cpp

QT_study的更多相关文章

随机推荐

  1. if you don't go after what you want, you'll never have it

    conquest.n. 征服 quantitative: adj. 数量的 cellar: n. 地窖 roast. v. 烧烤 allowance. n. 津贴 drainage. n. 排水 ma ...

  2. 事件驱动体系结构(EDA)

  3. [Git] 012 rm 命令的补充

    0. 前言 [Git] 007 三棵树以及向本地仓库加入第一个文件 的 "2.5" 有提及 git rm --cached <file> 1. 介绍 git rm &l ...

  4. Sentinel整合Dubbo限流实战(分布式限流)

    之前我们了解了 Sentinel 集成 SpringBoot实现限流,也探讨了Sentinel的限流基本原理,那么接下去我们来学习一下Sentinel整合Dubbo及 Nacos 实现动态数据源的限流 ...

  5. Vue2+VueRouter2+webpack 构建项目实战(四)接通api,先渲染个列表

    Vue2+VueRouter2+webpack 构建项目实战(四)接通api,先渲染个列表:  Vue2+VueRouter2+Webpack+Axios 构建项目实战2017重制版(一)基础知识概述

  6. 一个阿里云apache服务器配置两个或多个域名forLinux

    一个阿里云apache服务器配置两个或多个域名for Linux: 默认已经配置好了阿里云提供的一键web安装,可以参考:http://www.42iot.com/?id=8 修改/alidata/s ...

  7. H-Updating a Dictionary (模拟)

    In this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, a ...

  8. HDU 1024 Max Sum Plus Plus (递推)

    Max Sum Plus Plus Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  9. SCUT - 77 - 哈利波特与他的魔法杖 - 线段树

    https://scut.online/p/77 线段树的一种奇怪的应用,暴力区间更新,每次update直接pushdown到底部,然后从维护底部.这样下次update的时候假如提前遇到底部就很快返回 ...

  10. Neo4j : 通过节点的 id属性 对节点进行查,改,删操作

    1. "查"操作 , 查找 id 属性 为 501的节点: MATCH (r) WHERE id(r) = 501 RETURN r 2. "改"操作, 更改 ...