当前位置:网站首页>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
边栏推荐
- Algorithme leetcode 86. Liste des liens séparés
- Understanding society at the age of 14 - reading notes on "happiness at work"
- 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
- SQL必需掌握的100个重要知识点:插入数据
- When does the database need to use the index [Hangzhou multi surveyors] [Hangzhou multi surveyors _ Wang Sir]
- ARouter 最新问题合集
- 创建型-配置工厂
- 第一届中国数字藏品大会即将召开
- LVGL 8.2 Drop down in four directions
- Flutter 从零开始 004 按钮组件
猜你喜欢
![[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

在IPhone12的推理延迟仅为1.6 ms!Snap等详析Transformer结构延迟,并用NAS搜出移动设备的高效网络结构...

Jetpack Compose DropdownMenu跟随手指点击位置显示

How harmful are these "unreliable" experiences in the postgraduate entrance examination?

相对位置编码Transformer的一个理论缺陷与对策

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

国内首批!阿里云云原生数据湖产品通过信通院评测认证

OLAP数据库引擎如何选型?

考研这些“不靠谱”的经验有多害人?

promise async和await的方法与使用
随机推荐
datax - 艰难debug路
优惠券种类那么多,先区分清楚再薅羊毛!
The jetpack compose dropdownmenu is displayed following the finger click position
SQL必需掌握的100个重要知识点:插入数据
SQL必需掌握的100个重要知识点:分组数据
The life, working principle and application of electrochemical oxygen sensor
Flutter 从零开始 004 按钮组件
第一届中国数字藏品大会即将召开
[leetcode 16] sum of three numbers
sublist3r报错解决
SQL必需掌握的100个重要知识点:使用视图
LeetCode Algorithm 86. 分隔链表
【leetcode 16】三数之和
promise async和await的方法与使用
100 important knowledge points that SQL must master: using table aliases
MCU firmware packaging Script Software
10 days to learn how to flutter Day10 flutter play animation and packaging
PointDistiller:面向高效紧凑3D检测的结构化知识蒸馏
ArrayList and sequence table
Use of switch statement in go language learning