当前位置:网站首页>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 )
边栏推荐
- Uniapp realizes global sharing of wechat applet and custom sharing button style
- 新系列单片机还延续了STM32产品家族的低电压和节能两大优势
- openEuler kernel 技術分享 - 第1期 - kdump 基本原理、使用及案例介紹
- Serial communication based on 51 single chip microcomputer
- I think all friends should know that the basic law of learning is: from easy to difficult
- Basic knowledge of communication interface
- Drive and control program of Dianchuan charging board for charging pile design
- 手机都算是单片机的一种,只不过它用的硬件不是51的芯片
- Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
- Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction
猜你喜欢
要选择那种语言为单片机编写程序呢
2.Elment Ui 日期选择器 格式化问题
嵌入式本来就很坑,相对于互联网来说那个坑多得简直是难走
There is no specific definition of embedded system
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
JS foundation - prototype prototype chain and macro task / micro task / event mechanism
Not many people can finally bring their interests to college graduation
03 fastjason solves circular references
Leetcode 300 最长上升子序列
Notes on C language learning of migrant workers majoring in electronic information engineering
随机推荐
Mobile phones are a kind of MCU, but the hardware it uses is not 51 chip
Serial communication based on 51 single chip microcomputer
openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
新系列单片机还延续了STM32产品家族的低电压和节能两大优势
01仿B站项目业务架构
el-table X轴方向(横向)滚动条默认滑到右边
getopt_ Typical use of long function
万字手撕七大排序(代码+动图演示)
[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
Google browser plug-in recommendation
STM32 general timer 1s delay to realize LED flashing
Stm32f407 key interrupt
2021-11-11 standard thread library
yocto 技术分享第四期:自定义增加软件包支持
Yocto technology sharing phase IV: customize and add software package support
CEF download, compile project
01 business structure of imitation station B project
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
2. Elment UI date selector formatting problem
(1) What is a lambda expression