当前位置:网站首页>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 )
边栏推荐
- Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program
- 学历是一张通行证,门票,你有了它,可以踏入更高层次的环境里
- Development of intelligent charging pile (I): overview of the overall design of the system
- Quelle langue choisir pour programmer un micro - ordinateur à puce unique
- Project cost management__ Topic of comprehensive calculation
- 03 FastJson 解决循环引用
- Sending and interrupt receiving of STM32 serial port
- (1) 什么是Lambda表达式
- Screen display of charging pile design -- led driver ta6932
- RESNET code details
猜你喜欢

How does the memory database give full play to the advantages of memory?

Basic knowledge of communication interface

【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进

Interruption system of 51 single chip microcomputer

Oracle database SQL statement execution plan, statement tracking and optimization instance

Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction

Mysql database underlying foundation column

Blue Bridge Cup for migrant workers majoring in electronic information engineering

Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn

2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
随机推荐
Not many people can finally bring their interests to college graduation
Introduction to chromium embedded framework (CEF)
In third tier cities and counties, it is difficult to get 10K after graduation
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
对于新入行的同学,如果你完全没有接触单片机,建议51单片机入门
[Li Kou brush question notes (II)] special skills, module breakthroughs, classification and summary of 45 classic questions, and refinement in continuous consolidation
LeetCode - 673. 最长递增子序列的个数
Project cost management__ Cost management technology__ Article 7 completion performance index (tcpi)
Fundamentals of Electronic Technology (III)__ Chapter 6 combinational logic circuit
My openwrt learning notes (V): choice of openwrt development hardware platform - mt7688
Simple use of MySQL (addition, deletion, modification and query)
Swing transformer details-2
单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
01 business structure of imitation station B project
Working mode of 80C51 Serial Port
03 FastJson 解决循环引用
Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
嵌入式系统没有特别明确的定义
Circular queue related design and implementation reference 1