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的更多相关文章
随机推荐
- Hand on Machine Learning 第二章:端到端的机器学习
1.import 模块 import os import tarfile from six.moves import urllib import pandas as pd pd.set_option( ...
- 2019寒假作业一:PTA7-1 打印沙漏
- 打印沙漏 ( 分) 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给定17个“*”,要求按下列格式打印 ***** *** * *** ***** 所谓“沙漏形状”,是指每行输出奇数个符号: ...
- (五:NIO系列) Reactor模式
出处:Reactor模式 本文目录 1. 为什么是Reactor模式 2. Reactor模式简介 3. 多线程IO的致命缺陷 4. 单线程Reactor模型 4.1. 什么是单线程Reactor呢? ...
- python学习第四十六天dir( )函数用法
dir( )函数有点像目录的意思,但是他是包含由模块定义的名称的字符串的排序列表.这个列表包含模块中定义的所有模块,变量和函数的名称. 列举其用法 import time content = dir( ...
- 问题 C: 序列交换
问题 C: 序列交换 时间限制: 1 Sec 内存限制: 128 MB提交: 914 解决: 48[提交] [状态] [命题人:jsu_admin] 题目描述 给一个 1 到 n 的排列,每次可以 ...
- 浏览器是怎样工作的:渲染引擎,HTML解析(连载二)
转载自:http://ued.ctrip.com/blog/how-browsers-work-rendering-engine-html-parsing-series-ii.html 渲染引擎 渲染 ...
- C# Xml.Serialization 节点重命名
XmlElement 节点重命名 XmlRoot 根节点重名称 XmlArray List集合添加根节点 XmlArrayItem List集合中子节点重命名 [Serializable] 将该类标记 ...
- C#传特定的值,获得特定的数组排序
一,在实际业务中,我们会有当我们传任何值进来时,我们要有特定的排序,,比如传进来的是"生物", "历史","化学", 但实际上我们需要的是& ...
- [好好学习]在VMware中安装Oracle Enterprise Linux (v5.7) - (3/5)
进入OEL
- ffmpeg知多少~~~
一.ffmpeg安装: https://jingyan.baidu.com/article/f7ff0bfcd64cea2e26bb1334.html 二.ffmpeg视频处理(包括各种视频流处理 ...