QT入门(一)

QT入门教程:配置与基础操作
这篇博客介绍了QT入门的基础知识,包括如何设置编译器和调试器,选择QT库版本,使用QT Tool中的QT Assistant、Designer、Examples and Demos、Linguist等工具。此外,还讲解了QT项目的构建过程,如使用qmake创建项目文件,通过qmake生成Makefile,以及利用make进行编译。另外,提到了UI文件的编译方法和快捷键的使用,如使用uic命令转换ui文件并使用ctrl+space进行强制补全。
部署运行你感兴趣的模型镜像
安装 http://www.qt.io/download/

然后设置编译器 调试器 QT库版本

QT-tool:

  1. QT Assistant
  2. QT Designer
  3. QT Examples and Demos
  4. QT Linguist











//hello.cpp
#include "hello.h"
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QLabel* label = new QLabel("<h2>hello</h2>");//simple html layout
    label->show();
    return a.exec();
}

//buildconn
#include "buildconn.h"
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QPushButton* button = new QPushButton("quit");
    QObject::connect(button, SIGNAL(clicked(bool)), &a, SLOT(quit()));
    button->show();
    return a.exec();
}

ctrl+space 强制补全

qmake -project (convert .pro to Makefile)

qmake

make (complier)

uic -o ui.h ui.ui //编译UI

ctrl + num 快捷键

#-------------------------------------------------
#
# Project created by QtCreator 2018-06-13T03:19:52
#
#-------------------------------------------------
QT       += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = TopC
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.0
SOURCES += \
        main.cpp \
        topc.cpp
HEADERS += \
        topc.h
FORMS += \
        topc.ui


                

您可能感兴趣的与本文相关的镜像

Anything-LLM

Anything-LLM

AI应用

AnythingLLM是一个全栈应用程序,可以使用商用或开源的LLM/嵌入器/语义向量数据库模型,帮助用户在本地或云端搭建个性化的聊天机器人系统,且无需复杂设置

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值