QT_study
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的更多相关文章
随机推荐
- 前端 CSS的选择器 伪类选择器 CSS3 nth-child()
first-child 选中第一个标签 应用CSS样式 <!DOCTYPE html> <html lang="en"> <head> < ...
- vue 点击任意地方防止冒泡
$('.mainL').mouseup(function(e){ let objLeader = $(obj.target); // 设置目标区域 if(!objLeader.is(e.target) ...
- [BZOJ2588]Count on a tree(LCA+主席树)
题面 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始为0,即第一个询问 ...
- HDU 5945 题解(DP)(单调队列)
题面: Fxx and game Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) T ...
- Django中orm的惰性机制
那么首先要知道什么是ORM 专业化的角度来说:叫对象关系映射(Object-Relation Mapping)是一种为了解决面向对象与关系数据库存在的互不匹配的现象的技术. 那具体ORM是什么呢?:( ...
- FZUOJ-2273 Triangles
Problem 2273 Triangles Accept: 109 Submit: 360 Time Limit: 1000 mSec Memory Limit : 262144 KB ...
- 从ES6重新认识JavaScript设计模式: 装饰器模式
1 什么是装饰器模式 向一个现有的对象添加新的功能,同时又不改变其结构的设计模式被称为装饰器模式(Decorator Pattern),它是作为现有的类的一个包装(Wrapper). 可以将装饰器理解 ...
- Sudoku (剪枝+状态压缩+预处理)
[题目描述] In the game of Sudoku, you are given a large 9 × 9 grid divided into smaller 3 × 3 subgrids. ...
- jmeter测试结果jtl字段分析
1 Bytes Throughput Over Time 每秒传输字节吞吐量,表明Jmeter在测试时,随着时间推移发送和接受的字节数 2 Response Codes per Second ...
- 微信公众号获取微信token
微信在公众号和小程序的开发都有开放文档一般看文档开发就行,很简单这里写一个小demo获取微信token,之后根据自己的业务获取信息处理即可 package com.demo.ccx; import o ...