Skip to content

Commit f6d3d6d

Browse files
2 parents 92369bd + 8f95447 commit f6d3d6d

File tree

8 files changed

+62
-7
lines changed

8 files changed

+62
-7
lines changed

adsConfig.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ include(CMakeFindDependencyMacro)
22
find_dependency(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
33
find_dependency(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
44
find_dependency(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
5-
find_dependency(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
5+
if(UNIX AND NOT APPLE)
6+
find_dependency(Qt5X11Extras ${REQUIRED_QT_VERSION} REQUIRED)
7+
endif()
68
include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake")

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.5)
22
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
33
find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
4-
if (UNIX)
4+
if (UNIX AND NOT APPLE)
55
find_package(Qt5 5.5 COMPONENTS X11Extras REQUIRED)
66
endif()
77
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -48,7 +48,7 @@ set(ads_HEADERS
4848
IconProvider.h
4949
DockComponentsFactory.h
5050
)
51-
if (UNIX)
51+
if (UNIX AND NOT APPLE)
5252
set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS})
5353
set(ads_HEADERS linux/FloatingWidgetTitleBar.h ${ads_HEADERS})
5454
endif()

src/DockFocusController.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge
240240
auto OtherDockWidgetTab = internal::findParent<CDockWidgetTab*>(focusedNow);
241241
if (OtherDockWidgetTab && focusedOld)
242242
{
243-
focusedOld->setFocus();
243+
auto OldFocusedDockWidget = internal::findParent<CDockWidget*>(focusedOld);
244+
if (OldFocusedDockWidget)
245+
{
246+
focusedOld->setFocus();
247+
}
244248
return;
245249
}
246250
}

src/DockManager.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "DockingStateReader.h"
5656
#include "DockAreaTitleBar.h"
5757
#include "DockFocusController.h"
58+
#include "DockSplitter.h"
5859

5960
#ifdef Q_OS_LINUX
6061
#include "linux/FloatingWidgetTitleBar.h"
@@ -1093,6 +1094,34 @@ CDockWidget* CDockManager::focusedDockWidget() const
10931094
}
10941095
}
10951096

1097+
//===========================================================================
1098+
QList<int> CDockManager::splitterSizes(CDockAreaWidget *ContainedArea) const
1099+
{
1100+
if (ContainedArea)
1101+
{
1102+
auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea);
1103+
if (Splitter)
1104+
{
1105+
return Splitter->sizes();
1106+
}
1107+
}
1108+
return QList<int>();
1109+
}
1110+
1111+
//===========================================================================
1112+
void CDockManager::setSplitterSizes(CDockAreaWidget *ContainedArea, const QList<int>& sizes)
1113+
{
1114+
if (!ContainedArea)
1115+
{
1116+
return;
1117+
}
1118+
1119+
auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea);
1120+
if (Splitter && Splitter->count() == sizes.count())
1121+
{
1122+
Splitter->setSizes(sizes);
1123+
}
1124+
}
10961125

10971126
} // namespace ads
10981127

src/DockManager.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,25 @@ class ADS_EXPORT CDockManager : public CDockContainerWidget
487487
*/
488488
CDockWidget* focusedDockWidget() const;
489489

490+
/**
491+
* Returns the sizes of the splitter that contains the dock area.
492+
*
493+
* If there is no splitter that contains the area, an empty list will be
494+
* returned.
495+
*/
496+
QList<int> splitterSizes(CDockAreaWidget *ContainedArea) const;
497+
498+
/**
499+
* Update the sizes of a splitter
500+
* Programmatically updates the sizes of a given splitter by calling
501+
* QSplitter::setSizes(). The splitter will be the splitter that
502+
* contains the supplied dock area widget. If there is not splitter
503+
* that contains the dock area, or the sizes supplied does not match
504+
* the number of children of the splitter, this method will have no
505+
* effect.
506+
*/
507+
void setSplitterSizes(CDockAreaWidget *ContainedArea, const QList<int>& sizes);
508+
490509
public slots:
491510
/**
492511
* Opens the perspective with the given name.

src/stylesheets/default.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ads--CDockContainerWidget {
55
background: palette(dark);
66
}
77

8-
ads--CDockContainerWidget QSplitter::handle {
8+
ads--CDockContainerWidget ads--CDockSplitter::handle {
99
background: palette(dark);
1010
}
1111

src/stylesheets/default_linux.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ads--CDockContainerWidget {
55
background: palette(dark);
66
}
77

8-
ads--CDockContainerWidget QSplitter::handle {
8+
ads--CDockContainerWidget ads--CDockSplitter::handle {
99
background: palette(dark);
1010
}
1111

src/stylesheets/focus_highlighting_linux.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ads--CDockContainerWidget {
55
background: palette(dark);
66
}
77

8-
ads--CDockContainerWidget QSplitter::handle {
8+
ads--CDockContainerWidget ads--CDockSplitter::handle {
99
background: palette(dark);
1010
}
1111

@@ -192,3 +192,4 @@ ads--CFloatingDockContainer[isActiveWindow="true"] #floatingTitleMaximizeButton:
192192
background: rgba(255, 255, 255, 92);
193193
}
194194
*/
195+

0 commit comments

Comments
 (0)