当前位置:网站首页>Window 1 - > main window of the application (27)
Window 1 - > main window of the application (27)
2022-07-28 08:29:00 【Happy Jiajia】
window 1 -> The main window of the application (27)
The main window is the first window displayed after the application starts
QMainWindow The menu bar is encapsulated in , The toolbar , Central components , Docking components , Status bar and other components
There are many options after clicking the menu .
The whole program consists of a main window and several dialog boxes .
Menu Bar
Toolbars
Dock Widgets
Central Widget
menu bar (QMenuBar)
Drop down menu group (QMenu)
A menu item (QAction)
MainWindow::MainWindow()
{
}
MainWindow* MainWindow::NewInstance()
{
MainWindow* ret = new MainWindow();
if( (ret == NULL) || !ret->construct() )
{
delete ret;
ret = NULL;
}
return ret;
}
bool MainWindow::construct()
{
bool ret = true;
ret = ret && initMenuBar();
return ret;
}
bool MainWindow::initMenuBar()
{
bool ret = true;
QMenuBar* mb = menuBar();
ret = ret && initFileMenu(mb);
return ret;
}
bool MainWindow::initFileMenu(QMenuBar* mb)
{
QMenu* menu = new QMenu("File(&F)");
bool ret = (menu != NULL);
if (ret) {
QAction* action = NULL;
ret = ret && makeAction(action, "New(N)", Qt::CTRL + Qt::Key_N);
if( ret )
{
menu->addAction(action); // add Action item to Menu
}
menu->addSeparator();
ret = ret && makeAction(action, "Exit(X)", Qt::CTRL + Qt::Key_X);
if(ret)
{
menu->addAction(action); // add Action item to Menu
}
}
if( ret )
{
mb->addMenu(menu); // add Menu add to application Menu Bar
}
else
{
delete menu;
}
return ret;
}
bool MainWindow::makeAction(QAction*& action, QString text, int key)
{
bool ret = true;
action = new QAction(text, NULL);
if( action != NULL )
{
action->setShortcut(QKeySequence(key));
}
else
{
ret = false;
}
return ret;
}
MainWindow::~MainWindow()
{
}
边栏推荐
- What happens when you unplug the power? Gaussdb (for redis) dual life keeps you prepared
- OSPF comprehensive experiment (7.12)
- Es6: arrow function usage
- What if you are prompted that your connection to this website is not a private connection?
- js卡片层叠样式的图片切换js特效
- Understand CDN
- What if the computer file cannot be deleted?
- Regular expression for mobile number verification
- [300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)
- Yaml parameter configuration based on singleton mode
猜你喜欢

Huawei Senior Engineer -- BGP routing filtering and community attributes

c语言中函数的介绍(血书20000字!!!!)
![In the task manager, the CPU speed displayed is greater than its maximum speed [main frequency]](/img/90/a3f56ef8f08a8735febba16af227f9.png)
In the task manager, the CPU speed displayed is greater than its maximum speed [main frequency]

百度智能云九州区县大脑,描绘城乡新蓝图!

Some experience of gd32 using Hal Library of ST and Gd official library

XSS知识点和20字符短域名绕过
![MySQL query error [err] 1046 - no database selected](/img/32/7d877571397c1e2024ec488b783e87.png)
MySQL query error [err] 1046 - no database selected

Common solutions for distributed ID - take one

Lecture notes a utility for everyone to generate PCG

JS thoroughly understand this point
随机推荐
任务管理器中,显示的CPU速度大于它的最大速度【主频】
MCU IO port controls 12V voltage on and off, MOS and triode circuit
Exception handling in SQL Server
JS thoroughly understand this point
(Reprinted) plantuml Quick Guide
Forward propagation of deep learning neural networks (1)
记录一次mycat连接Communications link failure问题解决
What are the different tables in MySQL?
How do we run batch mode in MySQL?
PMP practice once a day | don't get lost in the exam -7.13
Mysql, how many columns can be used to create an index?
【13】加法器:如何像搭乐高一样搭电路(上)?
Autodesk desktop licensing service error 1067 handling method
使用FFmpeg来批量生成单图+单音频的一图流视频
How to understand the adjective prefix of socket: "connection oriented" and "connectionless"
03 | project deployment: how to quickly deploy a website developed based on the laravel framework
CarSim simulation quick start (XI) - Driver Model (1)
The core packages and middleware required for golang development cover all areas of the project and are worth collecting
js卡片层叠样式的图片切换js特效
Fxksmdb.exe process description