Skip to content

Commit 115e67e

Browse files
committed
Moved private classes into dedicated header
1 parent a9965bf commit 115e67e

File tree

3 files changed

+94
-51
lines changed

3 files changed

+94
-51
lines changed

src/DockAreaTitleBar.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <QDebug>
4040
#include <QPointer>
4141

42+
#include "DockAreaTitleBar_p.h"
4243
#include "ads_globals.h"
4344
#include "FloatingDockContainer.h"
4445
#include "FloatingDragPreview.h"

src/DockAreaTitleBar.h

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
// INCLUDES
3232
//============================================================================
3333
#include <QFrame>
34-
#include <QToolButton>
3534

3635
#include "ads_globals.h"
3736

@@ -157,56 +156,6 @@ public slots:
157156
void tabBarClicked(int index);
158157
}; // class name
159158

160-
using tTitleBarButton = QToolButton;
161-
162-
/**
163-
* Title bar button of a dock area that customizes tTitleBarButton appearance/behaviour
164-
* according to various config flags such as:
165-
* CDockManager::DockAreaHas_xxx_Button - if set to 'false' keeps the button always invisible
166-
* CDockManager::DockAreaHideDisabledButtons - if set to 'true' hides button when it is disabled
167-
*/
168-
class CTitleBarButton : public tTitleBarButton
169-
{
170-
Q_OBJECT
171-
172-
bool Visible = true;
173-
bool HideWhenDisabled = false;
174-
175-
public:
176-
using Super = tTitleBarButton;
177-
CTitleBarButton(bool visible = true, QWidget* parent = nullptr);
178-
179-
/**
180-
* Adjust this visibility change request with our internal settings:
181-
*/
182-
virtual void setVisible(bool visible) override;
183-
184-
protected:
185-
/**
186-
* Handle EnabledChanged signal to set button invisible if the configured
187-
*/
188-
bool event(QEvent *ev) override;
189-
};
190-
191-
192-
/**
193-
* This spacer widget is here because of the following problem.
194-
* The dock area title bar handles mouse dragging and moving the floating widget.
195-
* The problem is, that if the title bar becomes invisible, i.e. if the dock
196-
* area contains only one single dock widget and the dock area is moved
197-
* into a floating widget, then mouse events are not handled anymore and dragging
198-
* of the floating widget stops.
199-
*/
200-
class CSpacerWidget : public QWidget
201-
{
202-
Q_OBJECT
203-
public:
204-
using Super = QWidget;
205-
CSpacerWidget(QWidget* Parent = 0);
206-
virtual QSize sizeHint() const override {return QSize(0, 0);}
207-
virtual QSize minimumSizeHint() const override {return QSize(0, 0);}
208-
};
209-
210159
}
211160
// namespace ads
212161
//-----------------------------------------------------------------------------

src/DockAreaTitleBar_p.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#ifndef DockAreaTitleBarPH
2+
#define DockAreaTitleBarPH
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+
21+
22+
//============================================================================
23+
/// \file DockAreaTitleBar_p.h
24+
/// \author Uwe Kindler
25+
/// \date 12.10.2018
26+
/// \brief Declaration of classes CTitleBarButton and CSpacerWidget
27+
//============================================================================
28+
29+
30+
//============================================================================
31+
// INCLUDES
32+
//============================================================================
33+
#include <QFrame>
34+
#include <QToolButton>
35+
36+
#include "ads_globals.h"
37+
38+
namespace ads
39+
{
40+
using tTitleBarButton = QToolButton;
41+
42+
/**
43+
* Title bar button of a dock area that customizes tTitleBarButton appearance/behaviour
44+
* according to various config flags such as:
45+
* CDockManager::DockAreaHas_xxx_Button - if set to 'false' keeps the button always invisible
46+
* CDockManager::DockAreaHideDisabledButtons - if set to 'true' hides button when it is disabled
47+
*/
48+
class CTitleBarButton : public tTitleBarButton
49+
{
50+
Q_OBJECT
51+
52+
bool Visible = true;
53+
bool HideWhenDisabled = false;
54+
55+
public:
56+
using Super = tTitleBarButton;
57+
CTitleBarButton(bool visible = true, QWidget* parent = nullptr);
58+
59+
/**
60+
* Adjust this visibility change request with our internal settings:
61+
*/
62+
virtual void setVisible(bool visible) override;
63+
64+
protected:
65+
/**
66+
* Handle EnabledChanged signal to set button invisible if the configured
67+
*/
68+
bool event(QEvent *ev) override;
69+
};
70+
71+
72+
/**
73+
* This spacer widget is here because of the following problem.
74+
* The dock area title bar handles mouse dragging and moving the floating widget.
75+
* The problem is, that if the title bar becomes invisible, i.e. if the dock
76+
* area contains only one single dock widget and the dock area is moved
77+
* into a floating widget, then mouse events are not handled anymore and dragging
78+
* of the floating widget stops.
79+
*/
80+
class CSpacerWidget : public QWidget
81+
{
82+
Q_OBJECT
83+
public:
84+
using Super = QWidget;
85+
CSpacerWidget(QWidget* Parent = 0);
86+
virtual QSize sizeHint() const override {return QSize(0, 0);}
87+
virtual QSize minimumSizeHint() const override {return QSize(0, 0);}
88+
};
89+
90+
}
91+
// namespace ads
92+
//-----------------------------------------------------------------------------
93+
#endif // DockAreaTitleBarPH

0 commit comments

Comments
 (0)