Compare commits

..

35 Commits

Author SHA1 Message Date
Uwe Kindler
ec018a4c70 Added documentation for new "ShowTabTextOnlyForActiveTab" config flag 2023-12-04 09:24:59 +01:00
Uwe Kindler
0fabebb0fe Merge branch 'master' of https://github.com/nitramr/Qt-Advanced-Docking-System into nitramr-master 2023-12-04 09:10:34 +01:00
Uwe Kindler
521e1fbe39 Updated default AutoHide config to use Minimize button 2023-12-04 09:10:02 +01:00
Uwe Kindler
5f2aeaef00 Updated gitignore 2023-12-04 09:09:37 +01:00
nitramr
818e568f4a new configuration of icon only tabs 2023-12-02 14:48:43 +01:00
tmartsum
5d6831d179 Fix DockWidget crach when area is a nullptr. (#582)
When requesting hide on a dockwidget that has been added
to a dockmanager, but isn't yet visible, there was a creash.
The crash has been fixed by moving the code to the existing
guard check for the area.

Co-authored-by: Thorbjørn Lund Martsum <thorbjorn@luxion.com>
2023-12-01 15:13:45 +01:00
Uwe Kindler
a2c94c16b5 Fixed bug in focus_highlighting.css stylesheet 2023-11-27 22:04:45 +01:00
Uwe Kindler
68f1084bf0 Added parentSplitter() fucntion to DockArea and removed dead code from DockContainerWidget 2023-11-27 21:48:14 +01:00
Uwe Kindler
761bfc50d6 Fixed #581 - FocusHighlighting is broken after detaching a dock widget 2023-11-24 13:54:19 +01:00
Uwe Kindler
59b4dfb89c Updated documentation 2023-11-07 12:23:01 +01:00
Uwe Kindler
bfa5124999 Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System 2023-11-06 12:18:40 +01:00
Uwe Kindler
234cf9ac58 Improved disabled pin button 2023-11-06 12:17:39 +01:00
Uwe Kindler
8f77f4b42a Added documentation for new Auto Hide Minimize button 2023-11-06 12:08:31 +01:00
Uwe Kindler
fa94da00d4 Added optional Minimize button to AutoHide dock widget title bar 2023-11-06 11:06:12 +01:00
gafusss
40beef964b Fix memory leak in CDockContainerWidget::restoreState (#576)
delete old root splitter layout item
2023-11-04 06:49:01 +01:00
Uwe Kindler
420baeedfe Added support for global dock manager toolbar style and custom dock widget toolbar style for dock widgets 2023-10-19 10:25:23 +02:00
Uwe Kindler
0f8096e314 Added minimize and close action to Auto Hide context menu 2023-10-19 09:10:26 +02:00
uggas
9ec97a8867 Add ability to set user defined toggle view action (#562)
Co-authored-by: Harbinder Saggu <harbinder.saggu@safe.com>
2023-10-19 08:07:55 +02:00
Nate Skulic
55ef6ef863 Improve Python Support (#567)
- Reduce requirements for the python build.
- Fix version number.
- Generate type hints for *.pyi files.
- Make functional for sip-build
- Reduced the unnecessary depth of the package.

NOTE: This is a breaking change for python users, where, `from PyQtAds import QtAds` is changed to `import PyQtAds as QtAds`( or simply `import PyQtAds`)
2023-10-05 07:23:54 +02:00
Henning
c0985f6497 Fix empty floating widget on linux (#563) 2023-09-22 20:03:02 +02:00
Uwe Kindler
2f1ef61f82 Fixed documentation issue - wrong location of picture 2023-09-19 08:53:04 +02:00
Uwe Kindler
62d2dd213d Implemented #554 - Add a configuration that avoid tab label eliding 2023-09-19 08:44:31 +02:00
vhutter
3c941a2312 Enabled modifying MSVC runtime in cmake (#559) 2023-09-11 14:57:09 +02:00
603185423
4634b5617c CMake Script - Add debug postfix "d" (#406) (#558)
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/406
2023-09-11 12:56:32 +02:00
André Meyer
2178b52621 Delete implicit ScrollArea when content Widget is deleted in hideDockWidget() (#551) 2023-08-24 11:20:32 +02:00
Ahmad Syarifuddin
61573cba16 Fix crash in auto hide tab (#552)
- Crash is caused by dragging an autohide tab out when it is an icon only.
- The crash can actually happen with non icon only tabs, but is masked by the orientation check.
- Soln: Check if auto hide container exists first on mouse finish dragging event.
2023-08-24 11:15:43 +02:00
Joel Bodenmann
2d2de53dcd Fix CMake scripts for FreeBSD (#550)
This fixes linking of the XCB library on FreeBSD.
2023-08-17 17:57:16 +02:00
luzpaz
0d10c6e2d9 Fix various typos (#547)
Typos found via `codespell -q 3 -L te,ridiculus,varius`
2023-08-08 19:46:12 +02:00
Uwe Kindler
767933d0cb Merge branch 'master' of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System 2023-08-03 15:58:07 +02:00
Uwe Kindler
7a362b7ee3 Fixed issue #544 - crash in CDockAreaTabBar::currentTab() 2023-08-03 15:57:57 +02:00
Nicolas Elie
77ed9b0661 Update PyQt bindings to 4.1.1 (#542) 2023-08-02 20:23:49 +02:00
Uwe Kindler
65600a4dcd Removed unimolemented superfluous function definitions 2023-07-14 08:07:37 +02:00
Uwe Kindler
ac1879d5cb Added missing README images 2023-07-13 13:59:48 +02:00
Uwe Kindler
f00ef60fb3 Merge remote-tracking branch 'remotes/origin/autohide_drag' 2023-07-13 13:58:08 +02:00
Nicolas Elie
6e642ec423 Update PyQt bindings to 4.0.4 (#532) 2023-07-03 14:09:48 +02:00
77 changed files with 629 additions and 158 deletions

5
.gitignore vendored
View File

@@ -1,4 +1,4 @@
*.pro.user
*.pro.user*
/build
*.o
*.dylib
@@ -7,6 +7,9 @@ qrc_*
moc_*
ui_*
Makefile
*.dll
*.a
build-*
# IDEs
.idea

View File

@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.5)
if (POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif (POLICY CMP0091)
# By default, the version information is extracted from the git index. However,
# we can override this behavior by explicitly setting ADS_VERSION and
# skipping the git checks. This is useful for cases where this project is being

View File

@@ -271,6 +271,10 @@ struct MainWindowPrivate
auto ToolBar = DockWidget->createDefaultToolBar();
ToolBar->addAction(ui.actionSaveState);
ToolBar->addAction(ui.actionRestoreState);
// For testing all calendar dock widgets have a the tool button style
// Qt::ToolButtonTextUnderIcon
DockWidget->setToolBarStyleSource(ads::CDockWidget::ToolBarStyleFromDockWidget);
DockWidget->setToolBarStyle(Qt::ToolButtonTextUnderIcon, ads::CDockWidget::StateFloating);
return DockWidget;
}
@@ -527,6 +531,7 @@ void MainWindowPrivate::createContent()
// Tests CustomCloseHandling without DeleteOnClose
LabelDockWidget->setFeature(ads::CDockWidget::CustomCloseHandling, true);
LabelDockWidget->setWindowTitle(LabelDockWidget->windowTitle() + " [Custom Close]");
QObject::connect(LabelDockWidget, &ads::CDockWidget::closeRequested, [LabelDockWidget, this]()
{
int Result = QMessageBox::question(_this, "Custom Close Request",
@@ -763,6 +768,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
// Now create the dock manager and its content
d->DockManager = new CDockManager(this);
d->DockManager->setDockWidgetToolBarStyle(Qt::ToolButtonIconOnly, ads::CDockWidget::StateFloating);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
connect(d->PerspectiveComboBox, SIGNAL(activated(QString)),

View File

@@ -2,7 +2,7 @@ import os
import sys
from PyQt5 import uic
from PyQtAds import QtAds
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'StatusDialog.ui')
StatusDialogUI, StatusDialogBase = uic.loadUiType(UI_FILE)

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

BIN
doc/AutoHide_Sort_Tabs.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

View File

@@ -65,7 +65,7 @@ If this flag is cleared, the widget resizing is deferred until the mouse button
### Opaque and non-opaque undocking
By default, opaque undocking is active. That means, as soon as you drag a dock widget or a dock area with a number of dock widgets it will be undocked and moved into a floating widget and then the floating widget will be dragged around. That means undocking will take place immediatelly. You can compare this with opaque splitter resizing. If the flag `OpaqueUndocking` is cleared, then non-opaque undocking is active. In this mode, undocking is more like a standard drag and drop operation. That means, the dragged dock widget or dock area is not undocked immediatelly. Instead, a drag preview widget is created and dragged around to indicate the future position of the dock widget or dock area. The actual dock operation is only executed when the mouse button is released. That makes it possible, to cancel an active drag operation with the escape key.
By default, opaque undocking is active. That means, as soon as you drag a dock widget or a dock area with a number of dock widgets it will be undocked and moved into a floating widget and then the floating widget will be dragged around. That means undocking will take place immediately. You can compare this with opaque splitter resizing. If the flag `OpaqueUndocking` is cleared, then non-opaque undocking is active. In this mode, undocking is more like a standard drag and drop operation. That means, the dragged dock widget or dock area is not undocked immediately. Instead, a drag preview widget is created and dragged around to indicate the future position of the dock widget or dock area. The actual dock operation is only executed when the mouse button is released. That makes it possible, to cancel an active drag operation with the escape key.
The drag preview widget can be configured by a number of global dock manager flags:

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -27,10 +27,17 @@
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
- [`DisableTabTextEliding`](#disabletabtexteliding)
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
- [Pinning Auto-Hide Widgets to a certain border](#pinning-auto-hide-widgets-to-a-certain-border)
- [Show / Hide Auto-Hide Widgets via Mouse Over](#show--hide-auto-hide-widgets-via-mouse-over)
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
- [Auto-Hide Tab Insertion Order](#auto-hide-tab-insertion-order)
- [Auto-Hide Tab Sorting](#auto-hide-tab-sorting)
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
- [Auto-Hide Context Menu](#auto-hide-context-menu)
- [Adding Auto Hide Widgets](#adding-auto-hide-widgets)
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
@@ -40,6 +47,8 @@
- [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly)
- [`AutoHideShowOnMouseOver`](#autohideshowonmouseover)
- [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock)
- [`AutoHideHasCloseButton`](#autohidehasclosebutton)
- [`AutoHideHasMinimizeButton`](#autohidehasminimizebutton)
- [DockWidget Feature Flags](#dockwidget-feature-flags)
- [`DockWidgetClosable`](#dockwidgetclosable)
- [`DockWidgetMovable`](#dockwidgetmovable)
@@ -467,6 +476,24 @@ possible in various web browsers.
![MiddleMouseButtonClosesTab true](cfg_flag_MiddleMouseButtonClosesTab.gif)
### `DisableTabTextEliding`
Set this flag to disable eliding of tab texts in dock area tabs:
![DisableTabTextEliding true](cfg_flag_DisableTabTextEliding_true.png)
The flag is disabled by default and the text in all tabs is elided to show as
many tabs as possible even if there is not much space:
![DisableTabTextEliding false](cfg_flag_DisableTabTextEliding_false.png)
### `ShowTabTextOnlyForActiveTab`
Set this flag (default = false) to show label texts in dock area tabs only
for active tabs. Inactive tabs only show their icon:
![MShowTabTextOnlyForActiveTab true](cfg_flag_ShowTabTextOnlyForActiveTab_true.png)
## Auto-Hide Configuration Flags
### Auto Hide Dock Widgets
@@ -481,7 +508,7 @@ Enabling this feature adds a button with a pin icon to each dock area.
![DockAreaHasAutoHideButton true](cfg_flag_DockAreaHasAutoHideButton.png)
By clicking this button, the current dock widget (or the complete area - depending on the
configuration flags) will be pinned to a certain border. The border is choosen
configuration flags) will be pinned to a certain border. The border is chosen
depending on the location of the dock area. If you click the pin button while
holding down the **Ctrl** key, the whole dock area will be pinned to a certain
border.
@@ -503,6 +530,59 @@ the Auto-Hide widget is shown, if the user hovers over the Auto-Hide tab and is
collapsed if the mouse cursor leaves the Auto-Hide widget. Showing and hiding
by mouse click still works if this feature is enabled.
### Drag & Drop to Auto-Hide
You can easily drag any dock widget or any floating widget to the
borders of a window to pin it as a auto-hide tab in one of the 4 sidebars.
If you drag a dock widget close the one of the four window borders, special
drop overlays will be shown to indicate the drop area for auto-hide widgets:
![Auo-Hide drag to Sidebar](AutoHide_Drag_to_Sidebar.gif)
Of course, this also works with dock areas:
![Auo-Hide drag Dock Area](AutoHide_Drag_DockArea.gif)
If you drag a dock widget or dock area into a sidebar, then you even have
control over where tabs are inserted. Simply drag your mouse over a specific
auto-hide tab, and your dragged dock widget will be inserted before this tab.
Drag to the sidebar area behind the last tab, and the dragged widget will be
appended as last tab. In the following screen capture, the **Image Viewer 1** will
be inserted before the **Table 0** Auto-Hide tab and the **Image Viewer 2**
is appended behind the last tab:
![Auo-Hide tab insert order](AutoHide_Tab_Insert_Order.gif)
### Auto-Hide Tab Insertion Order
It is also possible to drag Auto-Hide tabs to a new auto-hide position.
That means, you can drag them to a different border or sidebar:
![Auto-Hide change sidebar](AutoHide_Change_Sidebar.gif)
### Auto-Hide Tab Sorting
You can drag Auto-Hide tabs to a new position in the current sidebar
to sort them:
![Auo-Hide sort tabs](AutoHide_Sort_Tabs.gif)
### Auto-Hide Drag to Float / Dock
But that is not all. You can also simply move Auto-Hide tabs to another
floating widget or dock them via drag and drop:
![Auo-Hide drag to float or dock](AutoHide_Drag_to_Float_or_Dock.gif)
### Auto-Hide Context Menu
All Auto-Hide tabs now have a context menu, that provides all the functionality
that you know from Dock widget tabs. With the **Pin To...** item from the
context menu it is very easy to move an Auto-Hide tab to a different Auto-Hide
sidebar:
![Auo-Hide context menu](AutoHide_Context_Menu.png)
### Adding Auto Hide Widgets
Adding an auto hide widget is similar to adding a dock widget, simply call
@@ -605,6 +685,24 @@ closing it.
![AutoHideCloseButtonCollapsesDock true](cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif)
If you enable the `AutoHideHasMinimizeButton` flag, you should disable this
flag our you will have two buttons with minimize functionality.
### `AutoHideHasCloseButton`
If this flag is set (default), then each auto hide widget has a close button:
![AutoHideHasCloseButton](cfg_flag_AutoHideHasCloseButton.png)
The functionality of the close button (close or minimize) is configured by the
`AutoHideCloseButtonCollapsesDock` flag.
### `AutoHideHasMinimizeButton`
If this flag is set (disabled by default), then each auto hide widget has a minimize button.
![AutoHideHasMinimizeButton](cfg_flag_AutoHideHasMinimizeButton.png)
## DockWidget Feature Flags
### `DockWidgetClosable`

View File

@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTre
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
from PyQtAds import QtAds
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)

View File

@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QApplication, QLabel, QCalendarWidget, QFrame, QTre
QTableWidget, QFileSystemModel, QPlainTextEdit, QToolBar,
QWidgetAction, QComboBox, QAction, QSizePolicy, QInputDialog)
from PyQtAds import QtAds
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)

View File

@@ -1,6 +1,6 @@
import sys
from PyQtAds import QtAds
import PyQtAds as QtAds
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtCore import (qDebug, pyqtSlot, QObject, pyqtSignal)
from PyQt5.QtWidgets import (QMainWindow, QAction, QTextEdit, QApplication,
@@ -70,4 +70,4 @@ if __name__ == '__main__':
action.triggered.connect(on_action2_triggered)
w.show()
app.exec_()
app.exec_()

View File

@@ -3,7 +3,7 @@ import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout, QMessageBox,
QInputDialog, QMenu, QLineEdit)
from PyQt5.QtGui import QIcon
from PyQtAds import QtAds
import PyQtAds as QtAds
from dockindockmanager import DockInDockManager
from perspectiveactions import LoadPerspectiveAction, RemovePerspectiveAction
@@ -200,4 +200,4 @@ class DockInDockWidget(QWidget):
for closed in self.getManager().dockWidgetsMap().values():
if not closed in visible_widgets:
self.dumpStatus(widget=closed, tab=tab, suffix=" (closed)")
self.dumpStatus(widget=closed, tab=tab, suffix=" (closed)")

View File

@@ -1,7 +1,7 @@
from PyQt5.QtWidgets import QAction, QMenu, QInputDialog, QLineEdit
from PyQt5.QtCore import QSettings
from PyQtAds import QtAds
import PyQtAds as QtAds
CHILD_PREFIX = "Child-"
@@ -211,4 +211,4 @@ class MoveDockWidgetAction(QAction):
widget.dockManager().removeDockWidget(widget)
move_to.addDockWidget(QtAds.CenterDockWidgetArea, widget, move_to.getInsertDefaultPos())
else:
assert False
assert False

View File

@@ -4,7 +4,7 @@ import atexit
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
from PyQt5.QtCore import Qt
from PyQtAds import QtAds
import PyQtAds as QtAds
from perspectives import PerspectivesManager
from dockindock import DockInDockWidget
@@ -69,4 +69,4 @@ if __name__ == '__main__':
w = MainWindow()
w.show()
app.exec_()
app.exec_()

View File

@@ -4,7 +4,7 @@ import shutil
import atexit
from PyQt5.QtCore import pyqtSignal, QSettings, QObject
from PyQtAds import QtAds
import PyQtAds as QtAds
from dockindockmanager import DockInDockManager
from dockindock import DockInDockWidget
@@ -200,4 +200,4 @@ class PerspectivesManager(QObject):
except FileNotFoundError:
pass
if not shutil.copy(settings.fileName(), to_save):
assert False
assert False

View File

@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QSignalBlocker
from PyQt5.QtWidgets import (QApplication, QMainWindow, QLabel, QComboBox, QTableWidget,
QAction, QWidgetAction, QSizePolicy, QInputDialog)
from PyQt5.QtGui import QCloseEvent
from PyQtAds import QtAds
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'mainwindow.ui')
@@ -105,4 +105,4 @@ if __name__ == '__main__':
w = CMainWindow()
w.show()
app.exec_()
app.exec_()

View File

@@ -5,7 +5,7 @@ from PyQt5 import uic
from PyQt5.QtCore import Qt, QMargins
from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QPlainTextEdit
from PyQtAds import QtAds
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'MainWindow.ui')
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)

View File

@@ -6,7 +6,7 @@ from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QCloseEvent
from PyQt5.QtWidgets import QApplication, QLabel
from PyQtAds import QtAds
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'MainWindow.ui')
MainWindowUI, MainWindowBase = uic.loadUiType(UI_FILE)

View File

@@ -1,12 +1,12 @@
# Specify the build system.
[build-system]
requires = ["sip >=6.0.2, <6.3", "PyQt-builder >=1.6, <2", "PyQt5==5.15.4", "PyQt5-sip<13,>=12.8"]
requires = ["sip >=6.0.2", "PyQt-builder >=1.6", "PyQt5>=5.15", "PyQt5-sip>=12.8"]
build-backend = "sipbuild.api"
# Specify the PEP 566 metadata for the project.
[tool.sip.metadata]
name = "PyQtAds"
version = "4.0.2"
version = "4.4.1"
summary = "Python bindings for Qt Advanced Docking System"
home-page = "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/"
license = "LGPL v2.1"
@@ -16,8 +16,10 @@ description-content-type = "text/markdown"
[tool.sip.project]
tag-prefix = "QtAds"
dunder-init = true
[tool.sip.bindings.ads]
pep484-pyi = true
define-macros = ["ADS_SHARED_EXPORT"]
sip-file = "ads.sip"
include-dirs = ["src"]

View File

@@ -24,9 +24,10 @@ public:
CAutoHideDockContainer(ads::CDockWidget* DockWidget /Transfer/, ads::SideBarLocation area,
ads::CDockContainerWidget* parent /TransferThis/);
virtual ~CAutoHideDockContainer();
ads::CAutoHideSideBar* sideBar() const;
ads::CAutoHideSideBar* autoHideSideBar() const;
ads::CAutoHideTab* autoHideTab() const;
ads::CDockWidget* dockWidget() const;
int tabIndex() const;
void addDockWidget(ads::CDockWidget* DockWidget /Transfer/);
ads::SideBarLocation sideBarLocation() const;
void setSideBarLocation(ads::SideBarLocation SideBarLocation);
@@ -38,7 +39,9 @@ public:
void collapseView(bool Enable);
void toggleCollapseState();
void setSize(int Size);
void resetToInitialDockWidgetSize();
Qt::Orientation orientation() const;
void moveToNewSideBarLocation(ads::SideBarLocation);
};
};

View File

@@ -24,10 +24,15 @@ public:
void removeTab(ads::CAutoHideTab* SideTab) /TransferBack/;
ads::CAutoHideDockContainer* insertDockWidget(int Index, ads::CDockWidget* DockWidget /Transfer/);
void removeAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget) /TransferBack/;
void addAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget);
void addAutoHideWidget(ads::CAutoHideDockContainer* AutoHideWidget, int Index);
Qt::Orientation orientation() const;
ads::CAutoHideTab* tabAt(int index) const;
int tabCount() const;
ads::CAutoHideTab* tab(int index) const;
int tabAt(const QPoint& Pos) const;
int tabInsertIndexAt(const QPoint& Pos) const;
int indexOfTab(const CAutoHideTab& Tab) const;
int count() const;
int visibleTabCount() const;
bool hasVisibleTabs() const;
ads::SideBarLocation sideBarLocation() const;
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;

View File

@@ -16,6 +16,10 @@ protected:
void setSideBar(ads::CAutoHideSideBar *SideTabBar);
void removeFromSideBar();
virtual bool event(QEvent* event);
virtual void contextMenuEvent(QContextMenuEvent* ev);
virtual void mousePressEvent(QMouseEvent* ev);
virtual void mouseReleaseEvent(QMouseEvent* ev);
virtual void mouseMoveEvent(QMouseEvent* ev);
public:
CAutoHideTab(QWidget* parent /TransferThis/ = 0);
@@ -29,6 +33,10 @@ public:
void setDockWidget(ads::CDockWidget* DockWidget);
bool iconOnly() const;
ads::CAutoHideSideBar* sideBar() const;
int tabIndex() const;
void setDockWidgetFloating();
void unpinDockWidget();
void requestCloseDockWidget();
};
};

View File

@@ -23,6 +23,8 @@ public:
int currentIndex() const;
ads::CDockWidgetTab* currentTab() const;
ads::CDockWidgetTab* tab(int Index) const;
int tabAt(const QPoint& Pos) const;
int tabInsertIndexAt(const QPoint& Pos) const;
virtual bool eventFilter(QObject *watched, QEvent *event);
bool isTabOpen(int Index) const;
virtual QSize minimumSizeHint() const;

View File

@@ -5,6 +5,22 @@
namespace ads
{
class CTitleBarButton : QToolButton
{
%TypeHeaderCode
#include <DockAreaTitleBar.h>
%End
public:
CTitleBarButton(bool visible = true, QWidget* parent /TransferThis/ = Q_NULLPTR );
virtual void setVisible(bool);
void setShowInTitleBar(bool);
protected:
bool event(QEvent *ev);
};
class CDockAreaTitleBar : QFrame
{
%TypeHeaderCode
@@ -26,14 +42,15 @@ public:
CDockAreaTitleBar(ads::CDockAreaWidget* parent /TransferThis/);
virtual ~CDockAreaTitleBar();
ads::CDockAreaTabBar* tabBar() const;
QAbstractButton* button(ads::TitleBarButton which) const;
ads::CTitleBarButton* button(ads::TitleBarButton which) const;
ads::CElidingLabel* autoHideTitleLabel() const;
void updateDockWidgetActionsButtons();
virtual void setVisible(bool Visible);
void insertWidget(int index, QWidget *widget /Transfer/ );
int indexOf(QWidget *widget) const;
QString titleBarButtonToolTip(ads::TitleBarButton Button) const;
void setAreaFloating();
signals:
void tabBarClicked(int index);

View File

@@ -5,21 +5,6 @@
namespace ads
{
class CTitleBarButton : QToolButton
{
%TypeHeaderCode
#include <DockAreaTitleBar_p.h>
%End
protected:
bool event(QEvent *ev);
public:
CTitleBarButton(bool visible = true, QWidget* parent /TransferThis/ = Q_NULLPTR );
virtual void setVisible(bool visible);
};
class CSpacerWidget : QWidget
{
%TypeHeaderCode

View File

@@ -40,6 +40,9 @@ public:
virtual ~CDockAreaWidget();
ads::CDockManager* dockManager() const;
ads::CDockContainerWidget* dockContainer() const;
ads::CAutoHideDockContainer* autoHideDockContainer() const;
bool isAutoHide() const;
void setAutoHideDockContainer(CAutoHideDockContainer*);
virtual QSize minimumSizeHint() const;
QRect titleBarGeometry() const;
QRect contentAreaGeometry() const;
@@ -74,7 +77,10 @@ public:
public slots:
void setCurrentIndex(int index);
void closeArea();
void setAutoHide(bool Enable, SideBarLocation Location = ads::SideBarNone, int TabIndex = -1);
void toggleAutoHide(SideBarLocation Location = ads::SideBarNone);
void closeOtherAreas();
void setFloating();
signals:
void tabBarClicked(int index);

View File

@@ -9,8 +9,8 @@ namespace ads
* Container that manages a number of dock areas with single dock widgets
* or tabyfied dock widgets in each area.
* Each window that support docking has a DockContainerWidget. That means
* the main application window and all floating windows are ore contain
* an DockContainerWidget.
* the main application window and all floating windows contain a
* DockContainerWidget.
*/
class CDockContainerWidget : QFrame
{
@@ -21,10 +21,10 @@ class CDockContainerWidget : QFrame
protected:
virtual bool event(QEvent *e);
QSplitter* rootSplitter() const;
ads::CAutoHideDockContainer* createAndSetupAutoHideContainer(ads::SideBarLocation area, ads::CDockWidget* DockWidget /Transfer/);
ads::CAutoHideDockContainer* createAndSetupAutoHideContainer(ads::SideBarLocation area, ads::CDockWidget* DockWidget /Transfer/, int TabIndex = -1);
void createRootSplitter();
void dropFloatingWidget(ads::CFloatingDockContainer* FloatingWidget, const QPoint& TargetPos);
void dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget);
void dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget, int TabIndex = -1);
void addDockArea(ads::CDockAreaWidget* DockAreaWidget /Transfer/, ads::DockWidgetArea area = ads::CenterDockWidgetArea);
void removeDockArea(ads::CDockAreaWidget* area /TransferBack/);
void saveState(QXmlStreamWriter& Stream) const;
@@ -59,7 +59,7 @@ public:
ads::CDockWidget::DockWidgetFeatures features() const;
ads::CFloatingDockContainer* floatingWidget() const;
void closeOtherAreas(ads::CDockAreaWidget* KeepOpenArea);
ads::CAutoHideSideBar* sideTabBar(SideBarLocation area) const;
ads::CAutoHideSideBar* autoHideSideBar(SideBarLocation area) const;
QList<ads::CAutoHideDockContainer*> autoHideWidgets() const;
QRect contentRect() const;
QRect contentRectGlobal() const;

View File

@@ -23,6 +23,7 @@ public:
ads::CDockWidget* focusedDockWidget() const;
void setDockWidgetTabFocused(ads::CDockWidgetTab* Tab);
void clearDockWidgetFocus(ads::CDockWidget* dockWidget);
void setDockWidgetTabPressed(bool Value);
public slots:
void setDockWidgetFocused(ads::CDockWidget* focusedNow);

View File

@@ -187,6 +187,7 @@ public:
AutoHideButtonCheckable,
AutoHideSideBarsIconOnly,
AutoHideShowOnMouseOver,
AutoHideCloseButtonCollapsesDock,
DefaultAutoHideConfig,
};
typedef QFlags<ads::CDockManager::eAutoHideFlag> AutoHideFlags;
@@ -237,6 +238,7 @@ public:
QMenu* viewMenu() const;
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
bool isRestoringState() const;
bool isLeavingMinimizedState() const;
static int startDragDistance();
ads::CDockWidget* focusedDockWidget() const;
QList<int> splitterSizes(ads::CDockAreaWidget *ContainedArea) const;
@@ -245,6 +247,7 @@ public:
static QString floatingContainersTitle();
public slots:
void endLeavingMinimizedState();
void openPerspective(const QString& PerspectiveName);
void setDockWidgetFocused(ads::CDockWidget* DockWidget);

View File

@@ -22,8 +22,10 @@ public:
CDockOverlay(QWidget* parent /TransferThis/, eMode Mode = ads::CDockOverlay::ModeDockAreaOverlay);
virtual ~CDockOverlay();
void setAllowedAreas(ads::DockWidgetAreas areas);
void setAllowedArea(ads::DockWidgetArea area, bool Enable);
ads::DockWidgetAreas allowedAreas() const;
ads::DockWidgetArea dropAreaUnderCursor() const;
int tabIndexUnderCursor() const;
ads::DockWidgetArea visibleDropAreaUnderCursor() const;
ads::DockWidgetArea showOverlay(QWidget* target);
void hideOverlay();

View File

@@ -60,7 +60,9 @@ public:
enum eMinimumSizeHintMode
{
MinimumSizeHintFromDockWidget,
MinimumSizeHintFromContent
MinimumSizeHintFromContent,
MinimumSizeHintFromDockWidgetMinimumSize,
MinimumSizeHintFromContentMinimumSize,
};
enum eToggleViewActionMode
@@ -88,12 +90,14 @@ public:
void setSideTabWidget(ads::CAutoHideTab* SideTab /Transfer/) const;
bool isAutoHide() const;
ads::CAutoHideDockContainer* autoHideDockContainer() const;
ads::SideBarLocation autoHideLocation() const;
bool isFloating() const;
bool isInFloatingContainer() const;
bool isClosed() const;
QAction* toggleViewAction() const;
void setToggleViewActionMode(ads::CDockWidget::eToggleViewActionMode Mode);
void setMinimumSizeHintMode(ads::CDockWidget::eMinimumSizeHintMode Mode);
ads::CDockWidget::eMinimumSizeHintMode minimumSizeHintMode() const;
bool isCentralWidget() const;
void setIcon(const QIcon& Icon);
QIcon icon() const;
@@ -122,9 +126,10 @@ public slots:
void setFloating();
void deleteDockWidget();
void closeDockWidget();
void requestCloseDockWidget();
void showFullScreen();
void showNormal();
void setAutoHide(bool Enable, ads::SideBarLocation Location = ads::SideBarNone);
void setAutoHide(bool Enable, ads::SideBarLocation Location = ads::SideBarNone, int TabIndex = -1);
void toggleAutoHide(ads::SideBarLocation Location = ads::SideBarNone);
signals:

View File

@@ -29,7 +29,7 @@ public: // implements IFloatingWidget
ads::eDragState DragState, QWidget* MouseEventHandler);
virtual void moveFloating();
virtual void finishDragging();
void cleanupAutoHideContainerWidget();
void cleanupAutoHideContainerWidget(ads::DockWidgetArea ContainerDropArea);
signals:
void draggingCanceled();

View File

@@ -1,4 +1,6 @@
%Module(name=PyQtAds, call_super_init=True, keyword_arguments="Optional", use_limited_api=True)
%HideNamespace(name=ads)
%Import QtCore/QtCoremod.sip
%DefaultSupertype sip.simplewrapper

View File

@@ -50,13 +50,24 @@ namespace ads
TopDockWidgetArea,
BottomDockWidgetArea,
CenterDockWidgetArea,
LeftAutoHideArea,
RightAutoHideArea,
TopAutoHideArea,
BottomAutoHideArea,
InvalidDockWidgetArea,
OuterDockAreas,
AutoHideDockAreas,
AllDockAreas
};
typedef QFlags<ads::DockWidgetArea> DockWidgetAreas;
enum eTabIndex
{
TabDefaultInsertIndex,
TabInvalidIndex
};
enum TitleBarButton
{
TitleBarButtonTabsMenu,
@@ -115,6 +126,9 @@ namespace ads
int insertOffset() const;
};
ads::internal::CDockInsertParam dockAreaInsertParameters(ads::DockWidgetArea Area);
ads::SideBarLocation toSideBarLocation(ads::DockWidgetArea Area);
bool isHorizontalSideBarLocation(ads::SideBarLocation Location);
bool isSideBarArea(ads::DockWidgetArea Area);
SIP_PYOBJECT findParent(SIP_PYTYPE type, const QWidget *w) const /TypeHint="QObject"/;
%MethodCode

View File

@@ -355,7 +355,7 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
d->DockArea->addDockWidget(DockWidget);
updateSize();
// The dock area is not visible and will not update the size when updateSize()
// is called for this auto hide container. Therefore we explicitely resize
// is called for this auto hide container. Therefore we explicitly resize
// it here. As soon as it will become visible, it will get the right size
d->DockArea->resize(size());
}
@@ -693,8 +693,8 @@ void CAutoHideDockContainer::moveToNewSideBarLocation(SideBarLocation NewSideBar
auto SideBar = dockContainer()->autoHideSideBar(NewSideBarLocation);
SideBar->addAutoHideWidget(this, TabIndex);
// If we move a horizontal auto hide container to a vertical position
// then we resize it to the orginal dock widget size, to avoid
// an extremely streched dock widget after insertion
// then we resize it to the original dock widget size, to avoid
// an extremely stretched dock widget after insertion
if (SideBar->orientation() != OldOrientation)
{
resetToInitialDockWidgetSize();

View File

@@ -91,7 +91,7 @@ public:
virtual ~CAutoHideDockContainer();
/**
* Get's the side tab bar
* Gets the side tab bar
*/
CAutoHideSideBar* autoHideSideBar() const;
@@ -101,7 +101,7 @@ public:
CAutoHideTab* autoHideTab() const;
/**
* Get's the dock widget in this dock container
* Gets the dock widget in this dock container
*/
CDockWidget* dockWidget() const;
@@ -167,13 +167,13 @@ public:
/**
* Use this instead of resize.
* Depending on the sidebar location this will set the width or heigth
* Depending on the sidebar location this will set the width or height
* of this auto hide container.
*/
void setSize(int Size);
/**
* Resets the with or hight to the initial dock widget size dependinng on
* Resets the width or height to the initial dock widget size dependinng on
* the orientation.
* If the orientation is Qt::Horizontal, then the height is reset to
* the initial size and if orientation is Qt::Vertical, then the width is

View File

@@ -173,7 +173,7 @@ public:
/**
* Overrides the minimumSizeHint() function of QScrollArea
* The minimumSizeHint() is bigger than the sizeHint () for the scroll
* area because even if the scrollbars are invisible, the required speace
* area because even if the scrollbars are invisible, the required space
* is reserved in the minimumSizeHint(). This override simply returns
* sizeHint();
*/

View File

@@ -478,7 +478,7 @@ void CAutoHideTab::mouseReleaseEvent(QMouseEvent* ev)
case DraggingFloatingWidget:
ev->accept();
d->FloatingWidget->finishDragging();
if (d->DockWidget->isAutoHide() && d->DragStartOrientation != orientation())
if (d->DockWidget->autoHideDockContainer() && d->DragStartOrientation != orientation())
{
d->DockWidget->autoHideDockContainer()->resetToInitialDockWidgetSize();
}

View File

@@ -85,7 +85,12 @@ target_link_libraries(${library_name} PUBLIC Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets)
if (UNIX AND NOT APPLE)
target_link_libraries(${library_name} PUBLIC xcb)
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
find_package(X11 REQUIRED)
target_link_libraries(${library_name} PUBLIC X11::xcb)
else()
target_link_libraries(${library_name} PUBLIC xcb)
endif()
endif()
set_target_properties(${library_name} PROPERTIES
AUTOMOC ON
@@ -93,6 +98,7 @@ set_target_properties(${library_name} PROPERTIES
CXX_EXTENSIONS OFF
VERSION ${VERSION_SHORT}
EXPORT_NAME ${library_name}
DEBUG_POSTFIX "d"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"

View File

@@ -300,7 +300,7 @@ int CDockAreaTabBar::currentIndex() const
//===========================================================================
CDockWidgetTab* CDockAreaTabBar::currentTab() const
{
if (d->CurrentIndex < 0)
if (d->CurrentIndex < 0 || d->CurrentIndex >= d->TabsLayout->count())
{
return nullptr;
}

View File

@@ -141,7 +141,7 @@ public:
/**
* Overrides the minimumSizeHint() function of QScrollArea
* The minimumSizeHint() is bigger than the sizeHint () for the scroll
* area because even if the scrollbars are invisible, the required speace
* area because even if the scrollbars are invisible, the required space
* is reserved in the minimumSizeHint(). This override simply returns
* sizeHint();
*/

View File

@@ -72,10 +72,11 @@ struct DockAreaTitleBarPrivate
QPointer<CTitleBarButton> AutoHideButton;
QPointer<CTitleBarButton> UndockButton;
QPointer<CTitleBarButton> CloseButton;
QPointer<CTitleBarButton> MinimizeButton;
QBoxLayout* Layout;
CDockAreaWidget* DockArea;
CDockAreaTabBar* TabBar;
CElidingLabel* AutoHideTitleLabel;
CElidingLabel* AutoHideTitleLabel = nullptr;
bool MenuOutdated = true;
QMenu* TabsMenu;
QList<tTitleBarButton*> DockWidgetActionsButtons;
@@ -218,6 +219,17 @@ void DockAreaTitleBarPrivate::createButtons()
Layout->addWidget(AutoHideButton, 0);
_this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked()));
// Minimize button
MinimizeButton = new CTitleBarButton(testAutoHideConfigFlag(CDockManager::AutoHideHasMinimizeButton));
MinimizeButton->setObjectName("dockAreaMinimizeButton");
MinimizeButton->setAutoRaise(true);
MinimizeButton->setVisible(false);
internal::setButtonIcon(MinimizeButton, QStyle::SP_TitleBarMinButton, ads::DockAreaMinimizeIcon);
internal::setToolTip(MinimizeButton, QObject::tr("Minimize"));
MinimizeButton->setSizePolicy(ButtonSizePolicy);
Layout->addWidget(MinimizeButton, 0);
_this->connect(MinimizeButton, SIGNAL(clicked()), SLOT(minimizeAutoHideContainer()));
// Close button
CloseButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasCloseButton));
CloseButton->setObjectName("dockAreaCloseButton");
@@ -236,7 +248,10 @@ void DockAreaTitleBarPrivate::createAutoHideTitleLabel()
{
AutoHideTitleLabel = new CElidingLabel("");
AutoHideTitleLabel->setObjectName("autoHideTitleLabel");
Layout->addWidget(AutoHideTitleLabel);
// At position 0 is the tab bar - insert behind tab bar
Layout->insertWidget(1, AutoHideTitleLabel);
AutoHideTitleLabel->setVisible(false); // Default hidden
Layout->insertWidget(2 ,new CSpacerWidget(_this));
}
@@ -324,10 +339,8 @@ CDockAreaTitleBar::CDockAreaTitleBar(CDockAreaWidget* parent) :
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
d->createTabBar();
d->createAutoHideTitleLabel();
d->AutoHideTitleLabel->setVisible(false); // Default hidden
d->Layout->addWidget(new CSpacerWidget(this));
d->createButtons();
d->createAutoHideTitleLabel();
setFocusPolicy(Qt::NoFocus);
}
@@ -431,6 +444,24 @@ void CDockAreaTitleBar::onCloseButtonClicked()
}
//============================================================================
void CDockAreaTitleBar::onAutoHideCloseActionTriggered()
{
d->DockArea->closeArea();
}
//============================================================================
void CDockAreaTitleBar::minimizeAutoHideContainer()
{
auto AutoHideContainer = d->DockArea->autoHideDockContainer();
if (AutoHideContainer)
{
AutoHideContainer->collapseView(true);
}
}
//============================================================================
void CDockAreaTitleBar::onUndockButtonClicked()
{
@@ -547,6 +578,7 @@ CTitleBarButton* CDockAreaTitleBar::button(TitleBarButton which) const
case TitleBarButtonUndock: return d->UndockButton;
case TitleBarButtonClose: return d->CloseButton;
case TitleBarButtonAutoHide: return d->AutoHideButton;
case TitleBarButtonMinimize: return d->MinimizeButton;
default:
return nullptr;
}
@@ -735,7 +767,17 @@ void CDockAreaTitleBar::contextMenuEvent(QContextMenuEvent* ev)
}
Menu.addSeparator();
}
Action = Menu.addAction(isAutoHide ? tr("Close") : tr("Close Group"), this, SLOT(onCloseButtonClicked()));
if (isAutoHide)
{
Action = Menu.addAction(tr("Minimize"), this, SLOT(minimizeAutoHideContainer()));
Action = Menu.addAction(tr("Close"), this, SLOT(onAutoHideCloseActionTriggered()));
}
else
{
Action = Menu.addAction(isAutoHide ? tr("Close") : tr("Close Group"), this, SLOT(onCloseButtonClicked()));
}
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetClosable));
if (!isAutoHide && !isTopLevelArea)
{
@@ -782,7 +824,8 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
case TitleBarButtonClose:
if (d->DockArea->isAutoHide())
{
return tr("Close");
bool Minimize = CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock);
return Minimize ? tr("Minimize") : tr("Close");
}
if (CDockManager::testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
@@ -802,6 +845,16 @@ QString CDockAreaTitleBar::titleBarButtonToolTip(TitleBarButton Button) const
return QString();
}
//============================================================================
void CDockAreaTitleBar::showAutoHideControls(bool Show)
{
d->TabBar->setVisible(!Show); // Auto hide toolbar never has tabs
d->MinimizeButton->setVisible(Show);
d->AutoHideTitleLabel->setVisible(Show);
}
//============================================================================
CTitleBarButton::CTitleBarButton(bool showInTitleBar, QWidget* parent)
: tTitleBarButton(parent),
@@ -814,7 +867,7 @@ CTitleBarButton::CTitleBarButton(bool showInTitleBar, QWidget* parent)
//============================================================================
void CTitleBarButton::setVisible(bool visible)
{
// 'visible' can stay 'true' if and only if this button is configured to generaly visible:
// 'visible' can stay 'true' if and only if this button is configured to generally visible:
visible = visible && this->ShowInTitleBar;
// 'visible' can stay 'true' unless: this button is configured to be invisible when it is disabled and it is currently disabled:
@@ -858,6 +911,7 @@ CSpacerWidget::CSpacerWidget(QWidget* Parent /*= 0*/) : Super(Parent)
setStyleSheet("border: none; background: none;");
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@@ -97,6 +97,8 @@ private:
private Q_SLOTS:
void onTabsMenuAboutToShow();
void onCloseButtonClicked();
void onAutoHideCloseActionTriggered();
void minimizeAutoHideContainer();
void onUndockButtonClicked();
void onTabsMenuActionTriggered(QAction* Action);
void onCurrentTabChanged(int Index);
@@ -208,6 +210,11 @@ public:
*/
void setAreaFloating();
/**
* Call this function, to create all the required auto hide controls
*/
void showAutoHideControls(bool Show);
Q_SIGNALS:
/**
* This signal is emitted if a tab in the tab bar is clicked by the user

View File

@@ -317,12 +317,12 @@ struct DockAreaWidgetPrivate
}
/**
* Udpates the enable state of the close and detach button
* Updates the enable state of the close and detach button
*/
void updateTitleBarButtonStates();
/**
* Udpates the enable state of the close and detach button
* Updates the enable state of the close and detach button
*/
void updateTitleBarButtonVisibility(bool isTopLevel);
@@ -390,20 +390,29 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel)
return;
}
if (IsTopLevel)
bool IsAutoHide = _this->isAutoHide();
if (IsAutoHide)
{
bool ShowCloseButton = CDockManager::autoHideConfigFlags().testFlag(CDockManager::AutoHideHasCloseButton);
TitleBar->button(TitleBarButtonClose)->setVisible(ShowCloseButton);
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
TitleBar->button(TitleBarButtonUndock)->setVisible(false);
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(false);
}
else if (IsTopLevel)
{
TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating());
TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating());
// Undock and tabs should never show when auto hidden
TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating() && !_this->isAutoHide());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(true);
}
else
{
TitleBar->button(TitleBarButtonClose)->setVisible(true);
TitleBar->button(TitleBarButtonAutoHide)->setVisible(true);
TitleBar->button(TitleBarButtonUndock)->setVisible(!_this->isAutoHide());
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide());
TitleBar->button(TitleBarButtonUndock)->setVisible(true);
TitleBar->button(TitleBarButtonTabsMenu)->setVisible(true);
}
}
@@ -455,6 +464,13 @@ CAutoHideDockContainer* CDockAreaWidget::autoHideDockContainer() const
return d->AutoHideDockContainer;
}
//============================================================================
CDockSplitter* CDockAreaWidget::parentSplitter() const
{
return internal::findParent<CDockSplitter*>(this);
}
//============================================================================
bool CDockAreaWidget::isAutoHide() const
{
@@ -591,7 +607,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
this->toggleView(false);
// Hide empty parent splitters
auto Splitter = internal::findParent<CDockSplitter*>(this);
auto Splitter = parentSplitter();
internal::hideEmptyParentSplitters(Splitter);
//Hide empty floating widget
@@ -847,9 +863,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
if (isAutoHideFeatureEnabled())
{
auto tabBar = d->TitleBar->tabBar();
tabBar->setVisible(!IsAutoHide); // Never show tab bar when auto hidden
d->TitleBar->autoHideTitleLabel()->setVisible(IsAutoHide); // Always show when auto hidden, never otherwise
d->TitleBar->showAutoHideControls(IsAutoHide);
updateTitleBarButtonVisibility(Container->topLevelDockArea() == this);
}
}
@@ -1283,17 +1297,17 @@ SideBarLocation CDockAreaWidget::calculateSideTabBarArea() const
case BorderHorizontalLeft: SideTab = SideBarLocation::SideBarLeft; break;
case BorderHorizontalRight: SideTab = SideBarLocation::SideBarRight; break;
// 3. Its touching horizontal or vertical borders
// 3. It's touching horizontal or vertical borders
case BorderVertical : SideTab = SideBarLocation::SideBarBottom; break;
case BorderHorizontal: SideTab = SideBarLocation::SideBarRight; break;
// 4. Its in a corner
// 4. It's in a corner
case BorderTopLeft : SideTab = HorizontalOrientation ? SideBarLocation::SideBarTop : SideBarLocation::SideBarLeft; break;
case BorderTopRight : SideTab = HorizontalOrientation ? SideBarLocation::SideBarTop : SideBarLocation::SideBarRight; break;
case BorderBottomLeft : SideTab = HorizontalOrientation ? SideBarLocation::SideBarBottom : SideBarLocation::SideBarLeft; break;
case BorderBottomRight : SideTab = HorizontalOrientation ? SideBarLocation::SideBarBottom : SideBarLocation::SideBarRight; break;
// 5 Ists touching only one border
// 5. It's touching only one border
case BorderLeft: SideTab = SideBarLocation::SideBarLeft; break;
case BorderRight: SideTab = SideBarLocation::SideBarRight; break;
case BorderTop: SideTab = SideBarLocation::SideBarTop; break;

View File

@@ -47,6 +47,7 @@ class CDockContainerWidget;
class DockContainerWidgetPrivate;
class CDockAreaTitleBar;
class CDockingStateReader;
class CDockSplitter;
/**
@@ -216,6 +217,11 @@ public:
*/
CAutoHideDockContainer* autoHideDockContainer() const;
/**
* Returns the parent splitter that contains this dock area
*/
CDockSplitter* parentSplitter() const;
/**
* Returns true if the dock area is in an auto hide container
*/

View File

@@ -250,7 +250,7 @@ public:
* \param[out] CreatedWidget The widget created from parsed data or 0 if
* the parsed widget was an empty splitter
* \param[in] Testing If Testing is true, only the stream data is
* parsed without modifiying anything.
* parsed without modifying anything.
*/
bool restoreChildNodes(CDockingStateReader& Stream, QWidget*& CreatedWidget,
bool Testing);
@@ -587,16 +587,7 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
auto InsertParam = internal::dockAreaInsertParameters(area);
auto NewDockAreas = FloatingContainer->findChildren<CDockAreaWidget*>(
QString(), Qt::FindChildrenRecursively);
QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetArea);
if (!TargetAreaSplitter)
{
QSplitter* Splitter = newSplitter(InsertParam.orientation());
Layout->replaceWidget(TargetArea, Splitter);
Splitter->addWidget(TargetArea);
updateSplitterHandles(Splitter);
TargetAreaSplitter = Splitter;
}
auto TargetAreaSplitter = TargetArea->parentSplitter();
int AreaIndex = TargetAreaSplitter->indexOf(TargetArea);
auto FloatingSplitter = FloatingContainer->rootSplitter();
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
@@ -742,7 +733,7 @@ void DockContainerWidgetPrivate::moveToNewSection(QWidget* Widget, CDockAreaWidg
}
auto InsertParam = internal::dockAreaInsertParameters(area);
QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetArea);
auto TargetAreaSplitter = TargetArea->parentSplitter();
int AreaIndex = TargetAreaSplitter->indexOf(TargetArea);
auto Sizes = TargetAreaSplitter->sizes();
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
@@ -877,7 +868,7 @@ void DockContainerWidgetPrivate::moveToContainer(QWidget* Widget, DockWidgetArea
// it already has and do nothing, if it is the same place. It would
// also work without this check, but it looks nicer with the check
// because there will be no layout updates
auto Splitter = internal::findParent<CDockSplitter*>(DroppedDockArea);
auto Splitter = DroppedDockArea->parentSplitter();
auto InsertParam = internal::dockAreaInsertParameters(area);
if (Splitter == RootSplitter && InsertParam.orientation() == Splitter->orientation())
{
@@ -1364,7 +1355,7 @@ CDockAreaWidget* DockContainerWidgetPrivate::addDockWidgetToDockArea(DockWidgetA
NewDockArea->addDockWidget(Dockwidget);
auto InsertParam = internal::dockAreaInsertParameters(area);
QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetDockArea);
auto TargetAreaSplitter = TargetDockArea->parentSplitter();
int index = TargetAreaSplitter ->indexOf(TargetDockArea);
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
{
@@ -1381,7 +1372,7 @@ CDockAreaWidget* DockContainerWidgetPrivate::addDockWidgetToDockArea(DockWidgetA
{
ADS_PRINT("TargetAreaSplitter->orientation() != InsertParam.orientation()");
auto TargetAreaSizes = TargetAreaSplitter->sizes();
QSplitter* NewSplitter = newSplitter(InsertParam.orientation());
auto NewSplitter = newSplitter(InsertParam.orientation());
NewSplitter->addWidget(TargetDockArea);
insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append());
@@ -1572,7 +1563,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
area->disconnect(this);
d->DockAreas.removeAll(area);
CDockSplitter* Splitter = internal::findParent<CDockSplitter*>(area);
auto Splitter = area->parentSplitter();
// Remove are from parent splitter and recursively hide tree of parent
// splitters if it has no visible content
@@ -1932,17 +1923,18 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
NewRootSplitter = d->newSplitter(Qt::Horizontal);
}
d->Layout->replaceWidget(d->RootSplitter, NewRootSplitter);
QLayoutItem* li = d->Layout->replaceWidget(d->RootSplitter, NewRootSplitter);
auto OldRoot = d->RootSplitter;
d->RootSplitter = qobject_cast<CDockSplitter*>(NewRootSplitter);
OldRoot->deleteLater();
delete li;
return true;
}
//============================================================================
QSplitter* CDockContainerWidget::rootSplitter() const
CDockSplitter* CDockContainerWidget::rootSplitter() const
{
return d->RootSplitter;
}

View File

@@ -53,6 +53,7 @@ struct FloatingDragPreviewPrivate;
class CDockingStateReader;
class CAutoHideSideBar;
class CAutoHideTab;
class CDockSplitter;
struct AutoHideTabPrivate;
struct AutoHideDockContainerPrivate;
@@ -94,7 +95,7 @@ protected:
/**
* Access function for the internal root splitter
*/
QSplitter* rootSplitter() const;
CDockSplitter* rootSplitter() const;
/**
* Creates and initializes a dockwidget auto hide container into the given area.
@@ -103,13 +104,6 @@ protected:
*/
CAutoHideDockContainer* createAndSetupAutoHideContainer(SideBarLocation area, CDockWidget* DockWidget, int TabIndex = -1);
/**
* The funtion does the same like createAndSetupAutoHideContainer() but checks
* if the given DockWidget is pinnable. If it is not pinnable, the
* function returns a nullptr.
*/
CAutoHideDockContainer* createAutoHideContainerIfPinnable(SideBarLocation area, CDockWidget* DockWidget);
/**
* Helper function for creation of the root splitter
*/

View File

@@ -269,7 +269,7 @@ void CDockFocusController::onApplicationFocusChanged(QWidget* focusedOld, QWidge
Q_UNUSED(focusedOld);
// Ignore focus changes if we are restoring state, or if user clicked
// a tab wich in turn caused the focus change
// a tab which in turn caused the focus change
if (d->DockManager->isRestoringState() || d->TabPressed)
{
return;

View File

@@ -118,6 +118,10 @@ struct DockManagerPrivate
CDockFocusController* FocusController = nullptr;
CDockWidget* CentralWidget = nullptr;
bool IsLeavingMinimized = false;
Qt::ToolButtonStyle ToolBarStyleDocked = Qt::ToolButtonIconOnly;
Qt::ToolButtonStyle ToolBarStyleFloating = Qt::ToolButtonTextUnderIcon;
QSize ToolBarIconSizeDocked = QSize(16, 16);
QSize ToolBarIconSizeFloating = QSize(24, 24);
/**
* Private data constructor
@@ -1285,7 +1289,7 @@ void CDockManager::hideManagerAndFloatingWidgets()
d->HiddenFloatingWidgets.push_back( FloatingWidget );
FloatingWidget->hide();
// hidding floating widget automatically marked contained CDockWidgets as hidden
// hiding floating widget automatically marked contained CDockWidgets as hidden
// but they must remain marked as visible as we want them to be restored visible
// when CDockManager will be shown back
for ( auto dockWidget : VisibleWidgets )
@@ -1314,7 +1318,7 @@ QList<int> CDockManager::splitterSizes(CDockAreaWidget *ContainedArea) const
{
if (ContainedArea)
{
auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea);
auto Splitter = ContainedArea->parentSplitter();
if (Splitter)
{
return Splitter->sizes();
@@ -1331,7 +1335,7 @@ void CDockManager::setSplitterSizes(CDockAreaWidget *ContainedArea, const QList<
return;
}
auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea);
auto Splitter = ContainedArea->parentSplitter();
if (Splitter && Splitter->count() == sizes.count())
{
Splitter->setSizes(sizes);
@@ -1361,6 +1365,63 @@ QString CDockManager::floatingContainersTitle()
return FloatingContainersTitle;
}
//===========================================================================
void CDockManager::setDockWidgetToolBarStyle(Qt::ToolButtonStyle Style, CDockWidget::eState State)
{
if (CDockWidget::StateFloating == State)
{
d->ToolBarStyleFloating = Style;
}
else
{
d->ToolBarStyleDocked = Style;
}
}
//===========================================================================
Qt::ToolButtonStyle CDockManager::dockWidgetToolBarStyle(CDockWidget::eState State) const
{
if (CDockWidget::StateFloating == State)
{
return d->ToolBarStyleFloating;
}
else
{
return d->ToolBarStyleDocked;
}
}
//===========================================================================
void CDockManager::setDockWidgetToolBarIconSize(const QSize& IconSize, CDockWidget::eState State)
{
if (CDockWidget::StateFloating == State)
{
d->ToolBarIconSizeFloating = IconSize;
}
else
{
d->ToolBarIconSizeDocked = IconSize;
}
}
//===========================================================================
QSize CDockManager::dockWidgetToolBarIconSize(CDockWidget::eState State) const
{
if (CDockWidget::StateFloating == State)
{
return d->ToolBarIconSizeFloating;
}
else
{
return d->ToolBarIconSizeDocked;
}
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@@ -154,7 +154,7 @@ protected:
virtual void showEvent(QShowEvent *event) override;
/**
* Acces for the internal dock focus controller.
* Access for the internal dock focus controller.
* This function only returns a valid object, if the FocusHighlighting
* flag is set.
*/
@@ -213,6 +213,8 @@ public:
//!< If neither this nor FloatingContainerForceNativeTitleBar is set (the default) native titlebars are used except on known bad systems.
//! Users can overwrite this by setting the environment variable ADS_UseNativeTitle to "1" or "0".
MiddleMouseButtonClosesTab = 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse
DisableTabTextEliding = 0x4000000, //! Set this flag to disable eliding of tab texts in dock area tabs
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
DefaultDockAreaButtons = DockAreaHasCloseButton
| DockAreaHasUndockButton
@@ -250,10 +252,12 @@ public:
AutoHideSideBarsIconOnly = 0x10,///< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown
AutoHideShowOnMouseOver = 0x20, ///< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container
AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely
AutoHideHasCloseButton = 0x80, //< If the flag is set an auto hide title bar has a close button
AutoHideHasMinimizeButton = 0x100, ///< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget
DefaultAutoHideConfig = AutoHideFeatureEnabled
| DockAreaHasAutoHideButton
| AutoHideCloseButtonCollapsesDock
| AutoHideHasMinimizeButton
};
Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag)
@@ -541,7 +545,7 @@ public:
* The order defines how the actions are added to the view menu.
* The default insertion order is MenuAlphabeticallySorted to make it
* easier for users to find the menu entry for a certain dock widget.
* You need to call this function befor you insert the first menu item
* You need to call this function before you insert the first menu item
* into the view menu.
*/
void setViewMenuInsertionOrder(eViewMenuInsertionOrder Order);
@@ -626,6 +630,36 @@ public:
*/
static QString floatingContainersTitle();
/**
* This function sets the tool button style for the given dock widget state.
* It is possible to switch the tool button style depending on the state.
* If a dock widget is floating, then here are more space and it is
* possible to select a style that requires more space like
* Qt::ToolButtonTextUnderIcon. For the docked state Qt::ToolButtonIconOnly
* might be better.
*/
void setDockWidgetToolBarStyle(Qt::ToolButtonStyle Style, CDockWidget::eState State);
/**
* Returns the tool button style for the given docking state.
* \see setToolBarStyle()
*/
Qt::ToolButtonStyle dockWidgetToolBarStyle(CDockWidget::eState State) const;
/**
* This function sets the tool button icon size for the given state.
* If a dock widget is floating, there is more space and increasing the
* icon size is possible. For docked widgets, small icon sizes, eg. 16 x 16
* might be better.
*/
void setDockWidgetToolBarIconSize(const QSize& IconSize, CDockWidget::eState State);
/**
* Returns the icon size for a given docking state.
* \see setToolBarIconSize()
*/
QSize dockWidgetToolBarIconSize(CDockWidget::eState State) const;
public Q_SLOTS:
/**
* Opens the perspective with the given name.

View File

@@ -39,7 +39,7 @@ struct DockSplitterPrivate;
/**
* Splitter used internally instead of QSplitter with some additional
* fuctionality.
* functionality.
*/
class ADS_EXPORT CDockSplitter : public QSplitter
{

View File

@@ -95,6 +95,7 @@ struct DockWidgetPrivate
CDockWidget::eMinimumSizeHintMode MinimumSizeHintMode = CDockWidget::MinimumSizeHintFromDockWidget;
WidgetFactory* Factory = nullptr;
QPointer<CAutoHideTab> SideTabWidget;
CDockWidget::eToolBarStyleSource ToolBarStyleSource = CDockWidget::ToolBarStyleFromDockManager;
/**
* Private data constructor
@@ -139,6 +140,11 @@ struct DockWidgetPrivate
* returns true on success.
*/
bool createWidgetFromFactory();
/**
* Use the dock manager toolbar style and icon size for the different states
*/
void setToolBarStyleFromDockManager();
};
// struct DockWidgetPrivate
@@ -178,11 +184,11 @@ void DockWidgetPrivate::showDockWidget()
DockArea->setCurrentDockWidget(_this);
DockArea->toggleView(true);
TabWidget->show();
QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea);
auto Splitter = DockArea->parentSplitter();
while (Splitter && !Splitter->isVisible() && !DockArea->isAutoHide())
{
Splitter->show();
Splitter = internal::findParent<QSplitter*>(Splitter);
Splitter = internal::findParent<CDockSplitter*>(Splitter);
}
CDockContainerWidget* Container = DockArea->dockContainer();
@@ -213,6 +219,12 @@ void DockWidgetPrivate::hideDockWidget()
if (Features.testFlag(CDockWidget::DeleteContentOnClose))
{
if (ScrollArea)
{
ScrollArea->takeWidget();
delete ScrollArea;
ScrollArea = nullptr;
}
Widget->deleteLater();
Widget = nullptr;
}
@@ -325,6 +337,22 @@ bool DockWidgetPrivate::createWidgetFromFactory()
}
//============================================================================
void DockWidgetPrivate::setToolBarStyleFromDockManager()
{
if (!DockManager)
{
return;
}
auto State = CDockWidget::StateDocked;
_this->setToolBarIconSize(DockManager->dockWidgetToolBarIconSize(State), State);
_this->setToolBarStyle(DockManager->dockWidgetToolBarStyle(State), State);
State = CDockWidget::StateFloating;
_this->setToolBarIconSize(DockManager->dockWidgetToolBarIconSize(State), State);
_this->setToolBarStyle(DockManager->dockWidgetToolBarStyle(State), State);
}
//============================================================================
CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
QFrame(parent),
@@ -358,6 +386,20 @@ CDockWidget::~CDockWidget()
delete d;
}
//============================================================================
void CDockWidget::setToggleViewAction(QAction* action)
{
if (!action)
{
return;
}
d->ToggleViewAction->setParent(nullptr);
delete d->ToggleViewAction;
d->ToggleViewAction = action;
d->ToggleViewAction->setParent(this);
connect(d->ToggleViewAction, &QAction::triggered, this, &CDockWidget::toggleView);
}
//============================================================================
void CDockWidget::setToggleViewActionChecked(bool Checked)
@@ -503,6 +545,15 @@ CDockManager* CDockWidget::dockManager() const
void CDockWidget::setDockManager(CDockManager* DockManager)
{
d->DockManager = DockManager;
if (!DockManager)
{
return;
}
if (ToolBarStyleFromDockManager == d->ToolBarStyleSource)
{
d->setToolBarStyleFromDockManager();
}
}
@@ -698,11 +749,10 @@ void CDockWidget::toggleViewInternal(bool Open)
if (d->DockArea)
{
d->DockArea->toggleDockWidgetView(this, Open);
}
if (d->DockArea->isAutoHide())
{
d->DockArea->autoHideDockContainer()->toggleView(Open);
if (d->DockArea->isAutoHide())
{
d->DockArea->autoHideDockContainer()->toggleView(Open);
}
}
if (Open && TopLevelDockWidgetBefore)
@@ -1264,6 +1314,24 @@ void CDockWidget::toggleAutoHide(SideBarLocation Location)
}
//============================================================================
void CDockWidget::setToolBarStyleSource(eToolBarStyleSource Source)
{
d->ToolBarStyleSource = Source;
if (ToolBarStyleFromDockManager == d->ToolBarStyleSource)
{
d->setToolBarStyleFromDockManager();
}
}
//============================================================================
CDockWidget::eToolBarStyleSource CDockWidget::toolBarStyleSource() const
{
return d->ToolBarStyleSource;
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@@ -176,6 +176,12 @@ public:
StateFloating
};
enum eToolBarStyleSource
{
ToolBarStyleFromDockManager,
ToolBarStyleFromDockWidget
};
/**
* Sets the widget for the dock widget to widget.
* The InsertMode defines how the widget is inserted into the dock widget.
@@ -246,7 +252,7 @@ public:
* object name is required by the dock manager to properly save and restore
* the state of the dock widget. That means, the title needs to be unique.
* If your title is not unique or if you would like to change the title
* during runtime, you need to set a unique object name explicitely
* during runtime, you need to set a unique object name explicitly
* by calling setObjectName() after construction.
* Use the layoutFlags to configure the layout of the dock widget.
*/
@@ -409,6 +415,12 @@ public:
*/
QAction* toggleViewAction() const;
/**
* Use provided action to be the default toggle view action for this dock widget.
* This dock widget now owns the action.
*/
void setToggleViewAction(QAction* action);
/**
* Configures the behavior of the toggle view action.
* \see eToggleViewActionMode for a detailed description
@@ -445,7 +457,7 @@ public:
/**
* This function returns the dock widget top tool bar.
* If no toolbar is assigned, this function returns nullptr. To get a vaild
* If no toolbar is assigned, this function returns nullptr. To get a valid
* toolbar you either need to create a default empty toolbar via
* createDefaultToolBar() function or you need to assign your custom
* toolbar via setToolBar().
@@ -467,6 +479,17 @@ public:
*/
void setToolBar(QToolBar* ToolBar);
/**
* Configures, if the dock widget uses the global tool bar styles from
* dock manager or if it uses its own tool bar style
*/
void setToolBarStyleSource(eToolBarStyleSource Source);
/**
* Returns the configured tool bar style source
*/
eToolBarStyleSource toolBarStyleSource() const;
/**
* This function sets the tool button style for the given dock widget state.
* It is possible to switch the tool button style depending on the state.

View File

@@ -79,7 +79,6 @@ struct DockWidgetTabPrivate
QSpacerItem* IconTextSpacer;
QPoint TabDragStartPosition;
QSize IconSize;
bool MousePressed = false;
/**
* Private data constructor
@@ -246,7 +245,14 @@ DockWidgetTabPrivate::DockWidgetTabPrivate(CDockWidgetTab* _public) :
void DockWidgetTabPrivate::createLayout()
{
TitleLabel = new tTabLabel();
TitleLabel->setElideMode(Qt::ElideRight);
if (CDockManager::testConfigFlag(CDockManager::DisableTabTextEliding))
{
TitleLabel->setElideMode(Qt::ElideNone);
}
else
{
TitleLabel->setElideMode(Qt::ElideRight);
}
TitleLabel->setText(DockWidget->windowTitle());
TitleLabel->setObjectName("dockWidgetTabLabel");
TitleLabel->setAlignment(Qt::AlignCenter);
@@ -373,7 +379,6 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
if (ev->button() == Qt::LeftButton)
{
ev->accept();
d->MousePressed = true;
d->saveDragStartMousePosition(internal::globalPositionOf(ev));
d->DragState = DraggingMousePressed;
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
@@ -394,7 +399,6 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
{
if (ev->button() == Qt::LeftButton)
{
d->MousePressed = false;
auto CurrentDragState = d->DragState;
d->GlobalDragStartMousePosition = QPoint();
d->DragStartMousePosition = QPoint();
@@ -417,11 +421,12 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
break;
default:
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
d->focusController()->setDockWidgetTabPressed(false);
}
break; // do nothing
break;
}
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
d->focusController()->setDockWidgetTabPressed(false);
}
}
else if (ev->button() == Qt::MiddleButton)
@@ -502,7 +507,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
else if (d->DockArea->openDockWidgetsCount() > 1
&& (internal::globalPositionOf(ev) - d->GlobalDragStartMousePosition).manhattanLength() >= QApplication::startDragDistance()) // Wait a few pixels before start moving
{
// If we start dragging the tab, we save its inital position to
// If we start dragging the tab, we save its initial position to
// restore it later
if (DraggingTab != d->DragState)
{
@@ -576,6 +581,14 @@ void CDockWidgetTab::setActiveTab(bool active)
{
d->updateCloseButtonVisibility(active);
if(CDockManager::testConfigFlag(CDockManager::ShowTabTextOnlyForActiveTab) && !d->Icon.isNull())
{
if(active)
d->TitleLabel->setVisible(true);
else
d->TitleLabel->setVisible(false);
}
// Focus related stuff
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
{

View File

@@ -173,17 +173,11 @@ public:
/**
* Set an explicit icon size.
* If no icon size has been set explicitely, than the tab sets the icon size
* If no icon size has been set explicitly, than the tab sets the icon size
* depending on the style
*/
void setIconSize(const QSize& Size);
/**
* Returns true, if the tab has been clicked and the mouse is currently
* pressed.
*/
bool mousePressed() const;
public Q_SLOTS:
virtual void setVisible(bool visible) override;

