当前位置:网站首页>About windows and layout
About windows and layout
2022-07-03 10:03:00 【Master Hao】
The key is to add the window back to its layout , Instead of just returning its parent class
// In the maximum state , Double click the screen to display the full screen
else if(preScreen->getScreenState() == ScreenState::maxState)
{
m_screensParent[n]->setWindowFlags(Qt::Window);
When the new window is Qt::Window when , Don't change it parent;
m_screensParent[n]->showFullScreen();
preScreen->setScreenState(ScreenState::fullState);
}
// In full screen mode , Double click the screen to restore the normal display
else if(preScreen->getScreenState() == ScreenState::fullState)
{
m_screensParent[n]->setWindowFlags(Qt::Widget);
screensDivid(nowDevidedNum);
preScreen->setScreenState(ScreenState::normalState);
}
One qwidget After becoming a separate window , Break away from the original layout , You need to reset the layout to add it back . When setting the layout , The parent of the additional window is the object to which the layout belongs .
Because after the current parent Phase at the same time , Do not perform operation .
widget->setParent(m_screensParent[index],Qt::Widget);
Set the parent object with parameters .
Break the relationship with its parent class before deleting :
The old layout must be deleted , To set a new layout .
layout->setParent(nullptr);
layout->deleteLater();
layout = nullptr;
About QWidget::setParent() Use of functions
setParent It can be used to switch one QWidget Corresponding parent window , because QT All of the widget It's all based on the relationship between father and son .
What we should pay special attention to here is ,setParent There are two interfaces , One is setParent(QWidget *parent), One is setParent(QWidget *parent, Qt::WindowFlags f), If the first parameter is called ,parent The flag bit of the window will be reset , If you want to keep the original window flag bit , You must specify a parameter . Let's take a simple example , If your original window flag bit is Qt::Window|Qt::FramelessWindowHint( A free form , Without Borders ), Then you need to bring this parameter to flags in , If not specified , Then its window property will be modified to QWidget 了 ( Will merge with the parent window , And will move the window position to (0,0) The location of )
边栏推荐
- yocto 技术分享第四期:自定义增加软件包支持
- Positive and negative sample division and architecture understanding in image classification and target detection
- STM32 interrupt switch
- It is difficult to quantify the extent to which a single-chip computer can find a job
- STM32 running lantern experiment - library function version
- My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
- You need to use MySQL in the opening experiment. How can you forget the basic select statement? Remedy is coming~
- yocto 技術分享第四期:自定義增加軟件包支持
- Exception handling of arm
- Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
猜你喜欢

Retinaface: single stage dense face localization in the wild

手机都算是单片机的一种,只不过它用的硬件不是51的芯片

嵌入式系统没有特别明确的定义

学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里

03 FastJson 解决循环引用

Yocto technology sharing phase IV: customize and add software package support

Yocto Technology Sharing Phase 4: Custom add package support

Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction

嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走

yocto 技術分享第四期:自定義增加軟件包支持
随机推荐
学习开发没有捷径,也几乎不存在带路会学的快一些的情况
Working mode of 80C51 Serial Port
CEF download, compile project
03 fastjason solves circular references
当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学
getopt_ Typical use of long function
Project cost management__ Cost management technology__ Article 6 prediction
Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
The third paper of information system project manager in soft examination
Leetcode 300 最长上升子序列
The data read by pandas is saved to the MySQL database
Oracle database SQL statement execution plan, statement tracking and optimization instance
Yocto technology sharing phase IV: customize and add software package support
Synchronization control between tasks
LeetCode - 919. 完全二叉树插入器 (数组)
Problems encountered when MySQL saves CSV files
Quelle langue choisir pour programmer un micro - ordinateur à puce unique
Vscode markdown export PDF error
Seven sorting of ten thousand words by hand (code + dynamic diagram demonstration)
Blue Bridge Cup for migrant workers majoring in electronic information engineering