Skip to content

Commit 349d584

Browse files
Adjusted MyDockAreaTitleBar source code style
1 parent fcad776 commit 349d584

File tree

1 file changed

+49
-25
lines changed

1 file changed

+49
-25
lines changed

demo/MyDockAreaTitleBar.h

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,58 @@
1-
//
2-
// Created by fuga on 08 nov 2024.
3-
//
4-
51
#ifndef QTADS_MYDOCKAREATITLEBAR_H
62
#define QTADS_MYDOCKAREATITLEBAR_H
3+
/*******************************************************************************
4+
** Qt Advanced Docking System
5+
** Copyright (C) 2017 Uwe Kindler
6+
**
7+
** This library is free software; you can redistribute it and/or
8+
** modify it under the terms of the GNU Lesser General Public
9+
** License as published by the Free Software Foundation; either
10+
** version 2.1 of the License, or (at your option) any later version.
11+
**
12+
** This library is distributed in the hope that it will be useful,
13+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
** Lesser General Public License for more details.
16+
**
17+
** You should have received a copy of the GNU Lesser General Public
18+
** License along with this library; If not, see <http://www.gnu.org/licenses/>.
19+
******************************************************************************/
20+
721

22+
//============================================================================
23+
// INCLUDES
24+
//============================================================================
825
#include <DockAreaTitleBar.h>
926

10-
class MyDockAreaTitleBar : public ads::CDockAreaTitleBar {
27+
28+
/**
29+
* Custom DockAreaTitleBar that adds a custom context menu
30+
*/
31+
class MyDockAreaTitleBar : public ads::CDockAreaTitleBar
32+
{
1133
public:
12-
explicit MyDockAreaTitleBar(ads::CDockAreaWidget* parent)
13-
: CDockAreaTitleBar(parent)
14-
{}
15-
16-
QMenu* buildContextMenu(QMenu*) override
17-
{
18-
auto menu = ads::CDockAreaTitleBar::buildContextMenu(nullptr);
19-
menu->addSeparator();
20-
auto action = menu->addAction(tr("Format HardDrive"));
21-
22-
connect(action, &QAction::triggered, this, [this](){
23-
QMessageBox msgBox;
24-
msgBox.setText("No, just kidding");
25-
msgBox.setStandardButtons(QMessageBox::Abort);
26-
msgBox.setDefaultButton(QMessageBox::Abort);
27-
msgBox.exec();
28-
});
29-
30-
return menu;
31-
}
34+
explicit MyDockAreaTitleBar(ads::CDockAreaWidget *parent) :
35+
CDockAreaTitleBar(parent)
36+
{
37+
}
38+
39+
QMenu* buildContextMenu(QMenu*) override
40+
{
41+
auto menu = ads::CDockAreaTitleBar::buildContextMenu(nullptr);
42+
menu->addSeparator();
43+
auto action = menu->addAction(tr("Format HardDrive"));
44+
45+
connect(action, &QAction::triggered, this, [this]()
46+
{
47+
QMessageBox msgBox;
48+
msgBox.setText("No, just kidding");
49+
msgBox.setStandardButtons(QMessageBox::Abort);
50+
msgBox.setDefaultButton(QMessageBox::Abort);
51+
msgBox.exec();
52+
});
53+
54+
return menu;
55+
}
3256
};
3357

3458
#endif // QTADS_MYDOCKAREATITLEBAR_H

0 commit comments

Comments
 (0)