当前位置:网站首页>[Qt5] QT QWidget immediately appears and disappears
[Qt5] QT QWidget immediately appears and disappears
2022-07-06 03:29:00 【qq_ forty-three million four hundred and seventy-eight thousand】
Solution :
- If you use the method of generating objects on the stack , namely
QWidget w
. The object is automatically destroyed after the function is executed , Naturally, there is no . Unless it is generated in the parent function or recorded as a class member , So that the object will not be automatically destroyed after the end of the sub function . - If you allocate objects in heap memory , namely
QWidget* w = new QWidget
. The object will not be automatically destroyed after the function is executed , Don't set widget Of parent Under the circumstances ( After setting widget Not alone ), It should not disappear , But be careful about memory leaks . Be careful , Smart pointers are used here, such as sharedptr Still can't , Because after the end of the function body , Smart pointer object destruction , Destroy the objects allocated on the heap at the same time , Methods can be used 1 How to solve .
边栏推荐
- 电机控制反Park变换和反Clarke变换公式推导
- Schnuka: 3D vision detection application industry machine vision 3D detection
- MPLS experiment
- [risc-v] external interrupt
- Shell pass parameters
- 这些不太会
- EDCircles: A real-time circle detector with a false detection control 翻译
- Leetcode problem solving -- 173 Binary search tree iterator
- 2.2 STM32 GPIO操作
- 2. GPIO related operations
猜你喜欢
Safety science to | travel, you must read a guide
真机无法访问虚拟机的靶场,真机无法ping通虚拟机
SAP ALV单元格级别设置颜色
【概念】Web 基础概念认知
3.1 rtthread 串口设备(V1)详解
银行核心业务系统性能测试方法
JS music online playback plug-in vsplayaudio js
Performance analysis of user login TPS low and CPU full
3.1 detailed explanation of rtthread serial port device (V1)
Cubemx 移植正点原子LCD显示例程
随机推荐
Esbuild & SWC: a new generation of construction tools
Brush questions in summer -day3
IPv6 comprehensive experiment
暑期刷题-Day3
jsscript
2.2 fonctionnement stm32 GPIO
resulttype和resultmap的区别和应用场景
Tidb ecological tools (backup, migration, import / export) collation
Python implementation of maddpg - (1) openai maddpg environment configuration
施努卡:视觉定位系统 视觉定位系统的工作原理
Precautions for single chip microcomputer anti reverse connection circuit
【paddle】加载模型权重后预测报错AttributeError: ‘Model‘ object has no attribute ‘_place‘
mysqldump数据备份
Eight super classic pointer interview questions (3000 words in detail)
Overview of super-resolution reconstruction of remote sensing images
【Rust 笔记】18-宏
The solution of permission denied (750 permissions should be used with caution)
MySQL Server层四个日志
Some problem records of AGP gradle
MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置