当前位置:网站首页>[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 .
边栏推荐
- [rust notes] 18 macro
- SD card reports an error "error -110 whilst initializing SD card
- Shell 传递参数
- 2.2 STM32 GPIO操作
- svg拖动点裁剪图片js特效
- Brush questions in summer -day3
- Research on cooperative control of industrial robots
- Safety science to | travel, you must read a guide
- Getting started with applet cloud development - getting user search content
- 3857墨卡托坐标系转换为4326 (WGS84)经纬度坐标
猜你喜欢
The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
Remote Sensing Image Super-resolution and Object Detection: Benchmark and State of the Art
RT-Thread--Lwip之FTP(2)
【SLAM】ORB-SLAM3解析——跟踪Track()(3)
给新人工程师组员的建议
2.2 STM32 GPIO操作
2.1 rtthread pin device details
2.2 STM32 GPIO operation
[concept] Web basic concept cognition
Quartz misfire missed and compensated execution
随机推荐
The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
3.1 detailed explanation of rtthread serial port device (V1)
jsscript
[padding] an error is reported in the prediction after loading the model weight attributeerror: 'model' object has no attribute '_ place‘
Distributed service framework dobbo
Computer graduation project asp Net fitness management system VS development SQLSERVER database web structure c programming computer web page source code project
Python implementation of maddpg - (1) openai maddpg environment configuration
2.2 STM32 GPIO操作
Analyze 菜单分析
EDCircles: A real-time circle detector with a false detection control 翻译
Audio audiorecord binder communication mechanism
Pointer for in-depth analysis (problem solution)
An article about liquid template engine
ArabellaCPC 2019(补题)
蓝色样式商城网站页脚代码
BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1
Pytorch load data
Overview of OCR character recognition methods
3857墨卡托坐标系转换为4326 (WGS84)经纬度坐标
施努卡:3d视觉检测应用行业 机器视觉3d检测