技术栈

qt项目使用其他项目的ui之单继承之成员变量

mengzhi啊2024-10-25 17:49

第一步添加.ui文件

第二步,点击编译(原理:qt的uic会将.ui界面编译成c++文件)

第三步:在编译后的目录下找到#include "ui_pagewidget.h"

第四步:

复制代码
#ifndef USA_H
#define USA_H

#include <QWidget>

#include "ui_pagewidget.h"

class USA:public QWidget
{
    Q_OBJECT
public:
    USA();

private:
   Ui::PageWidget ui;

};

#endif // USA_H
复制代码
#include "usa.h"

USA::USA()
{

    ui.setupUi(this);

}

效果图:

上一篇:026_Callbacks_in_MATLAB中APP界面回调函数编程实现
下一篇:Tcp_Sever(线程池版本的 TCP 服务器)
相关推荐
用户80553369803
5 天前
不止三件套:QObject 属性系统全关键字与运行时反射!
c++·qt
xcyxiner
5 天前
DicomViewer (vcpkg Windows和ubuntu编译)7
qt
Quz
10 天前
QML Hello World 入门示例
qt
xcyxiner
13 天前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner
14 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner
14 天前
DicomViewer (添加模型类)3
qt
xcyxiner
15 天前
DicomViewer (目录调整) 2
qt
xcyxiner
15 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
laowangpython
17 天前
Photoshop 2025 下载安装全攻略
其他·ui·photoshop
桥田智能
17 天前
桥田智能 QT-650S:面向白车身焊装的 800kg 重载快换解决方案
开发语言·qt·系统架构
热门推荐
012026 年 AI 编程工具终极横评:Cursor vs Claude Code vs Copilot vs Windsurf02GitHub 镜像站点03【AI】2026 年具身智能模型和世界模型总结04AI科技热点日报 | 2026年07月01日052026 AI 编程工具终极实战指南:Cursor vs Claude Code vs Copilot,开发者该怎么选?062026年6月AI大模型全景报告:GPT-5.6、Claude Opus 4.8、Gemini 3.5,中美AI三足鼎立谁主沉浮?072026 年 AI 大模型 & AI 编程工具实战全总结08Claude Code、Codex、Cursor三分天下:2026年AI编程Agent生态全景剖析092026年6月AI行业全景:从百模大战到Agent元年,这30天发生了什么?10Trae国际版与国内版深度测评:AI原生IDE的双生花