mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 21:25:44 +08:00
Add left right styling to the dock widget side tab
This commit is contained in:
parent
8bfb98ea20
commit
0087a1b360
@ -1040,7 +1040,7 @@ void CDockAreaWidget::toggleAutoHideArea(bool Enable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::onAutoHideToggleRequested(CDockWidget* DockWidget, bool Enable, SideTabBarArea area)
|
void CDockAreaWidget::onAutoHideToggleRequested(CDockWidget* DockWidget, bool Enable, CDockWidgetSideTab::SideTabBarArea area)
|
||||||
{
|
{
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
|
#include "DockWidgetSideTab.h"
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
||||||
QT_FORWARD_DECLARE_CLASS(QAbstractButton)
|
QT_FORWARD_DECLARE_CLASS(QAbstractButton)
|
||||||
@ -161,7 +162,7 @@ protected Q_SLOTS:
|
|||||||
/**
|
/**
|
||||||
* Auto hides the dock area and all dock widgets in this area
|
* Auto hides the dock area and all dock widgets in this area
|
||||||
*/
|
*/
|
||||||
void onAutoHideToggleRequested(CDockWidget* DockWidget, bool Enable, SideTabBarArea area);
|
void onAutoHideToggleRequested(CDockWidget* DockWidget, bool Enable, CDockWidgetSideTab::SideTabBarArea area);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = QFrame;
|
using Super = QFrame;
|
||||||
|
@ -138,7 +138,7 @@ public:
|
|||||||
unsigned int zOrderIndex = 0;
|
unsigned int zOrderIndex = 0;
|
||||||
QList<CDockAreaWidget*> DockAreas;
|
QList<CDockAreaWidget*> DockAreas;
|
||||||
QList<COverlayDockContainer*> OverlayWidgets;
|
QList<COverlayDockContainer*> OverlayWidgets;
|
||||||
QMap<SideTabBarArea, CSideTabBar*> SideTabBarWidgets;
|
QMap<CDockWidgetSideTab::SideTabBarArea, CSideTabBar*> SideTabBarWidgets;
|
||||||
QGridLayout* Layout = nullptr;
|
QGridLayout* Layout = nullptr;
|
||||||
QSplitter* RootSplitter = nullptr;
|
QSplitter* RootSplitter = nullptr;
|
||||||
bool isFloating = false;
|
bool isFloating = false;
|
||||||
@ -254,7 +254,7 @@ public:
|
|||||||
* Assumes that there are no overlay dock areas, and then restores all the dock areas that
|
* Assumes that there are no overlay dock areas, and then restores all the dock areas that
|
||||||
* exist in the XML
|
* exist in the XML
|
||||||
*/
|
*/
|
||||||
bool restoreOverlayDockArea(CDockingStateReader& s, SideTabBarArea area, bool Testing);
|
bool restoreOverlayDockArea(CDockingStateReader& s, CDockWidgetSideTab::SideTabBarArea area, bool Testing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores either a dock area or an overlay dock area depending on the value in the XML
|
* Restores either a dock area or an overlay dock area depending on the value in the XML
|
||||||
@ -1032,7 +1032,7 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool DockContainerWidgetPrivate::restoreOverlayDockArea(CDockingStateReader& s, SideTabBarArea area, bool Testing)
|
bool DockContainerWidgetPrivate::restoreOverlayDockArea(CDockingStateReader& s, CDockWidgetSideTab::SideTabBarArea area, bool Testing)
|
||||||
{
|
{
|
||||||
bool Ok;
|
bool Ok;
|
||||||
#ifdef ADS_DEBUG_PRINT
|
#ifdef ADS_DEBUG_PRINT
|
||||||
@ -1128,12 +1128,12 @@ bool DockContainerWidgetPrivate::restoreDockOrOverlayDockArea(CDockingStateReade
|
|||||||
const auto sideTabAreaValue = Stream.attributes().value("SideTabBarArea");
|
const auto sideTabAreaValue = Stream.attributes().value("SideTabBarArea");
|
||||||
if (!sideTabAreaValue.isNull())
|
if (!sideTabAreaValue.isNull())
|
||||||
{
|
{
|
||||||
auto sideTabBarArea = static_cast<SideTabBarArea>(sideTabAreaValue.toInt(&Ok));
|
auto sideTabBarArea = static_cast<CDockWidgetSideTab::SideTabBarArea>(sideTabAreaValue.toInt(&Ok));
|
||||||
if (!Ok)
|
if (!Ok)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sideTabBarArea != SideTabBarArea::None)
|
if (sideTabBarArea != CDockWidgetSideTab::None)
|
||||||
{
|
{
|
||||||
return restoreOverlayDockArea(Stream, sideTabBarArea, Testing);
|
return restoreOverlayDockArea(Stream, sideTabBarArea, Testing);
|
||||||
}
|
}
|
||||||
@ -1500,7 +1500,7 @@ CDockAreaWidget* CDockContainerWidget::addDockWidget(DockWidgetArea area, CDockW
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
COverlayDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer(SideTabBarArea area, CDockWidget* DockWidget)
|
COverlayDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget)
|
||||||
{
|
{
|
||||||
if (d->DockManager != DockWidget->dockManager())
|
if (d->DockManager != DockWidget->dockManager())
|
||||||
{
|
{
|
||||||
@ -1522,31 +1522,31 @@ COverlayDockContainer* CDockContainerWidget::createAndInitializeDockWidgetOverla
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
SideTabBarArea CDockContainerWidget::getDockAreaPosition(CDockAreaWidget* DockAreaWidget)
|
CDockWidgetSideTab::SideTabBarArea CDockContainerWidget::getDockAreaPosition(CDockAreaWidget* DockAreaWidget)
|
||||||
{
|
{
|
||||||
const auto dockWidgetCenter = DockAreaWidget->mapToGlobal(DockAreaWidget->frameGeometry().center());
|
const auto dockWidgetCenter = DockAreaWidget->mapToGlobal(DockAreaWidget->frameGeometry().center());
|
||||||
const auto splitterCenter = rootSplitter()->mapToGlobal(rootSplitter()->frameGeometry().center());
|
const auto splitterCenter = rootSplitter()->mapToGlobal(rootSplitter()->frameGeometry().center());
|
||||||
const auto calculatedPosition = dockWidgetCenter.x() <= splitterCenter.x() ? Left : Right;
|
const auto calculatedPosition = dockWidgetCenter.x() <= splitterCenter.x() ? CDockWidgetSideTab::Left : CDockWidgetSideTab::Right;
|
||||||
if (calculatedPosition == Right)
|
if (calculatedPosition == CDockWidgetSideTab::Right)
|
||||||
{
|
{
|
||||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
||||||
{
|
{
|
||||||
return Right;
|
return CDockWidgetSideTab::Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Left;
|
return CDockWidgetSideTab::Left;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calculatedPosition == Left)
|
if (calculatedPosition == CDockWidgetSideTab::Left)
|
||||||
{
|
{
|
||||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
||||||
{
|
{
|
||||||
return Left;
|
return CDockWidgetSideTab::Left;
|
||||||
}
|
}
|
||||||
return Right;
|
return CDockWidgetSideTab::Right;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Left;
|
return CDockWidgetSideTab::Left;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2025,14 +2025,14 @@ void CDockContainerWidget::createSideTabBarWidgets()
|
|||||||
{
|
{
|
||||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
||||||
{
|
{
|
||||||
d->SideTabBarWidgets[SideTabBarArea::Left] = new CSideTabBar(this);
|
d->SideTabBarWidgets[CDockWidgetSideTab::Left] = new CSideTabBar(this);
|
||||||
d->Layout->addWidget(d->SideTabBarWidgets[SideTabBarArea::Left], 0, 0);
|
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Left], 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
if (CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
||||||
{
|
{
|
||||||
d->SideTabBarWidgets[SideTabBarArea::Right] = new CSideTabBar(this);
|
d->SideTabBarWidgets[CDockWidgetSideTab::Right] = new CSideTabBar(this);
|
||||||
d->Layout->addWidget(d->SideTabBarWidgets[SideTabBarArea::Right], 0, 2);
|
d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Right], 0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2181,7 +2181,7 @@ void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CSideTabBar* CDockContainerWidget::sideTabBar(SideTabBarArea area) const
|
CSideTabBar* CDockContainerWidget::sideTabBar(CDockWidgetSideTab::SideTabBarArea area) const
|
||||||
{
|
{
|
||||||
return d->SideTabBarWidgets[area];
|
return d->SideTabBarWidgets[area];
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
|
#include "DockWidgetSideTab.h"
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamWriter)
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ protected:
|
|||||||
* Initializing inserts the tabs into the side tab widget and hides it
|
* 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
|
* Returns nullptr if you try and insert into an area where the configuration is not enabled
|
||||||
*/
|
*/
|
||||||
COverlayDockContainer* createAndInitializeDockWidgetOverlayContainer(SideTabBarArea area, CDockWidget* DockWidget);
|
COverlayDockContainer* createAndInitializeDockWidgetOverlayContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for creation of the root splitter
|
* Helper function for creation of the root splitter
|
||||||
@ -226,7 +227,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get's the overlay dock side tab bar area based on the dock area widget position
|
* Get's the overlay dock side tab bar area based on the dock area widget position
|
||||||
*/
|
*/
|
||||||
SideTabBarArea getDockAreaPosition(CDockAreaWidget* DockAreaWidget);
|
CDockWidgetSideTab::SideTabBarArea getDockAreaPosition(CDockAreaWidget* DockAreaWidget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes dockwidget
|
* Removes dockwidget
|
||||||
@ -326,7 +327,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns the side tab widget for the given area
|
* Returns the side tab widget for the given area
|
||||||
*/
|
*/
|
||||||
CSideTabBar* sideTabBar(SideTabBarArea area) const;
|
CSideTabBar* sideTabBar(CDockWidgetSideTab::SideTabBarArea area) const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
|
@ -863,13 +863,13 @@ CDockAreaWidget* CDockManager::addDockWidgetToContainer(DockWidgetArea area,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
COverlayDockContainer* CDockManager::addOverlayDockWidget(SideTabBarArea area, CDockWidget* Dockwidget)
|
COverlayDockContainer* CDockManager::addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget)
|
||||||
{
|
{
|
||||||
return addOverlayDockWidgetToContainer(area, Dockwidget, this);
|
return addOverlayDockWidgetToContainer(area, Dockwidget, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
COverlayDockContainer* CDockManager::addOverlayDockWidgetToContainer(SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget)
|
COverlayDockContainer* CDockManager::addOverlayDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget)
|
||||||
{
|
{
|
||||||
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
||||||
auto container = DockContainerWidget->createAndInitializeDockWidgetOverlayContainer(area, Dockwidget);
|
auto container = DockContainerWidget->createAndInitializeDockWidgetOverlayContainer(area, Dockwidget);
|
||||||
|
@ -212,14 +212,14 @@ public:
|
|||||||
| DockAreaHasUndockButton
|
| DockAreaHasUndockButton
|
||||||
| DockAreaHasTabsMenuButton, ///< default configuration of dock area title bar buttons
|
| DockAreaHasTabsMenuButton, ///< default configuration of dock area title bar buttons
|
||||||
|
|
||||||
DefaultDockContainerSideBars = DockContainerHasLeftSideBar
|
DefaultDockContainerConfig = DockContainerHasLeftSideBar
|
||||||
| DockContainerHasRightSideBar, ///< the default configuration for left and right side bars
|
| DockContainerHasRightSideBar
|
||||||
|
| DockAreaHasAutoHideButton, ///< the default configuration for left and right side bars
|
||||||
|
|
||||||
DefaultBaseConfig = DefaultDockAreaButtons
|
DefaultBaseConfig = DefaultDockAreaButtons
|
||||||
| ActiveTabHasCloseButton
|
| ActiveTabHasCloseButton
|
||||||
| XmlCompressionEnabled
|
| XmlCompressionEnabled
|
||||||
| FloatingContainerHasWidgetTitle
|
| FloatingContainerHasWidgetTitle, ///< default base configuration settings
|
||||||
| DefaultDockContainerSideBars, ///< default base configuration settings
|
|
||||||
|
|
||||||
DefaultOpaqueConfig = DefaultBaseConfig
|
DefaultOpaqueConfig = DefaultBaseConfig
|
||||||
| OpaqueSplitterResize
|
| OpaqueSplitterResize
|
||||||
@ -307,14 +307,14 @@ public:
|
|||||||
* An overlay widget is used for auto hide functionality
|
* An overlay widget is used for auto hide functionality
|
||||||
* \return Returns the COverlayDockContainer that contains the new DockWidget
|
* \return Returns the COverlayDockContainer that contains the new DockWidget
|
||||||
*/
|
*/
|
||||||
COverlayDockContainer* addOverlayDockWidget(SideTabBarArea area, CDockWidget* Dockwidget);
|
COverlayDockContainer* addOverlayDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds dock widget overlayed into the given container based on the SideTabBarArea.
|
* Adds dock widget overlayed into the given container based on the CDockWidgetSideTab::SideTabBarArea.
|
||||||
* An overlay widget is used for auto hide functionality
|
* An overlay widget is used for auto hide functionality
|
||||||
* \return Returns the COverlayDockContainer that contains the new DockWidget
|
* \return Returns the COverlayDockContainer that contains the new DockWidget
|
||||||
*/
|
*/
|
||||||
COverlayDockContainer* addOverlayDockWidgetToContainer(SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget);
|
COverlayDockContainer* addOverlayDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will add the given Dockwidget to the given dock area as
|
* This function will add the given Dockwidget to the given dock area as
|
||||||
|
@ -32,9 +32,11 @@
|
|||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
|
||||||
|
#include "DockAreaWidget.h"
|
||||||
#include "ElidingLabel.h"
|
#include "ElidingLabel.h"
|
||||||
|
|
||||||
#include "DockWidget.h"
|
#include "DockWidget.h"
|
||||||
|
#include "OverlayDockContainer.h"
|
||||||
|
|
||||||
namespace ads
|
namespace ads
|
||||||
{
|
{
|
||||||
@ -148,4 +150,15 @@ void CDockWidgetSideTab::updateStyle()
|
|||||||
{
|
{
|
||||||
internal::repolishStyle(this, internal::RepolishDirectChildren);
|
internal::repolishStyle(this, internal::RepolishDirectChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDockWidgetSideTab::SideTabBarArea CDockWidgetSideTab::sideTabBarArea() const
|
||||||
|
{
|
||||||
|
auto dockAreaWidget = d->DockWidget->dockAreaWidget();
|
||||||
|
if (dockAreaWidget && dockAreaWidget->isOverlayed())
|
||||||
|
{
|
||||||
|
return dockAreaWidget->overlayDockContainer()->sideTabBarArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ class ADS_EXPORT CDockWidgetSideTab : public QFrame
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(SideTabBarArea sideTabBarArea READ sideTabBarArea)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DockWidgetSideTabPrivate* d; ///< private data (pimpl)
|
DockWidgetSideTabPrivate* d; ///< private data (pimpl)
|
||||||
friend struct DockWidgetSideTabPrivate;
|
friend struct DockWidgetSideTabPrivate;
|
||||||
@ -67,6 +69,20 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = QFrame;
|
using Super = QFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dock widget side tab bar locations
|
||||||
|
*/
|
||||||
|
enum SideTabBarArea
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
Bottom
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_ENUM(SideTabBarArea)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
* param[in] DockWidget The dock widget this title bar belongs to
|
* param[in] DockWidget The dock widget this title bar belongs to
|
||||||
@ -85,6 +101,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void updateStyle();
|
void updateStyle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for side tab bar area property
|
||||||
|
*/
|
||||||
|
SideTabBarArea sideTabBarArea() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void elidedChanged(bool elided);
|
void elidedChanged(bool elided);
|
||||||
void clicked();
|
void clicked();
|
||||||
|
@ -52,7 +52,7 @@ struct OverlayDockContainerPrivate
|
|||||||
CDockWidget* DockWidget{nullptr};
|
CDockWidget* DockWidget{nullptr};
|
||||||
QPointer<CDockManager> DockManager{nullptr};
|
QPointer<CDockManager> DockManager{nullptr};
|
||||||
QSplitter* Splitter;
|
QSplitter* Splitter;
|
||||||
SideTabBarArea Area;
|
CDockWidgetSideTab::SideTabBarArea Area;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@ -74,7 +74,7 @@ CDockContainerWidget* COverlayDockContainer::parentContainer() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
COverlayDockContainer::COverlayDockContainer(CDockManager* DockManager, SideTabBarArea area, CDockContainerWidget* parent) :
|
COverlayDockContainer::COverlayDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
d(new OverlayDockContainerPrivate(this))
|
d(new OverlayDockContainerPrivate(this))
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ COverlayDockContainer::COverlayDockContainer(CDockManager* DockManager, SideTabB
|
|||||||
const auto emptyWidget = new QWidget();
|
const auto emptyWidget = new QWidget();
|
||||||
emptyWidget->setMinimumWidth(50);
|
emptyWidget->setMinimumWidth(50);
|
||||||
|
|
||||||
if (area == SideTabBarArea::Left)
|
if (area == CDockWidgetSideTab::SideTabBarArea::Left)
|
||||||
{
|
{
|
||||||
d->Splitter->addWidget(d->DockArea);
|
d->Splitter->addWidget(d->DockArea);
|
||||||
d->Splitter->addWidget(emptyWidget);
|
d->Splitter->addWidget(emptyWidget);
|
||||||
@ -123,7 +123,7 @@ void COverlayDockContainer::updateMask()
|
|||||||
const auto rect = d->DockArea->frameGeometry();
|
const auto rect = d->DockArea->frameGeometry();
|
||||||
const auto topLeft = rect.topLeft();
|
const auto topLeft = rect.topLeft();
|
||||||
const auto handleSize = d->Splitter->handleWidth();
|
const auto handleSize = d->Splitter->handleWidth();
|
||||||
const auto offset = d->Area == SideTabBarArea::Left ? 0 : handleSize;
|
const auto offset = d->Area == CDockWidgetSideTab::SideTabBarArea::Left ? 0 : handleSize;
|
||||||
setMask(QRect(QPoint(topLeft.x() - offset, topLeft.y()), QSize(rect.size().width() + handleSize, rect.size().height())));
|
setMask(QRect(QPoint(topLeft.x() - offset, topLeft.y()), QSize(rect.size().width() + handleSize, rect.size().height())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ void COverlayDockContainer::updateSize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
COverlayDockContainer::COverlayDockContainer(CDockWidget* DockWidget, SideTabBarArea area, CDockContainerWidget* parent) :
|
COverlayDockContainer::COverlayDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
|
||||||
COverlayDockContainer(DockWidget->dockManager(), area, parent)
|
COverlayDockContainer(DockWidget->dockManager(), area, parent)
|
||||||
{
|
{
|
||||||
addDockWidget(DockWidget);
|
addDockWidget(DockWidget);
|
||||||
@ -195,7 +195,7 @@ void COverlayDockContainer::addDockWidget(CDockWidget* DockWidget)
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
SideTabBarArea COverlayDockContainer::sideTabBarArea() const
|
CDockWidgetSideTab::SideTabBarArea COverlayDockContainer::sideTabBarArea() const
|
||||||
{
|
{
|
||||||
return d->Area;
|
return d->Area;
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ CDockAreaWidget* COverlayDockContainer::dockAreaWidget() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void COverlayDockContainer::moveContentsToParent()
|
void COverlayDockContainer::moveContentsToParent()
|
||||||
{
|
{
|
||||||
const auto position = mapToGlobal(d->Area == Left ? QPoint(1,height() / 2) : QPoint(width() - 1, height() / 2));
|
const auto position = mapToGlobal(d->Area == CDockWidgetSideTab::Left ? QPoint(1,height() / 2) : QPoint(width() - 1, height() / 2));
|
||||||
|
|
||||||
const auto dockAreaWidget = parentContainer()->dockAreaAt(position);
|
const auto dockAreaWidget = parentContainer()->dockAreaAt(position);
|
||||||
if (dockAreaWidget != nullptr && !dockAreaWidget->isCentralWidgetArea())
|
if (dockAreaWidget != nullptr && !dockAreaWidget->isCentralWidgetArea())
|
||||||
@ -218,7 +218,7 @@ void COverlayDockContainer::moveContentsToParent()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentContainer()->addDockWidget(d->Area == Left ? LeftDockWidgetArea : RightDockWidgetArea, d->DockWidget);
|
parentContainer()->addDockWidget(d->Area == CDockWidgetSideTab::Left ? LeftDockWidgetArea : RightDockWidgetArea, d->DockWidget);
|
||||||
}
|
}
|
||||||
cleanupAndDelete();
|
cleanupAndDelete();
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ void COverlayDockContainer::cleanupAndDelete()
|
|||||||
|
|
||||||
void COverlayDockContainer::saveState(QXmlStreamWriter& s)
|
void COverlayDockContainer::saveState(QXmlStreamWriter& s)
|
||||||
{
|
{
|
||||||
s.writeAttribute("SideTabBarArea", QString::number(sideTabBarArea()));
|
s.writeAttribute("CDockWidgetSideTab::SideTabBarArea", QString::number(sideTabBarArea()));
|
||||||
QStringList Sizes;
|
QStringList Sizes;
|
||||||
for (auto Size : d->Splitter->sizes())
|
for (auto Size : d->Splitter->sizes())
|
||||||
{
|
{
|
||||||
@ -275,13 +275,13 @@ bool COverlayDockContainer::restoreState(CDockingStateReader& s, bool Testing)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COverlayDockContainer::areaExistsInConfig(SideTabBarArea area)
|
bool COverlayDockContainer::areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area)
|
||||||
{
|
{
|
||||||
if (area == Left && !CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
if (area == CDockWidgetSideTab::Left && !CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (area == Right && !CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
if (area == CDockWidgetSideTab::Right && !CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
#include "ads_globals.h"
|
#include "ads_globals.h"
|
||||||
|
|
||||||
|
#include "DockWidgetSideTab.h"
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
class QXmlStreamWriter;
|
class QXmlStreamWriter;
|
||||||
@ -48,12 +50,11 @@ class CDockingStateReader;
|
|||||||
class ADS_EXPORT COverlayDockContainer : public QFrame
|
class ADS_EXPORT COverlayDockContainer : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OverlayDockContainerPrivate* d; ///< private data (pimpl)
|
OverlayDockContainerPrivate* d; ///< private data (pimpl)
|
||||||
friend struct OverlayDockContainerPrivate;
|
friend struct OverlayDockContainerPrivate;
|
||||||
|
|
||||||
CDockContainerWidget* parentContainer() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
@ -61,16 +62,18 @@ protected:
|
|||||||
void updateMask();
|
void updateMask();
|
||||||
void updateSize();
|
void updateSize();
|
||||||
|
|
||||||
|
CDockContainerWidget* parentContainer() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Create overlay widget with a dock manager
|
* Create overlay widget with a dock manager
|
||||||
*/
|
*/
|
||||||
COverlayDockContainer(CDockManager* DockManager, SideTabBarArea area, CDockContainerWidget* parent);
|
COverlayDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create overlay widget with the given dock widget
|
* Create overlay widget with the given dock widget
|
||||||
*/
|
*/
|
||||||
COverlayDockContainer(CDockWidget* DockWidget, SideTabBarArea area, CDockContainerWidget* parent);
|
COverlayDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual Destructor
|
* Virtual Destructor
|
||||||
@ -95,7 +98,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns the side tab bar area of this overlay dock container
|
* Returns the side tab bar area of this overlay dock container
|
||||||
*/
|
*/
|
||||||
SideTabBarArea sideTabBarArea() const;
|
CDockWidgetSideTab::SideTabBarArea sideTabBarArea() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the dock area widget of this overlay dock container
|
* Returns the dock area widget of this overlay dock container
|
||||||
@ -126,7 +129,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Convenience function fr determining if area exists in config
|
* Convenience function fr determining if area exists in config
|
||||||
*/
|
*/
|
||||||
static bool areaExistsInConfig(SideTabBarArea area);
|
static bool areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,17 +106,6 @@ enum eDragState
|
|||||||
DraggingFloatingWidget//!< DraggingFloatingWidget
|
DraggingFloatingWidget//!< DraggingFloatingWidget
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Dock widget side tab bar locations
|
|
||||||
*/
|
|
||||||
enum SideTabBarArea
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Left,
|
|
||||||
Right,
|
|
||||||
Bottom
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The different icons used in the UI
|
* The different icons used in the UI
|
||||||
*/
|
*/
|
||||||
|
@ -26,10 +26,17 @@ ads--CDockWidgetSideTab {
|
|||||||
background: palette(window);
|
background: palette(window);
|
||||||
border-color: palette(light);
|
border-color: palette(light);
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px 1px 1px 1px;
|
|
||||||
padding: 0 0px;
|
padding: 0 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ads--CDockWidgetSideTab[sideTabBarArea="Left"] {
|
||||||
|
border-width: 0px 0px 0px 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ads--CDockWidgetSideTab[sideTabBarArea="Right"] {
|
||||||
|
border-width: 0px 3px 0px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
ads--CDockWidgetTab[activeTab="true"] {
|
ads--CDockWidgetTab[activeTab="true"] {
|
||||||
background: qlineargradient(spread : pad, x1 : 0, y1 : 0, x2 : 0, y2 : 0.5, stop : 0
|
background: qlineargradient(spread : pad, x1 : 0, y1 : 0, x2 : 0, y2 : 0.5, stop : 0
|
||||||
palette(window), stop:1 palette(light));
|
palette(window), stop:1 palette(light));
|
||||||
|
Loading…
Reference in New Issue
Block a user