当前位置:网站首页>[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 .
边栏推荐
- Leetcode problem solving -- 173 Binary search tree iterator
- MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置
- ESBuild & SWC浅谈: 新一代构建工具
- Precautions for single chip microcomputer anti reverse connection circuit
- Eight super classic pointer interview questions (3000 words in detail)
- 真机无法访问虚拟机的靶场,真机无法ping通虚拟机
- 深入探究指针及指针类型
- Overview of OCR character recognition methods
- Buuctf question brushing notes - [geek challenge 2019] easysql 1
- Analyze 菜单分析
猜你喜欢

Schnuka: 3D vision detection application industry machine vision 3D detection

NR modulation 1

蓝色样式商城网站页脚代码

EDCircles: A real-time circle detector with a false detection control 翻译

暑期刷题-Day3

Overview of super-resolution reconstruction of remote sensing images

适合程序员学习的国外网站推荐

Pytorch基础——(1)张量(tensor)的初始化

施努卡:3d视觉检测应用行业 机器视觉3d检测

Crazy, thousands of netizens are exploding the company's salary
随机推荐
Lua uses require to load the shared library successfully, but the return is Boolean (always true)
Pointer for in-depth analysis (problem solution)
[slam] lidar camera external parameter calibration (Hong Kong University marslab) does not need a QR code calibration board
2、GPIO相关操作
电机控制反Park变换和反Clarke变换公式推导
Résumé des méthodes de reconnaissance des caractères ocr
SAP ALV单元格级别设置颜色
canvas切积木小游戏代码
记录一下逆向任务管理器的过程
Polymorphic day02
Redis cache breakdown, cache penetration, cache avalanche
Pytorch基础——(2)张量(tensor)的数学运算
MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置
[Li Kou] the second set of the 280 Li Kou weekly match
SWC introduction
Restful style
蓝色样式商城网站页脚代码
Advanced learning of MySQL -- Fundamentals -- isolation level of transactions
Remote Sensing Image Super-resolution and Object Detection: Benchmark and State of the Art
Map sorts according to the key value (ascending plus descending)