Compare commits

..

11 Commits

Author SHA1 Message Date
Uwe Kindler
2730c135ea Removed OpaqueUndocking documentation 2023-01-20 11:58:58 +01:00
Uwe Kindler
9c30169c42 Removed support for opaque undocking 2023-01-20 11:50:34 +01:00
Uwe Kindler
624d21d001 Added RDE to showcase section 2023-01-20 10:25:21 +01:00
Uwe Kindler
378c647952 Fixed #481 issue Undocking an autohide dock widget does not close the AutoHideTab from the sidebar 2023-01-20 09:44:18 +01:00
Uwe Kindler
bbfe99ce7d Added image for showcase section 2023-01-19 13:34:32 +01:00
Uwe Kindler
97d675cb24 Updated README.md 2022-12-27 15:21:51 +01:00
Uwe Kindler
bbfad308e5 Added some pictures to show AutoHide and ImageViewer functionality 2022-12-27 15:19:51 +01:00
Uwe Kindler
858cdb2d66 Added some pictures to show AutoHide and ImageViewer functionality 2022-12-27 15:18:09 +01:00
githubuser0xFFFF
9f5e06ae13 Update linux-builds.yml
Removed ubuntu-latest because there seems to be build issues for ubuntu-22.04
2022-12-09 15:04:03 +01:00
Uwe Kindler
2cd451c53c Added dockContainer() function to AutoHideSideBar.cpp 2022-12-09 08:50:41 +01:00
Uwe Kindler
302ee59d67 Fixed dockContainer() function of AutoHideDockContainer.cpp
Returning the dock container of the internal dock area is wrong, if the dock widget is removed from
the AutoHideDockContainer, then the DockArea container function already returns the new dock container
of the DockArea and not the dock container of the AutoHideDockContainer.cpp
2022-12-09 08:50:12 +01:00
15 changed files with 637 additions and 643 deletions

View File

@@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-20.04, ubuntu-18.04]
os: [ubuntu-20.04, ubuntu-18.04]
runs-on: ${{ matrix.os }}

1118
README.md

File diff suppressed because it is too large Load Diff

View File

@@ -544,13 +544,7 @@ void MainWindowPrivate::createContent()
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// If opaque undocking is active, then undocking of widgets while
// active x widget is visible causes jerking while dragging a floating
// widget
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
{
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
}
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
#endif
#endif

BIN
doc/AutoHide_Animation.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
doc/Feature_ImageViewer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

BIN
doc/showcase_robox_ide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

View File

