Skip to content

Commit 4d657da

Browse files
committed
update Qt Advanced Docking to 4.5
1 parent 1af870d commit 4d657da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+9829
-1480
lines changed

3rdparty/Qt-Advanced-Docking/CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ set(ads_SRCS
2929
src/FloatingDragPreview.cpp
3030
src/IconProvider.cpp
3131
src/DockComponentsFactory.cpp
32+
src/AutoHideSideBar.cpp
33+
src/AutoHideTab.cpp
34+
src/AutoHideDockContainer.cpp
35+
src/PushButton.cpp
36+
src/ResizeHandle.cpp
3237

3338
src/ads.qrc
3439

@@ -50,11 +55,17 @@ set(ads_SRCS
5055
include/Qads/FloatingDragPreview.h
5156
include/Qads/IconProvider.h
5257
include/Qads/DockComponentsFactory.h
58+
include/Qads/AutoHideSideBar.h
59+
include/Qads/AutoHideTab.h
60+
include/Qads/AutoHideDockContainer.h
61+
include/Qads/PushButton.h
62+
include/Qads/ResizeHandle.h
5363
)
5464

5565
if (UNIX AND NOT APPLE)
5666
set(ads_SRCS
5767
src/linux/FloatingWidgetTitleBar.cpp
68+
src/linux/FloatingWidgetTitleBar.h
5869
${ads_SRCS}
5970
)
6071
endif()
@@ -66,8 +77,9 @@ target_compile_definitions(qt_advanced_docking PUBLIC ADS_STATIC)
6677
target_link_libraries(qt_advanced_docking PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
6778

6879
if(UNIX AND NOT APPLE)
80+
target_include_directories(qt_advanced_docking PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
6981
target_link_libraries(qt_advanced_docking PUBLIC Qt5::X11Extras)
70-
target_link_libraries(qt_advanced_docking PRIVATE xcb)
82+
target_link_libraries(qt_advanced_docking PRIVATE xcb)
7183
endif()
7284

7385
set_target_properties(qt_advanced_docking PROPERTIES

3rdparty/Qt-Advanced-Docking/README.md

Lines changed: 783 additions & 338 deletions
Large diffs are not rendered by default.
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
#ifndef AutoHideDockContainerH
2+
#define AutoHideDockContainerH
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 AutoHideDockContainer.h
24+
/// \author Syarif Fakhri
25+
/// \date 05.09.2022
26+
/// \brief Declaration of CAutoHideDockContainer class
27+
//============================================================================
28+
29+
//============================================================================
30+
// INCLUDES
31+
//============================================================================
32+
#include "ads_globals.h"
33+
34+
#include <QSplitter>
35+
#include "AutoHideTab.h"
36+
37+
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
38+
39+
namespace ads
40+
{
41+
struct AutoHideDockContainerPrivate;
42+
class CDockManager;
43+
class CDockWidget;
44+
class CDockContainerWidget;
45+
class CAutoHideSideBar;
46+
class CDockAreaWidget;
47+
class CDockingStateReader;
48+
struct SideTabBarPrivate;
49+
50+
/**
51+
* Auto hide container for hosting an auto hide dock widget
52+
*/
53+
class ADS_EXPORT CAutoHideDockContainer : public QFrame
54+
{
55+
Q_OBJECT
56+
Q_PROPERTY(int sideBarLocation READ sideBarLocation)
57+
private:
58+
AutoHideDockContainerPrivate* d; ///< private data (pimpl)
59+
friend struct AutoHideDockContainerPrivate;
60+
friend CAutoHideSideBar;
61+
friend SideTabBarPrivate;
62+
63+
protected:
64+
virtual bool eventFilter(QObject* watched, QEvent* event) override;
65+
virtual void resizeEvent(QResizeEvent* event) override;
66+
virtual void leaveEvent(QEvent *event) override;
67+
virtual bool event(QEvent* event) override;
68+
virtual void dragLeaveEvent(QDragLeaveEvent* ev) override;
69+
70+
/**
71+
* Updates the size considering the size limits and the resize margins
72+
*/
73+
void updateSize();
74+
75+
/*
76+
* Saves the state and size
77+
*/
78+
void saveState(QXmlStreamWriter& Stream);
79+
80+
public:
81+
using Super = QFrame;
82+
83+
/**
84+
* Create Auto Hide widget with the given dock widget
85+
*/
86+
CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area,
87+
CDockContainerWidget* parent);
88+
89+
/**
90+
* Virtual Destructor
91+
*/
92+
virtual ~CAutoHideDockContainer();
93+
94+
/**
95+
* Gets the side tab bar
96+
*/
97+
CAutoHideSideBar* autoHideSideBar() const;
98+
99+
/**
100+
* Returns the side tab
101+
*/
102+
CAutoHideTab* autoHideTab() const;
103+
104+
/**
105+
* Gets the dock widget in this dock container
106+
*/
107+
CDockWidget* dockWidget() const;
108+
109+
/**
110+
* Returns the index of this container in the sidebar
111+
*/
112+
int tabIndex() const;
113+
114+
/**
115+
* Adds a dock widget and removes the previous dock widget
116+
*/
117+
void addDockWidget(CDockWidget* DockWidget);
118+
119+
/**
120+
* Returns the side tab bar area of this Auto Hide dock container
121+
*/
122+
SideBarLocation sideBarLocation() const;
123+
124+
/**
125+
* Sets a new SideBarLocation.
126+
* If a new side bar location is set, the auto hide dock container needs
127+
* to update its resize handle position
128+
*/
129+
void setSideBarLocation(SideBarLocation SideBarLocation);
130+
131+
/**
132+
* Returns the dock area widget of this Auto Hide dock container
133+
*/
134+
CDockAreaWidget* dockAreaWidget() const;
135+
136+
/**
137+
* Returns the parent container that hosts this auto hide container
138+
*/
139+
CDockContainerWidget* dockContainer() const;
140+
141+
/**
142+
* Moves the contents to the parent container widget
143+
* Used before removing this Auto Hide dock container
144+
*/
145+
void moveContentsToParent();
146+
147+
/**
148+
* Cleanups up the side tab widget and then deletes itself
149+
*/
150+
void cleanupAndDelete();
151+
152+
/*
153+
* Toggles the auto Hide dock container widget
154+
* This will also hide the side tab widget
155+
*/
156+
void toggleView(bool Enable);
157+
158+
/*
159+
* Collapses the auto hide dock container widget
160+
* Does not hide the side tab widget
161+
*/
162+
void collapseView(bool Enable);
163+
164+
/**
165+
* Toggles the current collapse state
166+
*/
167+
void toggleCollapseState();
168+
169+
/**
170+
* Use this instead of resize.
171+
* Depending on the sidebar location this will set the width or height
172+
* of this auto hide container.
173+
*/
174+
void setSize(int Size);
175+
176+
/**
177+
* Resets the width or height to the initial dock widget size dependinng on
178+
* the orientation.
179+
* If the orientation is Qt::Horizontal, then the height is reset to
180+
* the initial size and if orientation is Qt::Vertical, then the width is
181+
* reset to the initial size
182+
*/
183+
void resetToInitialDockWidgetSize();
184+
185+
/**
186+
* Returns orientation of this container.
187+
* Left and right containers have a Qt::Vertical orientation and top / bottom
188+
* containers have a Qt::Horizontal orientation.
189+
* The function returns the orientation of the corresponding auto hide
190+
* side bar.
191+
*/
192+
Qt::Orientation orientation() const;
193+
194+
/**
195+
* Removes the AutoHide container from the current side bar and adds
196+
* it to the new side bar given in SideBarLocation
197+
*/
198+
void moveToNewSideBarLocation(SideBarLocation SideBarLocation, int TabIndex = -1);
199+
};
200+
} // namespace ads
201+
202+
//-----------------------------------------------------------------------------
203+
#endif

0 commit comments

Comments
 (0)