View File

@@ -62,7 +62,7 @@ namespace ads
#ifdef Q_OS_WIN
#if 0 // set to 1 if you need this function for debugging
/**
* Just for debuging to convert windows message identifiers to strings
* Just for debugging to convert windows message identifiers to strings
*/
static const char* windowsMessageString(int MessageId)
{
@@ -662,7 +662,6 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
QDockWidget::setWidget(d->DockContainer);
QDockWidget::setFloating(true);
QDockWidget::setFeatures(QDockWidget::DockWidgetClosable
| QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);

View File

@@ -20,5 +20,8 @@
<file>images/vs-pin-button-pinned-focused.svg</file>
<file>images/vs-pin-button_45.svg</file>
<file>images/pin-button-big.svg</file>
<file>images/minimize-button.svg</file>
<file>images/minimize-button-focused.svg</file>
<file>images/vs-pin-button-disabled.svg</file>
</qresource>
</RCC>

View File

@@ -290,7 +290,7 @@ QString detectWindowManagerX11()
QString ret = xcb_get_prop_string(support_win, "_NET_WM_NAME");
if(ret.length() == 0)
{
ADS_PRINT("Empty WM name occured.");
ADS_PRINT("Empty WM name occurred.");
return "UNKNOWN";
}
return ret;

View File

@@ -107,7 +107,8 @@ enum TitleBarButton
TitleBarButtonTabsMenu,
TitleBarButtonUndock,
TitleBarButtonClose,
TitleBarButtonAutoHide
TitleBarButtonAutoHide,
TitleBarButtonMinimize
};
/**
@@ -131,6 +132,7 @@ enum eIcon
DockAreaMenuIcon, //!< DockAreaMenuIcon
DockAreaUndockIcon,//!< DockAreaUndockIcon
DockAreaCloseIcon, //!< DockAreaCloseIcon
DockAreaMinimizeIcon,
IconCount, //!< just a delimiter for range checks
};
@@ -189,7 +191,7 @@ void xcb_update_prop(bool set, WId window, const char *type, const char *prop, c
bool xcb_dump_props(WId window, const char *type);
/**
* Gets the active window manager from the X11 Server.
* Requires a EWMH conform window manager (Allmost all common used ones are).
* Requires a EWMH conform window manager (Almost all common used ones are).
* Returns "UNKNOWN" otherwise.
*/
QString windowManager();
@@ -266,7 +268,7 @@ T findParent(const QWidget* w)
}
parentWidget = parentWidget->parentWidget();
}
return 0;
return nullptr;
}
/**

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16" height="16" enable-background="new 0 0 122.879 122.867" version="1.1" viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="10" width="7" height="2" fill="#fff"/><style/><style/><style/><style/></svg>

After

Width:  |  Height:  |  Size: 293 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16" height="16" enable-background="new 0 0 122.879 122.867" version="1.1" viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="10" width="7" height="2"/></svg>

After

Width:  |  Height:  |  Size: 249 B

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16" height="16" enable-background="new 0 0 122.879 122.867" version="1.1" viewBox="0 0 16 16" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="m6 3v6h-1v1h3v4h1v-4h3v-1h-1v-6h-4zm1 1h2v5h-2z" color="#000000" fill-opacity=".25" style="-inkscape-stroke:none"/></svg>

After

Width:  |  Height:  |  Size: 332 B

View File

@@ -288,7 +288,8 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
* CAutoHideDockContainer titlebar buttons
*****************************************************************************/
#dockAreaAutoHideButton {
qproperty-icon: url(:/ads/images/vs-pin-button.svg);
qproperty-icon: url(:/ads/images/vs-pin-button.svg),
url(:/ads/images/vs-pin-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
@@ -298,6 +299,12 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton {
}
ads--CAutoHideDockContainer #dockAreaMinimizeButton {
qproperty-icon: url(:/ads/images/minimize-button-focused.svg);
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaCloseButton{
qproperty-icon: url(:/ads/images/close-button-focused.svg)
}

View File

@@ -324,8 +324,9 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
* CAutoHideDockContainer titlebar buttons
*****************************************************************************/
#dockAreaAutoHideButton {
qproperty-icon: url(:/ads/images/vs-pin-button.svg);
qproperty-iconSize: 16px;
qproperty-icon: url(:/ads/images/vs-pin-button.svg),
url(:/ads/images/vs-pin-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaAutoHideButton {
@@ -334,6 +335,12 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton {
}
ads--CAutoHideDockContainer #dockAreaMinimizeButton {
qproperty-icon: url(:/ads/images/minimize-button-focused.svg);
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaCloseButton{
qproperty-icon: url(:/ads/images/close-button-focused.svg)
}

View File

@@ -326,16 +326,24 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
* CAutoHideDockContainer titlebar buttons
*****************************************************************************/
#dockAreaAutoHideButton {
qproperty-icon: url(:/ads/images/vs-pin-button.svg);
qproperty-icon: url(:/ads/images/vs-pin-button.svg),
url(:/ads/images/vs-pin-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaAutoHideButton {
qproperty-icon: url(:/ads/images/vs-pin-button-pinned-focused.svg);
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaMinimizeButton {
qproperty-icon: url(:/ads/images/minimize-button-focused.svg);
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaCloseButton{
qproperty-icon: url(:/ads/images/close-button-focused.svg)
}

View File

@@ -401,8 +401,9 @@ ads--CAutoHideDockContainer ads--CDockAreaWidget[focused="true"] ads--CDockAreaT
* CAutoHideDockContainer titlebar buttons
*****************************************************************************/
#dockAreaAutoHideButton {
qproperty-icon: url(:/ads/images/vs-pin-button.svg);
qproperty-iconSize: 16px;
qproperty-icon: url(:/ads/images/vs-pin-button.svg),
url(:/ads/images/vs-pin-button-disabled.svg) disabled;
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaAutoHideButton {
@@ -411,6 +412,12 @@ ads--CAutoHideDockContainer #dockAreaAutoHideButton {
}
ads--CAutoHideDockContainer #dockAreaMinimizeButton {
qproperty-icon: url(:/ads/images/minimize-button-focused.svg);
qproperty-iconSize: 16px;
}
ads--CAutoHideDockContainer #dockAreaCloseButton{
qproperty-icon: url(:/ads/images/close-button-focused.svg)
}