mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Merge branch 'auto_hide_feature' of github.com:githubuser0xFFFF/Qt-Advanced-Docking-System into auto_hide_feature
This commit is contained in:
commit
ae55013566
@ -650,7 +650,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
|
||||
// uncomment the following line to enable focus highlighting of the dock
|
||||
// widget that has the focus
|
||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
//CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
|
||||
// uncomment if you would like to enable dock widget auto hiding
|
||||
// CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true);
|
||||
|
@ -27,7 +27,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include "OverlayDockContainer.h"
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockManager.h"
|
||||
#include "DockWidgetSideTab.h"
|
||||
#include "DockWidgetTab.h"
|
||||
@ -40,12 +40,15 @@
|
||||
#include <QPainter>
|
||||
#include <QSplitter>
|
||||
#include <QPointer>
|
||||
#include <QApplication>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace ads
|
||||
{
|
||||
struct OverlayDockContainerPrivate
|
||||
struct AutoHideDockContainerPrivate
|
||||
{
|
||||
COverlayDockContainer* _this;
|
||||
CAutoHideDockContainer* _this;
|
||||
CDockAreaWidget* DockArea{nullptr};
|
||||
CDockWidget* DockWidget{nullptr};
|
||||
QPointer<CDockManager> DockManager{nullptr};
|
||||
@ -54,7 +57,7 @@ struct OverlayDockContainerPrivate
|
||||
/**
|
||||
* Private data constructor
|
||||
*/
|
||||
OverlayDockContainerPrivate(COverlayDockContainer *_public);
|
||||
AutoHideDockContainerPrivate(CAutoHideDockContainer *_public);
|
||||
|
||||
/**
|
||||
* Convenience function to get a dock widget area
|
||||
@ -110,22 +113,22 @@ struct OverlayDockContainerPrivate
|
||||
}; // struct OverlayDockContainerPrivate
|
||||
|
||||
//============================================================================
|
||||
OverlayDockContainerPrivate::OverlayDockContainerPrivate(
|
||||
COverlayDockContainer *_public) :
|
||||
AutoHideDockContainerPrivate::AutoHideDockContainerPrivate(
|
||||
CAutoHideDockContainer *_public) :
|
||||
_this(_public)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CDockContainerWidget* COverlayDockContainer::parentContainer() const
|
||||
CDockContainerWidget* CAutoHideDockContainer::parentContainer() const
|
||||
{
|
||||
return internal::findParent<CDockContainerWidget*>(this);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer::COverlayDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
|
||||
CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
|
||||
QSplitter(area == CDockWidgetSideTab::Bottom ? Qt::Orientation::Vertical : Qt::Orientation::Horizontal, parent),
|
||||
d(new OverlayDockContainerPrivate(this))
|
||||
d(new AutoHideDockContainerPrivate(this))
|
||||
{
|
||||
d->DockManager = DockManager;
|
||||
d->Area = area;
|
||||
@ -176,7 +179,7 @@ COverlayDockContainer::COverlayDockContainer(CDockManager* DockManager, CDockWid
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::updateMask()
|
||||
void CAutoHideDockContainer::updateMask()
|
||||
{
|
||||
const auto rect = d->DockArea->frameGeometry();
|
||||
const auto topLeft = rect.topLeft();
|
||||
@ -197,7 +200,7 @@ void COverlayDockContainer::updateMask()
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::updateSize()
|
||||
void CAutoHideDockContainer::updateSize()
|
||||
{
|
||||
const auto dockContainerParent = parentContainer();
|
||||
const auto rootSplitter = dockContainerParent->rootSplitter();
|
||||
@ -207,15 +210,15 @@ void COverlayDockContainer::updateSize()
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer::COverlayDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
|
||||
COverlayDockContainer(DockWidget->dockManager(), area, parent)
|
||||
CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
|
||||
CAutoHideDockContainer(DockWidget->dockManager(), area, parent)
|
||||
{
|
||||
addDockWidget(DockWidget);
|
||||
setDockSizeProportion(DockWidget->DefaultOverlayDockProportion());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer::~COverlayDockContainer()
|
||||
CAutoHideDockContainer::~CAutoHideDockContainer()
|
||||
{
|
||||
ADS_PRINT("~COverlayDockContainer");
|
||||
|
||||
@ -232,19 +235,19 @@ COverlayDockContainer::~COverlayDockContainer()
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CSideTabBar* COverlayDockContainer::sideTabBar() const
|
||||
CSideTabBar* CAutoHideDockContainer::sideTabBar() const
|
||||
{
|
||||
return parentContainer()->sideTabBar(d->Area);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CDockWidget* COverlayDockContainer::dockWidget() const
|
||||
CDockWidget* CAutoHideDockContainer::dockWidget() const
|
||||
{
|
||||
return d->DockWidget;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::addDockWidget(CDockWidget* DockWidget)
|
||||
void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
|
||||
{
|
||||
if (d->DockWidget)
|
||||
{
|
||||
@ -267,7 +270,7 @@ void COverlayDockContainer::addDockWidget(CDockWidget* DockWidget)
|
||||
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::setDockSizeProportion(float SplitterProportion)
|
||||
void CAutoHideDockContainer::setDockSizeProportion(float SplitterProportion)
|
||||
{
|
||||
if (SplitterProportion < 0 || SplitterProportion > 1)
|
||||
{
|
||||
@ -298,19 +301,19 @@ void COverlayDockContainer::setDockSizeProportion(float SplitterProportion)
|
||||
|
||||
|
||||
//============================================================================
|
||||
CDockWidgetSideTab::SideTabBarArea COverlayDockContainer::sideTabBarArea() const
|
||||
CDockWidgetSideTab::SideTabBarArea CAutoHideDockContainer::sideTabBarArea() const
|
||||
{
|
||||
return d->Area;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CDockAreaWidget* COverlayDockContainer::dockAreaWidget() const
|
||||
CDockAreaWidget* CAutoHideDockContainer::dockAreaWidget() const
|
||||
{
|
||||
return d->DockArea;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::moveContentsToParent()
|
||||
void CAutoHideDockContainer::moveContentsToParent()
|
||||
{
|
||||
cleanupAndDelete();
|
||||
|
||||
@ -331,7 +334,7 @@ void COverlayDockContainer::moveContentsToParent()
|
||||
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::cleanupAndDelete()
|
||||
void CAutoHideDockContainer::cleanupAndDelete()
|
||||
{
|
||||
const auto dockWidget = d->DockWidget;
|
||||
if (dockWidget)
|
||||
@ -347,7 +350,7 @@ void COverlayDockContainer::cleanupAndDelete()
|
||||
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::saveState(QXmlStreamWriter& s)
|
||||
void CAutoHideDockContainer::saveState(QXmlStreamWriter& s)
|
||||
{
|
||||
s.writeAttribute("SideTabBarArea", QString::number(sideTabBarArea()));
|
||||
QStringList Sizes;
|
||||
@ -361,7 +364,7 @@ void COverlayDockContainer::saveState(QXmlStreamWriter& s)
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool COverlayDockContainer::restoreState(CDockingStateReader& s, bool Testing)
|
||||
bool CAutoHideDockContainer::restoreState(CDockingStateReader& s, bool Testing)
|
||||
{
|
||||
auto sSizes = s.attributes().value("Sizes").trimmed().toString();
|
||||
ADS_PRINT("Sizes: " << sSizes);
|
||||
@ -387,7 +390,9 @@ bool COverlayDockContainer::restoreState(CDockingStateReader& s, bool Testing)
|
||||
return true;
|
||||
}
|
||||
|
||||
void COverlayDockContainer::toggleView(bool Enable)
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideDockContainer::toggleView(bool Enable)
|
||||
{
|
||||
if (Enable)
|
||||
{
|
||||
@ -405,16 +410,20 @@ void COverlayDockContainer::toggleView(bool Enable)
|
||||
dockWidget->sideTabWidget()->hide();
|
||||
}
|
||||
hide();
|
||||
qApp->removeEventFilter(this);
|
||||
}
|
||||
}
|
||||
|
||||
void COverlayDockContainer::collapseView(bool Enable)
|
||||
|
||||
//============================================================================
|
||||
void CAutoHideDockContainer::collapseView(bool Enable)
|
||||
{
|
||||
if (Enable)
|
||||
{
|
||||
hide();
|
||||
d->DockArea->hide();
|
||||
d->DockWidget->hide();
|
||||
qApp->removeEventFilter(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -422,12 +431,20 @@ void COverlayDockContainer::collapseView(bool Enable)
|
||||
show();
|
||||
d->DockArea->show();
|
||||
d->DockWidget->show();
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool COverlayDockContainer::areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area)
|
||||
void CAutoHideDockContainer::toggleCollapseState()
|
||||
{
|
||||
collapseView(isVisible());
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CAutoHideDockContainer::areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area)
|
||||
{
|
||||
switch (area)
|
||||
{
|
||||
@ -452,27 +469,70 @@ bool COverlayDockContainer::areaExistsInConfig(CDockWidgetSideTab::SideTabBarAre
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool COverlayDockContainer::eventFilter(QObject* watched, QEvent* event)
|
||||
bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::Resize)
|
||||
{
|
||||
updateSize();
|
||||
updateMask();
|
||||
}
|
||||
else if (event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
// First we check, if the mouse button press is inside the dock manager
|
||||
// widget. If it is not, i.e. if someone resizes the main window or
|
||||
// clicks into the application menu or toolbar, then we ignore the
|
||||
// event
|
||||
auto widget = qobject_cast<QWidget*>(watched);
|
||||
bool IsDockManager = false;
|
||||
while (widget)
|
||||
{
|
||||
if (widget == d->DockManager)
|
||||
{
|
||||
IsDockManager = true;
|
||||
}
|
||||
widget = widget->parentWidget();
|
||||
}
|
||||
|
||||
if (!IsDockManager)
|
||||
{
|
||||
return QSplitter::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
// Now we check, if the user clicked inside of this auto hide container.
|
||||
// If the click is inside of this auto hide container, then we can also
|
||||
// ignore the event, because the overlay should not get collapsed if
|
||||
// user works in it
|
||||
QMouseEvent* me = static_cast<QMouseEvent*>(event);
|
||||
auto pos = d->DockArea->mapFromGlobal(me->globalPos());
|
||||
auto rect = d->DockArea->rect().adjusted(-handleWidth(), 0, 0, 0);
|
||||
if (rect.contains(pos))
|
||||
{
|
||||
return QSplitter::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
// Now check, if the user clicked into the side tab and ignore this event,
|
||||
// because the side tab click handler will call collapseView(). If we
|
||||
// do not ignore this here, then we will collapse the container and the side tab
|
||||
// click handler will uncollapse it
|
||||
auto SideTab = d->DockWidget->sideTabWidget();
|
||||
pos = SideTab->mapFromGlobal(me->globalPos());
|
||||
if (SideTab->rect().contains(pos))
|
||||
{
|
||||
return QSplitter::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
// If the mouse button down event is in the dock manager but outside
|
||||
// of the open auto hide container, then the auto hide dock widget
|
||||
// should get collapsed
|
||||
collapseView(true);
|
||||
}
|
||||
|
||||
return QSplitter::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
QSplitter::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void COverlayDockContainer::resizeEvent(QResizeEvent* event)
|
||||
void CAutoHideDockContainer::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
updateMask();
|
||||
QSplitter::resizeEvent(event);
|
@ -39,7 +39,7 @@ class QXmlStreamWriter;
|
||||
|
||||
namespace ads
|
||||
{
|
||||
struct OverlayDockContainerPrivate;
|
||||
struct AutoHideDockContainerPrivate;
|
||||
class CDockManager;
|
||||
class CDockWidget;
|
||||
class CDockContainerWidget;
|
||||
@ -49,17 +49,16 @@ class CDockingStateReader;
|
||||
|
||||
// Note: This widget must be a QSplitter, inheriting from QWidget and keeping an internal splitter breaks ActiveX widgets
|
||||
// likely due to layout issues between this widget and the internal splitter
|
||||
class ADS_EXPORT COverlayDockContainer : public QSplitter
|
||||
class ADS_EXPORT CAutoHideDockContainer : public QSplitter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
OverlayDockContainerPrivate* d; ///< private data (pimpl)
|
||||
friend struct OverlayDockContainerPrivate;
|
||||
AutoHideDockContainerPrivate* d; ///< private data (pimpl)
|
||||
friend struct AutoHideDockContainerPrivate;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void updateMask();
|
||||
void updateSize();
|
||||
@ -70,17 +69,17 @@ public:
|
||||
/**
|
||||
* Create overlay widget with a dock manager
|
||||
*/
|
||||
COverlayDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
|
||||
CAutoHideDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
|
||||
|
||||
/**
|
||||
* Create overlay widget with the given dock widget
|
||||
*/
|
||||
COverlayDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
|
||||
CAutoHideDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
|
||||
|
||||
/**
|
||||
* Virtual Destructor
|
||||
*/
|
||||
virtual ~COverlayDockContainer();
|
||||
virtual ~CAutoHideDockContainer();
|
||||
|
||||
/**
|
||||
* Get's the side tab bar
|
||||
@ -148,6 +147,11 @@ public:
|
||||
*/
|
||||
void collapseView(bool Enable);
|
||||
|
||||
/**
|
||||
* Toggles the current collapse state
|
||||
*/
|
||||
void toggleCollapseState();
|
||||
|
||||
/*
|
||||
* Convenience function fr determining if area exists in config
|
||||
*/
|
@ -29,7 +29,7 @@ set(ads_SRCS
|
||||
DockComponentsFactory.cpp
|
||||
SideTabBar.cpp
|
||||
DockWidgetSideTab.cpp
|
||||
OverlayDockContainer.cpp
|
||||
AutoHideDockContainer.cpp
|
||||
ads.qrc
|
||||
)
|
||||
set(ads_HEADERS
|
||||
@ -53,7 +53,7 @@ set(ads_HEADERS
|
||||
DockComponentsFactory.h
|
||||
SideTabBar.h
|
||||
DockWidgetSideTab.h
|
||||
OverlayDockContainer.h
|
||||
AutoHideDockContainer.h
|
||||
)
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
@ -27,6 +27,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockAreaTitleBar.h"
|
||||
|
||||
#include <QPushButton>
|
||||
@ -51,7 +52,6 @@
|
||||
#include "DockAreaTabBar.h"
|
||||
#include "DockComponentsFactory.h"
|
||||
#include "DockFocusController.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
#include "ElidingLabel.h"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -28,6 +28,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockAreaWidget.h"
|
||||
|
||||
#include <QStackedLayout>
|
||||
@ -52,7 +53,6 @@
|
||||
#include "DockComponentsFactory.h"
|
||||
#include "DockWidgetTab.h"
|
||||
#include "DockWidgetSideTab.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
|
||||
namespace ads
|
||||
@ -248,7 +248,7 @@ struct DockAreaWidgetPrivate
|
||||
DockAreaLayout* ContentsLayout = nullptr;
|
||||
CDockAreaTitleBar* TitleBar = nullptr;
|
||||
CDockManager* DockManager = nullptr;
|
||||
COverlayDockContainer* OverlayDockContainer = nullptr;
|
||||
CAutoHideDockContainer* OverlayDockContainer = nullptr;
|
||||
bool UpdateTitleBarButtons = false;
|
||||
DockWidgetAreas AllowedAreas = DefaultAllowedAreas;
|
||||
QSize MinSizeHint;
|
||||
@ -457,7 +457,7 @@ CDockContainerWidget* CDockAreaWidget::dockContainer() const
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer* CDockAreaWidget::overlayDockContainer() const
|
||||
CAutoHideDockContainer* CDockAreaWidget::overlayDockContainer() const
|
||||
{
|
||||
return d->OverlayDockContainer;
|
||||
}
|
||||
@ -469,7 +469,7 @@ bool CDockAreaWidget::isOverlayed() const
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::setOverlayDockContainer(COverlayDockContainer* OverlayDockContainer)
|
||||
void CDockAreaWidget::setOverlayDockContainer(CAutoHideDockContainer* OverlayDockContainer)
|
||||
{
|
||||
d->OverlayDockContainer = OverlayDockContainer;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
friend class CDockWidget;
|
||||
friend struct DockManagerPrivate;
|
||||
friend class CDockManager;
|
||||
friend class COverlayDockContainer;
|
||||
friend class CAutoHideDockContainer;
|
||||
void onDockWidgetFeaturesChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
@ -212,7 +212,7 @@ public:
|
||||
* Returns the overlay dock container widget this dock area widget belongs to or 0
|
||||
* if there is no
|
||||
*/
|
||||
COverlayDockContainer* overlayDockContainer() const;
|
||||
CAutoHideDockContainer* overlayDockContainer() const;
|
||||
|
||||
/**
|
||||
* Returns true if the dock area exists in an overlay dock container
|
||||
@ -223,7 +223,7 @@ public:
|
||||
/**
|
||||
* Sets the current overlay dock container
|
||||
*/
|
||||
void setOverlayDockContainer(COverlayDockContainer* OverlayDockContainer);
|
||||
void setOverlayDockContainer(CAutoHideDockContainer* OverlayDockContainer);
|
||||
|
||||
/**
|
||||
* Returns the largest minimumSizeHint() of the dock widgets in this
|
||||
|
@ -28,6 +28,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockContainerWidget.h"
|
||||
|
||||
#include <QEvent>
|
||||
@ -49,7 +50,6 @@
|
||||
#include "ads_globals.h"
|
||||
#include "DockSplitter.h"
|
||||
#include "SideTabBar.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
#include "DockWidgetTab.h"
|
||||
#include "DockWidgetSideTab.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
@ -138,7 +138,7 @@ public:
|
||||
QPointer<CDockManager> DockManager;
|
||||
unsigned int zOrderIndex = 0;
|
||||
QList<CDockAreaWidget*> DockAreas;
|
||||
QList<COverlayDockContainer*> OverlayWidgets;
|
||||
QList<CAutoHideDockContainer*> OverlayWidgets;
|
||||
QMap<CDockWidgetSideTab::SideTabBarArea, CSideTabBar*> SideTabBarWidgets;
|
||||
QGridLayout* Layout = nullptr;
|
||||
QSplitter* RootSplitter = nullptr;
|
||||
@ -1048,7 +1048,7 @@ bool DockContainerWidgetPrivate::restoreOverlayDockArea(CDockingStateReader& s,
|
||||
ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: "
|
||||
<< CurrentDockWidget);
|
||||
|
||||
if (!COverlayDockContainer::areaExistsInConfig(area))
|
||||
if (!CAutoHideDockContainer::areaExistsInConfig(area))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ bool DockContainerWidgetPrivate::restoreOverlayDockArea(CDockingStateReader& s,
|
||||
CDockAreaWidget* DockArea = nullptr;
|
||||
if (!Testing)
|
||||
{
|
||||
const auto dockContainer = new COverlayDockContainer(DockManager, area, _this);
|
||||
const auto dockContainer = new CAutoHideDockContainer(DockManager, area, _this);
|
||||
if (!dockContainer->restoreState(s, Testing))
|
||||
{
|
||||
return false;
|
||||
@ -1491,13 +1491,13 @@ CDockAreaWidget* CDockContainerWidget::addDockWidget(DockWidgetArea area, CDockW
|
||||
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget, CDockWidget::eOverlayInsertOrder insertOrder)
|
||||
CAutoHideDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget, CDockWidget::eOverlayInsertOrder insertOrder)
|
||||
{
|
||||
if (d->DockManager != DockWidget->dockManager())
|
||||
{
|
||||
DockWidget->setDockManager(d->DockManager); // Overlay Dock Container needs a valid dock manager
|
||||
}
|
||||
if (!COverlayDockContainer::areaExistsInConfig(area))
|
||||
if (!CAutoHideDockContainer::areaExistsInConfig(area))
|
||||
{
|
||||
Q_ASSERT_X(false, "CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer",
|
||||
"Requested area does not exist in config");
|
||||
@ -1508,7 +1508,7 @@ COverlayDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverla
|
||||
sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget());
|
||||
DockWidget->sideTabWidget()->show();
|
||||
|
||||
const auto dockContainer = new COverlayDockContainer(DockWidget, area, this);
|
||||
const auto dockContainer = new CAutoHideDockContainer(DockWidget, area, this);
|
||||
dockContainer->hide();
|
||||
d->DockManager->dockFocusController()->clearDockWidgetFocus(DockWidget);
|
||||
return dockContainer;
|
||||
@ -1619,7 +1619,7 @@ void CDockContainerWidget::deleteOverlayWidgets()
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
QList<COverlayDockContainer*> CDockContainerWidget::overlayWidgets() const
|
||||
QList<CAutoHideDockContainer*> CDockContainerWidget::overlayWidgets() const
|
||||
{
|
||||
return d->OverlayWidgets;
|
||||
}
|
||||
@ -2156,7 +2156,7 @@ void CDockContainerWidget::updateSplitterHandles(QSplitter* splitter)
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CDockContainerWidget::registerOverlayWidget(COverlayDockContainer* OverlayWidget)
|
||||
void CDockContainerWidget::registerOverlayWidget(CAutoHideDockContainer* OverlayWidget)
|
||||
{
|
||||
d->OverlayWidgets.append(OverlayWidget);
|
||||
Q_EMIT overlayWidgetCreated(OverlayWidget);
|
||||
@ -2164,7 +2164,7 @@ void CDockContainerWidget::registerOverlayWidget(COverlayDockContainer* OverlayW
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CDockContainerWidget::removeOverlayWidget(COverlayDockContainer* OverlayWidget)
|
||||
void CDockContainerWidget::removeOverlayWidget(CAutoHideDockContainer* OverlayWidget)
|
||||
{
|
||||
d->OverlayWidgets.removeAll(OverlayWidget);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ private:
|
||||
friend class CDockWidget;
|
||||
friend class CFloatingDragPreview;
|
||||
friend struct FloatingDragPreviewPrivate;
|
||||
friend class COverlayDockContainer;
|
||||
friend class CAutoHideDockContainer;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -100,7 +100,7 @@ protected:
|
||||
* Initializing inserts the tabs into the side tab widget and hides it
|
||||
* Returns nullptr if you try and insert into an area where the configuration is not enabled
|
||||
*/
|
||||
COverlayDockContainer* createAndInitializeDockWidgetOverlayContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget, CDockWidget::eOverlayInsertOrder insertOrder);
|
||||
CAutoHideDockContainer* createAndInitializeDockWidgetOverlayContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget, CDockWidget::eOverlayInsertOrder insertOrder);
|
||||
|
||||
/**
|
||||
* Helper function for creation of the root splitter
|
||||
@ -187,13 +187,13 @@ protected:
|
||||
* Registers the given floating widget in the internal list of
|
||||
* overlay widgets
|
||||
*/
|
||||
void registerOverlayWidget(COverlayDockContainer* OverlayWidget);
|
||||
void registerOverlayWidget(CAutoHideDockContainer* OverlayWidget);
|
||||
|
||||
/**
|
||||
* Remove the given overlay widget from the list of registered overlay
|
||||
* widgets
|
||||
*/
|
||||
void removeOverlayWidget(COverlayDockContainer* OverlayWidget);
|
||||
void removeOverlayWidget(CAutoHideDockContainer* OverlayWidget);
|
||||
|
||||
|
||||
public:
|
||||
@ -326,7 +326,7 @@ public:
|
||||
/**
|
||||
* Access function for overlay widgets
|
||||
*/
|
||||
QList<COverlayDockContainer*> overlayWidgets() const;
|
||||
QList<CAutoHideDockContainer*> overlayWidgets() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
@ -339,7 +339,7 @@ Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted, if a new overlay widget has been created.
|
||||
*/
|
||||
void overlayWidgetCreated(ads::COverlayDockContainer* OverlayWidget);
|
||||
void overlayWidgetCreated(ads::CAutoHideDockContainer* OverlayWidget);
|
||||
|
||||
/**
|
||||
* This signal is emitted if one or multiple dock areas has been removed
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "DockManager.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
#include "DockWidgetSideTab.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "linux/FloatingWidgetTitleBar.h"
|
||||
@ -189,12 +188,7 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (old && old->overlayDockContainer() && old->overlayDockContainer()->isVisible() && old != FocusedDockWidget)
|
||||
{
|
||||
old->overlayDockContainer()->collapseView(true);
|
||||
}
|
||||
|
||||
if (old == DockWidget && !ForceFocusChangedSignal)
|
||||
if (old == DockWidget && !ForceFocusChangedSignal)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockWidgetTab.h"
|
||||
#include "DockManager.h"
|
||||
|
||||
@ -57,7 +58,6 @@
|
||||
#include "DockAreaTitleBar.h"
|
||||
#include "DockFocusController.h"
|
||||
#include "DockSplitter.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "linux/FloatingWidgetTitleBar.h"
|
||||
@ -865,13 +865,13 @@ CDockAreaWidget* CDockManager::addDockWidgetToContainer(DockWidgetArea area,
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer* CDockManager::addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockWidget::eOverlayInsertOrder insertOrder)
|
||||
CAutoHideDockContainer* CDockManager::addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockWidget::eOverlayInsertOrder insertOrder)
|
||||
{
|
||||
return addOverlayDockWidgetToContainer(area, Dockwidget, this, insertOrder);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
COverlayDockContainer* CDockManager::addOverlayDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eOverlayInsertOrder insertOrder)
|
||||
CAutoHideDockContainer* CDockManager::addOverlayDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eOverlayInsertOrder insertOrder)
|
||||
{
|
||||
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
||||
auto container = DockContainerWidget->createAndInitializeDockWidgetOverlayContainer(area, Dockwidget, insertOrder);
|
||||
|
@ -84,7 +84,7 @@ private:
|
||||
friend class CFloatingDragPreview;
|
||||
friend struct FloatingDragPreviewPrivate;
|
||||
friend class CDockAreaTitleBar;
|
||||
friend class COverlayDockContainer;
|
||||
friend class CAutoHideDockContainer;
|
||||
|
||||
|
||||
protected:
|
||||
@ -341,14 +341,14 @@ public:
|
||||
* An overlay widget is used for auto hide functionality
|
||||
* \return Returns the COverlayDockContainer that contains the new DockWidget
|
||||
*/
|
||||
COverlayDockContainer* addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockWidget::eOverlayInsertOrder insertOrder = CDockWidget::Last);
|
||||
CAutoHideDockContainer* addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockWidget::eOverlayInsertOrder insertOrder = CDockWidget::Last);
|
||||
|
||||
/**
|
||||
* Adds dock widget overlayed into the given container based on the CDockWidgetSideTab::SideTabBarArea.
|
||||
* An overlay widget is used for auto hide functionality
|
||||
* \return Returns the COverlayDockContainer that contains the new DockWidget
|
||||
*/
|
||||
COverlayDockContainer* addOverlayDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eOverlayInsertOrder = CDockWidget::Last);
|
||||
CAutoHideDockContainer* addOverlayDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eOverlayInsertOrder = CDockWidget::Last);
|
||||
|
||||
/**
|
||||
* This function will add the given Dockwidget to the given dock area as
|
||||
|
@ -28,6 +28,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockWidgetTab.h"
|
||||
#include "DockWidget.h"
|
||||
|
||||
@ -59,7 +60,6 @@
|
||||
#include "DockSplitter.h"
|
||||
#include "DockComponentsFactory.h"
|
||||
#include "ads_globals.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
|
||||
namespace ads
|
||||
@ -437,7 +437,7 @@ CDockWidgetTab* CDockWidget::tabWidget() const
|
||||
return d->TabWidget;
|
||||
}
|
||||
|
||||
COverlayDockContainer* CDockWidget::overlayDockContainer() const
|
||||
CAutoHideDockContainer* CDockWidget::autoHideDockContainer() const
|
||||
{
|
||||
if (!d->DockArea)
|
||||
{
|
||||
@ -1079,15 +1079,16 @@ void CDockWidget::showNormal()
|
||||
//============================================================================
|
||||
void CDockWidget::onDockWidgetSideTabClicked()
|
||||
{
|
||||
const auto overlayContainer = overlayDockContainer();
|
||||
const auto overlayContainer = autoHideDockContainer();
|
||||
if (!overlayContainer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
overlayContainer->raise();
|
||||
const auto shouldCollapse = overlayContainer->isVisible();
|
||||
overlayContainer->collapseView(shouldCollapse);
|
||||
//const auto shouldCollapse = overlayContainer->isVisible();
|
||||
//overlayContainer->collapseView(shouldCollapse);
|
||||
overlayContainer->toggleCollapseState();
|
||||
if (overlayContainer->isVisible())
|
||||
{
|
||||
// d->DockManager->setDockWidgetFocused(this) does not
|
||||
|
@ -47,7 +47,7 @@ class CDockAreaWidget;
|
||||
class DockContainerWidgetPrivate;
|
||||
class CFloatingDockContainer;
|
||||
class CDockWidgetSideTab;
|
||||
class COverlayDockContainer;
|
||||
class CAutoHideDockContainer;
|
||||
|
||||
/**
|
||||
* The QDockWidget class provides a widget that can be docked inside a
|
||||
@ -77,7 +77,7 @@ protected:
|
||||
friend class CDockWidgetTab;
|
||||
friend struct DockWidgetTabPrivate;
|
||||
friend struct DockAreaTitleBarPrivate;
|
||||
friend class COverlayDockContainer;
|
||||
friend class CAutoHideDockContainer;
|
||||
|
||||
/**
|
||||
* Assigns the dock manager that manages this dock widget
|
||||
@ -319,7 +319,7 @@ public:
|
||||
* Returns the overlay dock container of this dock widget
|
||||
* or 0 if there is none
|
||||
*/
|
||||
COverlayDockContainer* overlayDockContainer() const;
|
||||
CAutoHideDockContainer* autoHideDockContainer() const;
|
||||
|
||||
/**
|
||||
* Sets, whether the dock widget is movable, closable, and floatable.
|
||||
|
@ -27,6 +27,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "DockWidgetSideTab.h"
|
||||
#include "SideTabBar.h"
|
||||
|
||||
@ -37,7 +38,6 @@
|
||||
#include "ElidingLabel.h"
|
||||
|
||||
#include "DockWidget.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
namespace ads
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ private:
|
||||
DockWidgetSideTabPrivate* d; ///< private data (pimpl)
|
||||
friend struct DockWidgetSideTabPrivate;
|
||||
friend class CDockWidget;
|
||||
friend class COverlayDockContainer;
|
||||
friend class CAutoHideDockContainer;
|
||||
|
||||
protected:
|
||||
friend class CSideTabBar;
|
||||
|
@ -28,6 +28,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "FloatingDragPreview.h"
|
||||
#include "ElidingLabel.h"
|
||||
#include "DockWidgetTab.h"
|
||||
@ -51,7 +52,6 @@
|
||||
#include "DockManager.h"
|
||||
#include "IconProvider.h"
|
||||
#include "DockFocusController.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
|
||||
namespace ads
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
friend struct DockWidgetTabPrivate;
|
||||
friend class CDockWidget;
|
||||
friend class CDockManager;
|
||||
friend class COverlayDockContainer;
|
||||
friend class CAutoHideDockContainer;
|
||||
void onDockWidgetFeaturesChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
|
@ -241,6 +241,7 @@ QString CElidingLabel::text() const
|
||||
return d->Text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Private data of public CVerticalElidingLabel
|
||||
*/
|
||||
@ -255,9 +256,11 @@ struct VerticalElidingLabelPrivate
|
||||
|
||||
//============================================================================
|
||||
VerticalElidingLabelPrivate::VerticalElidingLabelPrivate(CVerticalElidingLabel* _public)
|
||||
: _this(_public)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CVerticalElidingLabel::CVerticalElidingLabel(QWidget* parent, Qt::WindowFlags f) :
|
||||
CElidingLabel(parent, f),
|
||||
@ -265,6 +268,7 @@ CVerticalElidingLabel::CVerticalElidingLabel(QWidget* parent, Qt::WindowFlags f)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CVerticalElidingLabel::setOrientation(Qt::Orientation orientation)
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <AutoHideDockContainer.h>
|
||||
#include "FloatingDragPreview.h"
|
||||
#include <iostream>
|
||||
|
||||
@ -21,7 +22,6 @@
|
||||
#include "DockManager.h"
|
||||
#include "DockContainerWidget.h"
|
||||
#include "DockOverlay.h"
|
||||
#include "OverlayDockContainer.h"
|
||||
|
||||
namespace ads
|
||||
{
|
||||
@ -369,9 +369,9 @@ void CFloatingDragPreview::cleanupOverlayContainerWidget()
|
||||
{
|
||||
auto DroppedDockWidget = qobject_cast<CDockWidget*>(d->Content);
|
||||
auto DroppedArea = qobject_cast<CDockAreaWidget*>(d->Content);
|
||||
if (DroppedDockWidget && DroppedDockWidget->overlayDockContainer())
|
||||
if (DroppedDockWidget && DroppedDockWidget->autoHideDockContainer())
|
||||
{
|
||||
DroppedDockWidget->overlayDockContainer()->cleanupAndDelete();
|
||||
DroppedDockWidget->autoHideDockContainer()->cleanupAndDelete();
|
||||
}
|
||||
if (DroppedArea && DroppedArea->overlayDockContainer())
|
||||
{
|
||||
|
@ -111,6 +111,8 @@ void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab)
|
||||
//============================================================================
|
||||
void CSideTabBar::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
QStyleOption option;
|
||||
option.initFrom(this);
|
||||
QPainter painter(this);
|
||||
|
@ -48,7 +48,7 @@ HEADERS += \
|
||||
IconProvider.h \
|
||||
DockComponentsFactory.h \
|
||||
DockFocusController.h \
|
||||
OverlayDockContainer.h \
|
||||
AutoHideDockContainer.h \
|
||||
SideTabBar.h \
|
||||
DockWidgetSideTab.h
|
||||
|
||||
@ -71,7 +71,7 @@ SOURCES += \
|
||||
IconProvider.cpp \
|
||||
DockComponentsFactory.cpp \
|
||||
DockFocusController.cpp \
|
||||
OverlayDockContainer.cpp \
|
||||
AutoHideDockContainer.cpp \
|
||||
SideTabBar.cpp \
|
||||
DockWidgetSideTab.cpp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user