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. K近邻实现

    1 定义画图函数,用来可视化数据分布 (注:jupyternotebook来编写的代码) import matplotlib.pyplot as plt import numpy as np %con ...

  2. Netty实战之性能调优与设计模式

    设计模式在Netty 中的应用(回顾): 单例模式要点回顾: 一个类在任何情况下只有一个对象,并提供一个全局访问点. 可延迟创建. 避免线程安全问题. 在我们利用netty自带的容器来管理客户端链接的 ...

  3. Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ItemsCustom' in 'class com.pojo.OrderDetailCustom

    再用 junit 测试MyBatis时发现的错误: org.apache.ibatis.exceptions.PersistenceException: ### Error querying data ...

  4. 当系统开启safe_mode和 open_basedir

    当系统开启safe_mode和 open_basedir,在程序中使用以下语句curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);并且遇到301,302状态吗时 ...

  5. css中的居中的方法

    一.垂直居中 (1)inline或者inline-*元素 1. 单行文字 设置上下padding相等 以前一直以为inline元素是没有上下的padding和margin的,其实不然,他们是有上下的p ...

  6. V-Parenthesis 前缀+ZKW线段树或RMQ

    Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i-th questio ...

  7. Spring事务嵌套引发的问题--Transaction rolled back because it has been marked as rollback-only

    转载https://blog.csdn.net/f641385712/article/details/80445912 读了两边才找到问题

  8. 错误提示控件errorProvider

    http://www.cnblogs.com/suguoqiang/archive/2012/07/17/2596564.html 错误提示控件errorProvider VS显示: 核心代码: th ...

  9. a标签实现下载canvas图片

    令 a 的 href = canvas.toDataURL("image/png");

  10. 快速禁止Chrome浏览器缓存

    在前端的开发中,最麻烦的莫过于浏览器的缓存,经常需要清理缓存文件,导致开发效率较低. 但Chrome可以一键禁止浏览器缓存,并且在后续的操作中,无论相同的资源请求多少次,都不会缓存到本地,一起来体验下 ...