当前位置:网站首页>QT embeds the sub QT program window into the current program
QT embeds the sub QT program window into the current program
2022-06-30 11:28:00 【windSnowLi】
Subroutine main code
#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();
// Output
std::cerr << w.winId() << std::endl;
return a.exec();
}
The main code of the main program
InWidgets::InWidgets(QWidget* parent)
: QMainWindow(parent)
{
this->resize(600, 400);
// Get the path where the program is located
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);
// Child window embeds in the current window
process->setParent(this);
}
result

Address :https://download.csdn.net/download/qq_44575789/85800705
边栏推荐
- ESP32-C3入门教程 问题篇⑨——Core 0 panic‘ed (Load access fault). Exception was unhandled. vfprintf.c:1528
- Flutter 从零开始 004 按钮组件
- 考研这些“不靠谱”的经验有多害人?
- Go语言学习之Switch语句的使用
- Oracle NetSuite 助力 TCM Bio,洞悉数据变化,让业务发展更灵活
- Multiparty Cardinality Testing for Threshold Private Set-2021:解读
- Handler source code analysis
- OceanBase 安装 yum 源配置错误及解决办法
- LVGL 8.2 menu from a drop-down list
- Digitalization is not a trial, but a wading out of "Xingzhi Digital China" × History of Foxconn
猜你喜欢

8 lines of code to achieve quick sorting, easy to understand illustrations!

科普达人丨漫画图解什么是eRDMA?

Digitalization is not a trial, but a wading out of "Xingzhi Digital China" × History of Foxconn

R language de duplication operation unique duplicate filter

Qualcomm released the "magic mirror" of the Internet of things case set, and digital agriculture has become a reality

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

The jetpack compose dropdownmenu is displayed following the finger click position

Mathematics (fast power)

Wireguard simple configuration

CVPR 2022 | greatly reduce the manual annotation required for zero sample learning. Mapu and Beiyou proposed category semantic embedding rich in visual information
随机推荐
Multiparty Cardinality Testing for Threshold Private Set-2021:解读
100 important knowledge points that SQL must master: Combined Query
数据库 级联操作
SQL必需掌握的100个重要知识点:使用表别名
10 reasons for system performance failure
Oracle netsuite helps TCM bio understand data changes and make business development more flexible
[xi'anjiaotonguniversity] information sharing of the first and second postgraduate entrance examinations
SQL必需掌握的100个重要知识点:组合查询
再测云原生数据库性能:PolarDB依旧最强,TDSQL-C、GaussDB变化不大
暑假学习记录
LVGL 8.2 re-coloring
The jetpack compose dropdownmenu is displayed following the finger click position
Oceanbase installation Yum source configuration error and Solutions
100 important knowledge points that SQL must master: updating and deleting data
SQL必需掌握的100个重要知识点:使用视图
语音信号处理-基础(五):傅立叶变换
Jetpack Compose DropdownMenu跟随手指点击位置显示
什么是微信小程序,带你推开小程序的大门
Flutter start from scratch 008 form
10 days to learn how to flutter Day10 flutter play animation and packaging