@@ -11,7 +11,6 @@
- [`TabCloseButtonIsToolButton`](#tabclosebuttonistoolbutton)
- [`AllTabsHaveCloseButton`](#alltabshaveclosebutton)
- [`RetainTabSizeWhenCloseButtonHidden`](#retaintabsizewhenclosebuttonhidden)
- [`OpaqueUndocking`](#opaqueundocking)
- [`DragPreviewIsDynamic`](#dragpreviewisdynamic)
- [`DragPreviewShowsContentPixmap`](#dragpreviewshowscontentpixmap)
- [`DragPreviewHasWindowFrame`](#dragpreviewhaswindowframe)
@@ -170,37 +169,6 @@ constant, that means, if enabled, the tabs need more space.
![AllTabsHaveCloseButton false](cfg_flag_RetainTabSizeWhenCloseButtonHidden_true.png)
### `OpaqueUndocking`
If this flag is set, 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.
![OpaqueUndocking true](opaque_undocking.gif)
If you would like to test opaque undocking, you should set the predefined config
flags `CDockManager::DefaultOpaqueConfig`.
```c++
CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
```
If this flag is cleared (default), 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.
![OpaqueUndocking true](non_opaque_undocking.gif)
The drag preview widget can be configured by a number of global dock manager flags:
- `DragPreviewIsDynamic`
- `DragPreviewShowsContentPixmap`
- `DragPreviewHasWindowFrame`
Non-opaque undocking is enabled by default. If you would like to enable it
explicitely, you can do this by setting the predefined configuration flags
`CDockManager::DefaultNonOpaqueConfig`.
```c++
CDockManager::setConfigFlags(CDockManager::DefaultNonOpaqueConfig);
```
### `DragPreviewIsDynamic`
If non-opaque undocking is enabled, this flag defines the behavior of the drag
@@ -631,10 +599,7 @@ If set, the dock widget will have a close button.
If a dock widget is movable, then it and can be moved to a new position in the
current dock container. Disable this flag to prevent moving of a dock widget
via mouse. If the `OpaqueUndocking` configuration flag is set, then dock widgets
are immediately undocked into floating widgets. That means, moving is only
possible in this case, if the dock widget is also floatable (feature flag
`DockWidgetFloatable` is set).
via mouse.
### `DockWidgetFloatable`

View File

@@ -187,14 +187,7 @@ AutoHideDockContainerPrivate::AutoHideDockContainerPrivate(
//============================================================================
CDockContainerWidget* CAutoHideDockContainer::dockContainer() const
{
if (d->DockArea)
{
return d->DockArea->dockContainer();
}
else
{
return internal::findParent<CDockContainerWidget*>(this);
}
return internal::findParent<CDockContainerWidget*>(this);
}
@@ -303,8 +296,15 @@ CAutoHideDockContainer::~CAutoHideDockContainer()
//============================================================================
CAutoHideSideBar* CAutoHideDockContainer::sideBar() const
{
auto DockContainer = dockContainer();
return DockContainer ? DockContainer->sideTabBar(d->SideTabBarArea) : nullptr;
if (d->SideTab)
{
return d->SideTab->sideBar();
}
else
{
auto DockContainer = dockContainer();
return DockContainer ? DockContainer->sideTabBar(d->SideTabBarArea) : nullptr;
}
}

View File

@@ -378,11 +378,19 @@ int CAutoHideSideBar::spacing() const
return d->TabsLayout->spacing();
}
//===========================================================================
void CAutoHideSideBar::setSpacing(int Spacing)
{
d->TabsLayout->setSpacing(Spacing);
}
//===========================================================================
CDockContainerWidget* CAutoHideSideBar::dockContainer() const
{
return d->ContainerWidget;
}
} // namespace ads

View File

@@ -163,6 +163,11 @@ public:
* Setter for spacing property - sets the spacing
*/
void setSpacing(int Spacing);
/**
* Returns the dock container that hosts this sideBar()
*/
CDockContainerWidget* dockContainer() const;
};
} // namespace ads
//-----------------------------------------------------------------------------

View File

@@ -262,12 +262,15 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
{
QSize Size = DockArea->size();
this->DragState = DragState;
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
(DraggingFloatingWidget != DragState);
bool CreateFloatingDockContainer = (DraggingFloatingWidget != DragState);
CFloatingDockContainer* FloatingDockContainer = nullptr;
IFloatingWidget* FloatingWidget;
if (OpaqueUndocking)
if (CreateFloatingDockContainer)
{
if (DockArea->autoHideDockContainer())
{
DockArea->autoHideDockContainer()->cleanupAndDelete();
}
FloatingWidget = FloatingDockContainer = new CFloatingDockContainer(DockArea);
}
else
@@ -297,7 +300,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
//============================================================================
void DockAreaTitleBarPrivate::startFloating(const QPoint& Offset)
{
if (DockArea->autoHideDockContainer() != nullptr)
if (DockArea->autoHideDockContainer())
{
DockArea->autoHideDockContainer()->hide();
}
@@ -428,11 +431,6 @@ void CDockAreaTitleBar::onUndockButtonClicked()
{
if (d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable))
{
if (d->DockArea->autoHideDockContainer())
{
d->DockArea->autoHideDockContainer()->cleanupAndDelete();
}
d->makeAreaFloating(mapFromGlobal(QCursor::pos()), DraggingInactive);
}
}
@@ -634,11 +632,9 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
// If one single dock widget in this area is not floatable then the whole
// area is not floatable
// If we do non opaque undocking, then we can create the floating drag
// preview if the dock widget is movable
// We can create the floating drag preview if the dock widget is movable
auto Features = d->DockArea->features();
if (!Features.testFlag(CDockWidget::DockWidgetFloatable)
&& !(Features.testFlag(CDockWidget::DockWidgetMovable) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking)))
if (!Features.testFlag(CDockWidget::DockWidgetFloatable) && !(Features.testFlag(CDockWidget::DockWidgetMovable)))
{
return;
}
@@ -671,10 +667,6 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
{
return;
}
if (d->DockArea->autoHideDockContainer())
{
d->DockArea->autoHideDockContainer()->cleanupAndDelete();
}
d->makeAreaFloating(event->pos(), DraggingInactive);
}

View File

@@ -180,7 +180,6 @@ public:
TabCloseButtonIsToolButton = 0x0040,//! If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default
AllTabsHaveCloseButton = 0x0080, //!< if this flag is set, then all tabs that are closable show a close button
RetainTabSizeWhenCloseButtonHidden = 0x0100, //!< if this flag is set, the space for the close button is reserved even if the close button is not visible
OpaqueUndocking = 0x0200,///< If enabled, the widgets are immediately undocked into floating widgets, if disabled, only a draw preview is undocked and the real undocking is deferred until the mouse is released
DragPreviewIsDynamic = 0x0400,///< If opaque undocking is disabled, this flag defines the behavior of the drag preview window, if this flag is enabled, the preview will be adjusted dynamically to the drop area
DragPreviewShowsContentPixmap = 0x0800,///< If opaque undocking is disabled, the created drag preview window shows a copy of the content of the dock widget / dock are that is dragged
DragPreviewHasWindowFrame = 0x1000,///< If opaque undocking is disabled, then this flag configures if the drag preview is frameless or looks like a real window
@@ -216,7 +215,7 @@ public:
DefaultOpaqueConfig = DefaultBaseConfig
| OpaqueSplitterResize
| OpaqueUndocking, ///< the default configuration with opaque operations - this may cause issues if ActiveX or Qt 3D windows are involved
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations
DefaultNonOpaqueConfig = DefaultBaseConfig
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations

View File

@@ -248,17 +248,31 @@ void DockWidgetPrivate::updateParentDockArea()
//============================================================================
void DockWidgetPrivate::closeAutoHideDockWidgetsIfNeeded()
{
if (_this->dockContainer() && _this->dockContainer()->openedDockWidgets().isEmpty() && !_this->dockManager()->isRestoringState())
auto DockContainer = _this->dockContainer();
if (!DockContainer)
{
for (auto autoHideWidget : _this->dockContainer()->autoHideWidgets())
{
if (autoHideWidget->dockWidget() == _this)
{
continue;
}
return;
}
autoHideWidget->dockWidget()->toggleView(false);
}
if (_this->dockManager()->isRestoringState())
{
return;
}
if (!DockContainer->openedDockWidgets().isEmpty())
{
return;
}
for (auto autoHideWidget : DockContainer->autoHideWidgets())
{
auto DockWidget = autoHideWidget->dockWidget();
if (DockWidget == _this)
{
continue;
}
DockWidget->toggleView(false);
}
}

View File

@@ -162,9 +162,9 @@ struct DockWidgetTabPrivate
}
template <typename T>
IFloatingWidget* createFloatingWidget(T* Widget, bool OpaqueUndocking)
IFloatingWidget* createFloatingWidget(T* Widget, bool CreateContainer)
{
if (OpaqueUndocking)
if (CreateContainer)
{
return new CFloatingDockContainer(Widget);
}
@@ -312,8 +312,7 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
ADS_PRINT("startFloating");
DragState = DraggingState;
IFloatingWidget* FloatingWidget = nullptr;
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
(DraggingFloatingWidget != DraggingState);
bool CreateContainer = (DraggingFloatingWidget != DraggingState);
// If section widget has multiple tabs, we take only one tab
// If it has only one single tab, we can move the complete
@@ -321,12 +320,12 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
QSize Size;
if (DockArea->dockWidgetsCount() > 1)
{
FloatingWidget = createFloatingWidget(DockWidget, OpaqueUndocking);
FloatingWidget = createFloatingWidget(DockWidget, CreateContainer);
Size = DockWidget->size();
}
else
{
FloatingWidget = createFloatingWidget(DockArea, OpaqueUndocking);
FloatingWidget = createFloatingWidget(DockArea, CreateContainer);
Size = DockArea->size();
}
@@ -477,15 +476,13 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
// Floating is only allowed for widgets that are floatable
// If we do non opaque undocking, then can create the drag preview
// if the widget is movable.
// We can create the drag preview if the widget is movable.
auto Features = d->DockWidget->features();
if (Features.testFlag(CDockWidget::DockWidgetFloatable)
|| (Features.testFlag(CDockWidget::DockWidgetMovable) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking)))
if (Features.testFlag(CDockWidget::DockWidgetFloatable) || (Features.testFlag(CDockWidget::DockWidgetMovable)))
{
// If we undock, we need to restore the initial position of this
// tab because it looks strange if it remains on its dragged position
if (d->isDraggingState(DraggingTab) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
if (d->isDraggingState(DraggingTab))
{
parentWidget()->layout()->update();
}

View File

@@ -38,6 +38,8 @@
#include <QStyle>
#include <QMouseEvent>
#include <iostream>
#ifdef Q_OS_LINUX
#include <xcb/xcb.h>
#endif