当前位置:网站首页>Qt嵌入子Qt程序窗口到当前程序
Qt嵌入子Qt程序窗口到当前程序
2022-06-30 11:03:00 【windSnowLi】
子程序主要代码
#include "ChildWidgets.h"
#include <QtWidgets/QApplication>
#include <QWindow>
#include <iostream>
#include <QMessageBox>
#include <thread>
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
ChildWidgets w;
w.show();
w.createWinId();
// 输出
std::cerr << w.winId() << std::endl;
return a.exec();
}
主程序主要代码
InWidgets::InWidgets(QWidget* parent)
: QMainWindow(parent)
{
this->resize(600, 400);
// 获取程序所在路径
QString path = QCoreApplication::applicationDirPath();
path += "/ChildWidgets.exe";
process = new QProcess(this);
connect(process, &QProcess::readyReadStandardError, [&]() {
quint64 winId = process->readAllStandardError().toLongLong();
QWindow* childWin = QWindow::fromWinId(winId);
if (childWin)
{
QWidget* widget = QWidget::createWindowContainer(childWin);
this->setCentralWidget(widget);
}
});
process->start(path);
// 子窗口嵌入当前窗口
process->setParent(this);
}
结果

地址:https://download.csdn.net/download/qq_44575789/85800705
边栏推荐
- 孔松(信通院)-数字化时代云安全能力建设及趋势
- 记一次ViewPager + RecyclerView的内存泄漏
- LVGL 8.2 Image styling and offset
- LVGL 8.2 menu from a drop-down list
- Line generation (Gauss elimination method, linear basis)
- Key library function based on Hal Library
- LVGL 8.2 Simple Drop down list
- Deep dive kotlin synergy (16): Channel
- The latest collection of arouter problems
- It's time for the kotlin coroutine to schedule thread switching to solve the mystery
猜你喜欢

The jetpack compose dropdownmenu is displayed following the finger click position

语音识别-基础(一):简介【语音转文本】

Mathematics (fast power)

ArrayList and sequence table

关于IP定位查询接口的测评Ⅲ

Methods and usage of promise async and await

Time complexity and space complexity

【IC5000教程】-01-使用daqIDEA图形化debug调试C代码
![When does the database need to use the index [Hangzhou multi surveyors] [Hangzhou multi surveyors _ Wang Sir]](/img/2a/f07a7006e0259d78d046b30c761764.jpg)
When does the database need to use the index [Hangzhou multi surveyors] [Hangzhou multi surveyors _ Wang Sir]

WireGuard简单配置
随机推荐
OceanBase 安装 yum 源配置错误及解决办法
高通发布物联网案例集 “魔镜”、数字农业已经成为现实
林克庆到番禺区调研“发展要安全”工作 以“时时放心不下”责任感抓好安全发展各项工作
[understanding of opportunity -34]: fate is within the light cone
压缩状态DP位运算
数据库 级联操作
Wechat Emoji is written into the judgment, and every Emoji you send may become evidence in court
Time complexity and space complexity
[IC5000 tutorial] - 01- use daqdea graphical debug to debug C code
LiveData源码赏析三 —— 常见问题
语音信号处理-基础(五):傅立叶变换
Go语言学习之Switch语句的使用
ESP32-C3入门教程 IoT篇⑤——阿里云 物联网平台 EspAliYun RGB LED 实战之批量生产的解决方案
SQL必需掌握的100个重要知识点:使用子查询
数字化不是试出来,而是蹚出来的|行知数字中国 × 富士康史喆
博弈论入门
200000 bonus pool! [Alibaba security × ICDM 2022] the risk commodity inspection competition on the large-scale e-commerce map is in hot registration
go语言defer
华三交换机清空配置
LVGL 8.2 Simple Colorwheel