当前位置:网站首页>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
边栏推荐
- Introduction to game theory
- 10 reasons for system performance failure
- [untitled]
- Ant financial's written test question: what can be quantified in the requirements document? [Hangzhou multi tester] [Hangzhou multi tester \wang Sir]
- SQL必需掌握的100个重要知识点:插入数据
- 暑假学习记录
- 一个人就是一本书
- 导致系统性能失败的10个原因
- Key library function based on Hal Library
- LVGL 8.2 Image
猜你喜欢

第一届中国数字藏品大会即将召开
![[understanding of opportunity -34]: fate is within the light cone](/img/3e/9f5630ba382df7f7ce00705445cef8.jpg)
[understanding of opportunity -34]: fate is within the light cone

相对位置编码Transformer的一个理论缺陷与对策
![200000 bonus pool! [Alibaba security × ICDM 2022] the risk commodity inspection competition on the large-scale e-commerce map is in hot registration](/img/0e/19c4c97a582d7b2ad08ce806d7af03.jpg)
200000 bonus pool! [Alibaba security × ICDM 2022] the risk commodity inspection competition on the large-scale e-commerce map is in hot registration

Wireguard simple configuration

The reasoning delay on iphone12 is only 1.6 MS! Snap et al. Analyzed the transformer structure latency in detail, and used NAS to find out the efficient network structure of mobile devices
![[xi'anjiaotonguniversity] information sharing of the first and second postgraduate entrance examinations](/img/06/df5a64441814c9ecfa2f039318496e.jpg)
[xi'anjiaotonguniversity] information sharing of the first and second postgraduate entrance examinations

从开源项目探讨“FPGA挖矿”的本质
![[IC5000 tutorial] - 01- use daqdea graphical debug to debug C code](/img/54/037b62ff9682ae9fdf861263211043.png)
[IC5000 tutorial] - 01- use daqdea graphical debug to debug C code

ESP32-C3入门教程 问题篇⑨——Core 0 panic‘ed (Load access fault). Exception was unhandled. vfprintf.c:1528
随机推荐
LVGL 8.2 Simple Image button
Wechat Emoji is written into the judgment, and every Emoji you send may become evidence in court
“新数科技”完成数千万元A+轮融资,造一体化智能数据库云管理平台
单片机 MCU 固件打包脚本软件
19年来最艰难的618,徐雷表达三个谢意
一个人就是一本书
SQL必需掌握的100个重要知识点:使用表别名
Line generation (Gauss elimination method, linear basis)
100 important knowledge points that SQL must master: grouping data
Multiparty Cardinality Testing for Threshold Private Set-2021:解读
Algorithme leetcode 86. Liste des liens séparés
Esp32-c3 introductory tutorial question ⑨ - core 0 panic 'ed (load access fault) Exception was unhandled. vfprintf. c:1528
数学(快速幂)
LeetCode Algorithm 86. 分隔链表
暑假学习记录
第一届中国数字藏品大会即将召开
如何通过GDB分析Native Crash
R语言去重操作unique duplicate filter
【leetcode 239】滑动窗口
SQL必需掌握的100个重要知识点:联结表