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. Python基础-1 python由来 Python安装入门 注释 pyc文件 python变量 获取用户输入 流程控制if while

    1.Python由来 Python前世今生 python的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间,决心开发一个新的脚 ...

  2. python基础-9__import__ 反射和面向对象基础 self 封装 继承(多继承顺序) 多态

    一 反射 python中的反射功能是由以下四个内置函数提供:hasattr.getattr.setattr.delattr,改四个函数分别用于对对象内部执行:检查是否含有某成员.获取成员.设置成员.删 ...

  3. mysql压缩包安装相关过程命令

    mysqld --remove mysql57 HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL目 ...

  4. HDFS启动过程概述及集群安全模式操作

    1.启动过程概述 Namenode启动时,首先将映像文件(fsimage)载入内存,并执行编辑日志(edits)中的各项操作.一旦在内存中成功建立文件系统元数据的映像,则创建一个新的fsimage文件 ...

  5. 使用Vue开发微信小程序:mpvue框架

    使用Vue开发微信小程序:mpvue框架:https://www.jianshu.com/p/8f779950bfd9

  6. neo4j 基本语法笔记(全)

    按照总监要求看了两天的neo4j 数据库的使用.在网上找了一个基础教程类似于w3c.school的网站(英文 ,中文,中文的翻译的不是很好,如果英文不好可以辅助理解),这个教程基础知识很全全面,从数据 ...

  7. PHP实现简单的万年历

    <?php /*********************** *** 功能:万年历 *** *** 时间:2015/05/23 *** ***********************/ //1. ...

  8. sql server 中 like 中文不匹配问题

    原文:https://blog.csdn.net/miao0967020148/article/details/71108056 MS-SQL Server select * from Book wh ...

  9. mybatis复习笔记(1):

    一.简介:什么是MyBatis 1.MyBatis是一款优秀的持久层框架,支持定制化SQL.存储过程以及高级映射.MyBatis避免了几乎所有的JDBC代码和手动设置参数以及获取结果集.MyBatis ...

  10. 1. AtomicInteger 、Unsafe 及 CAS方法的整理

    本文摘自: https://blog.csdn.net/fanrenxiang/article/details/80623884 http://ifeve.com/sun-misc-unsafe/ h ...