Moved SideBarLocation enum out of CDockWidgetSideTab into global ads namespace

This commit is contained in:
Uwe Kindler 2022-10-27 10:22:28 +02:00
parent 822ad48152
commit c94155fb06
20 changed files with 125 additions and 110 deletions

View File

@ -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);
@ -748,7 +748,7 @@ void CMainWindow::onViewToggled(bool Open)
return;
}
qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")";
//qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")";
}

View File

@ -47,7 +47,7 @@ CMainWindow::CMainWindow(QWidget *parent)
TableDockWidget->resize(250, 150);
TableDockWidget->setMinimumSize(200,150);
TableDockWidget->setDefaultAutoHideDockProportion(0.5);
DockManager->addAutoHideDockWidget(CDockWidgetSideTab::SideTabBarArea::Left, TableDockWidget, CDockWidget::Last);
DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget, CDockWidget::Last);
ui->menuView->addAction(TableDockWidget->toggleViewAction());
table = new QTableWidget();
@ -58,7 +58,7 @@ CMainWindow::CMainWindow(QWidget *parent)
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
TableDockWidget->resize(250, 150);
TableDockWidget->setMinimumSize(200,150);
DockManager->addAutoHideDockWidget(CDockWidgetSideTab::SideTabBarArea::Left, TableDockWidget, CDockWidget::Last);
DockManager->addAutoHideDockWidget(SideBarLocation::Left, TableDockWidget, CDockWidget::Last);
ui->menuView->addAction(TableDockWidget->toggleViewAction());
QTableWidget* propertiesTable = new QTableWidget();

View File

@ -50,14 +50,14 @@ namespace ads
static const int ResizeMargin = 4;
//============================================================================
bool static isHorizontalArea(CDockWidgetSideTab::SideTabBarArea Area)
bool static isHorizontalArea(SideBarLocation Area)
{
switch (Area)
{
case CDockWidgetSideTab::Top:
case CDockWidgetSideTab::Bottom: return true;
case CDockWidgetSideTab::Left:
case CDockWidgetSideTab::Right: return false;
case SideBarLocation::Top:
case SideBarLocation::Bottom: return true;
case SideBarLocation::Left:
case SideBarLocation::Right: return false;
}
return true;
@ -65,14 +65,14 @@ bool static isHorizontalArea(CDockWidgetSideTab::SideTabBarArea Area)
//============================================================================
Qt::Edge static edgeFromSideTabBarArea(CDockWidgetSideTab::SideTabBarArea Area)
Qt::Edge static edgeFromSideTabBarArea(SideBarLocation Area)
{
switch (Area)
{
case CDockWidgetSideTab::Top: return Qt::BottomEdge;
case CDockWidgetSideTab::Bottom: return Qt::TopEdge;
case CDockWidgetSideTab::Left: return Qt::RightEdge;
case CDockWidgetSideTab::Right: return Qt::LeftEdge;
case SideBarLocation::Top: return Qt::BottomEdge;
case SideBarLocation::Bottom: return Qt::TopEdge;
case SideBarLocation::Left: return Qt::RightEdge;
case SideBarLocation::Right: return Qt::LeftEdge;
}
return Qt::LeftEdge;
@ -80,15 +80,15 @@ Qt::Edge static edgeFromSideTabBarArea(CDockWidgetSideTab::SideTabBarArea Area)
//============================================================================
int resizeHandleLayoutPosition(CDockWidgetSideTab::SideTabBarArea Area)
int resizeHandleLayoutPosition(SideBarLocation Area)
{
switch (Area)
{
case CDockWidgetSideTab::Bottom:
case CDockWidgetSideTab::Right: return 0;
case SideBarLocation::Bottom:
case SideBarLocation::Right: return 0;
case CDockWidgetSideTab::Top:
case CDockWidgetSideTab::Left: return 1;
case SideBarLocation::Top:
case SideBarLocation::Left: return 1;
}
return 0;
@ -104,7 +104,7 @@ struct AutoHideDockContainerPrivate
CDockAreaWidget* DockArea{nullptr};
CDockWidget* DockWidget{nullptr};
QPointer<CDockManager> DockManager{nullptr};
CDockWidgetSideTab::SideTabBarArea SideTabBarArea;
SideBarLocation SideTabBarArea;
QBoxLayout* Layout;
CResizeHandle* ResizeHandle = nullptr;
QSize Size;
@ -117,14 +117,14 @@ struct AutoHideDockContainerPrivate
/**
* Convenience function to get a dock widget area
*/
DockWidgetArea getDockWidgetArea(CDockWidgetSideTab::SideTabBarArea area)
DockWidgetArea getDockWidgetArea(SideBarLocation area)
{
switch (area)
{
case CDockWidgetSideTab::Left: return LeftDockWidgetArea;
case CDockWidgetSideTab::Right: return RightDockWidgetArea;
case CDockWidgetSideTab::Bottom: return BottomDockWidgetArea;
case CDockWidgetSideTab::Top: return TopDockWidgetArea;
case SideBarLocation::Left: return LeftDockWidgetArea;
case SideBarLocation::Right: return RightDockWidgetArea;
case SideBarLocation::Bottom: return BottomDockWidgetArea;
case SideBarLocation::Top: return TopDockWidgetArea;
}
return LeftDockWidgetArea;
@ -168,7 +168,7 @@ CDockContainerWidget* CAutoHideDockContainer::parentContainer() const
//============================================================================
CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBarLocation area, CDockContainerWidget* parent) :
Super(parent),
d(new AutoHideDockContainerPrivate(this))
{
@ -200,7 +200,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, CDockW
//============================================================================
CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent) :
CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area, CDockContainerWidget* parent) :
CAutoHideDockContainer(DockWidget->dockManager(), area, parent)
{
addDockWidget(DockWidget);
@ -215,17 +215,17 @@ void CAutoHideDockContainer::updateSize()
switch (sideTabBarArea())
{
case CDockWidgetSideTab::Top:
case SideBarLocation::Top:
move(rect.topLeft());
resize(rect.width(), qMin(rect.height(), d->Size.height()));
break;
case CDockWidgetSideTab::Left:
case SideBarLocation::Left:
move(rect.topLeft());
resize(qMin(d->Size.width(), rect.width()), rect.height());
break;
case CDockWidgetSideTab::Right:
case SideBarLocation::Right:
{
QPoint p = rect.topRight();
p.rx() -= (width() - 1);
@ -234,7 +234,7 @@ void CAutoHideDockContainer::updateSize()
}
break;
case CDockWidgetSideTab::Bottom:
case SideBarLocation::Bottom:
{
QPoint p = rect.bottomLeft();
p.ry() -= (height() - 1);
@ -299,7 +299,7 @@ void CAutoHideDockContainer::addDockWidget(CDockWidget* DockWidget)
//============================================================================
CDockWidgetSideTab::SideTabBarArea CAutoHideDockContainer::sideTabBarArea() const
SideBarLocation CAutoHideDockContainer::sideTabBarArea() const
{
return d->SideTabBarArea;
}

View File

@ -53,7 +53,7 @@ class CDockingStateReader;
class ADS_EXPORT CAutoHideDockContainer : public QFrame
{
Q_OBJECT
Q_PROPERTY(int sideTabBarArea READ sideTabBarArea)
Q_PROPERTY(ads::SideBarLocation sideTabBarArea READ sideTabBarArea)
private:
AutoHideDockContainerPrivate* d; ///< private data (pimpl)
friend struct AutoHideDockContainerPrivate;
@ -70,12 +70,12 @@ public:
/**
* Create Auto Hide widget with a dock manager
*/
CAutoHideDockContainer(CDockManager* DockManager, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
CAutoHideDockContainer(CDockManager* DockManager, SideBarLocation area, CDockContainerWidget* parent);
/**
* Create Auto Hide widget with the given dock widget
*/
CAutoHideDockContainer(CDockWidget* DockWidget, CDockWidgetSideTab::SideTabBarArea area, CDockContainerWidget* parent);
CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area, CDockContainerWidget* parent);
/**
* Virtual Destructor
@ -100,7 +100,7 @@ public:
/**
* Returns the side tab bar area of this Auto Hide dock container
*/
CDockWidgetSideTab::SideTabBarArea sideTabBarArea() const;
SideBarLocation sideTabBarArea() const;
/**
* Returns the dock area widget of this Auto Hide dock container

View File

@ -146,6 +146,7 @@ CDockAreaTabBar::CDockAreaTabBar(CDockAreaWidget* parent) :
//============================================================================
CDockAreaTabBar::~CDockAreaTabBar()
{
qDebug() << "~CDockAreaTabBar count " << count();
delete d;
}

View File

@ -493,7 +493,6 @@ void CDockAreaTitleBar::onCurrentTabChanged(int Index)
//============================================================================
void CDockAreaTitleBar::onAutoHideButtonClicked()
{
qDebug() << "CDockAreaTitleBar::onAutoHideButtonClicked()";
if (d->DockArea->features().testFlag(CDockWidget::DockWidgetPinnable))
{
d->DockArea->toggleAutoHideArea(!d->DockArea->isAutoHide());

View File

@ -867,6 +867,7 @@ void CDockAreaWidget::saveState(QXmlStreamWriter& s) const
auto CurrentDockWidget = currentDockWidget();
QString Name = CurrentDockWidget ? CurrentDockWidget->objectName() : "";
s.writeAttribute("Current", Name);
// To keep the saved XML data small, we only save the allowed areas and the
// dock area flags if the values are different from the default values
if (isAutoHide())

View File

@ -139,7 +139,7 @@ public:
unsigned int zOrderIndex = 0;
QList<CDockAreaWidget*> DockAreas;
QList<CAutoHideDockContainer*> AutoHideWidgets;
QMap<CDockWidgetSideTab::SideTabBarArea, CSideTabBar*> SideTabBarWidgets;
QMap<SideBarLocation, CSideTabBar*> SideTabBarWidgets;
QGridLayout* Layout = nullptr;
QSplitter* RootSplitter = nullptr;
bool isFloating = false;
@ -255,7 +255,7 @@ public:
* Assumes that there are no auto hidden dock areas, and then restores all the dock areas that
* exist in the XML
*/
bool restoreAutoHideDockArea(CDockingStateReader& s, CDockWidgetSideTab::SideTabBarArea area, bool Testing);
bool restoreAutoHideDockArea(CDockingStateReader& s, SideBarLocation area, bool Testing);
/**
* Restores either a dock area or an auto hide dock area depending on the value in the XML
@ -1033,7 +1033,7 @@ bool DockContainerWidgetPrivate::restoreSplitter(CDockingStateReader& s,
}
//============================================================================
bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, CDockWidgetSideTab::SideTabBarArea area, bool Testing)
bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, SideBarLocation area, bool Testing)
{
bool Ok;
#ifdef ADS_DEBUG_PRINT
@ -1126,7 +1126,7 @@ bool DockContainerWidgetPrivate::restoreDockOrAutoHideDockArea(CDockingStateRead
const auto sideTabAreaValue = Stream.attributes().value("SideTabBarArea");
if (!sideTabAreaValue.isNull())
{
auto sideTabBarArea = static_cast<CDockWidgetSideTab::SideTabBarArea>(sideTabAreaValue.toInt(&Ok));
auto sideTabBarArea = static_cast<SideBarLocation>(sideTabAreaValue.toInt(&Ok));
if (!Ok)
{
return false;
@ -1500,7 +1500,8 @@ CDockAreaWidget* CDockContainerWidget::addDockWidget(DockWidgetArea area, CDockW
//============================================================================
CAutoHideDockContainer* CDockContainerWidget::createAndInitializeAutoHideDockWidgetContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder)
CAutoHideDockContainer* CDockContainerWidget::createAndInitializeAutoHideDockWidgetContainer(
SideBarLocation area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder)
{
if (d->DockManager != DockWidget->dockManager())
{
@ -1546,7 +1547,7 @@ enum eBorderLocation
//============================================================================
CDockWidgetSideTab::SideTabBarArea CDockContainerWidget::calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget)
SideBarLocation CDockContainerWidget::calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget)
{
auto ContentRect = this->contentRect();
@ -1562,62 +1563,62 @@ CDockWidgetSideTab::SideTabBarArea CDockContainerWidget::calculateSideTabBarArea
// measure border distances - a distance less than 16 px means we touch the
// border
int BorderDistance[4];
int Distance = qAbs(ContentRect.topLeft().y() - DockAreaRect.topLeft().y());
BorderDistance[CDockWidgetSideTab::Top] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[CDockWidgetSideTab::Top])
BorderDistance[SideBarLocation::Top] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[SideBarLocation::Top])
{
borders |= BorderTop;
}
qDebug() << "BorderDistance[CDockWidgetSideTab::Top] " << BorderDistance[CDockWidgetSideTab::Top];
Distance = qAbs(ContentRect.bottomRight().y() - DockAreaRect.bottomRight().y());
BorderDistance[CDockWidgetSideTab::Bottom] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[CDockWidgetSideTab::Bottom])
BorderDistance[SideBarLocation::Bottom] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[SideBarLocation::Bottom])
{
borders |= BorderBottom;
}
qDebug() << "BorderDistance[CDockWidgetSideTab::Bottom] " << BorderDistance[CDockWidgetSideTab::Bottom];
Distance = qAbs(ContentRect.topLeft().x() - DockAreaRect.topLeft().x());
BorderDistance[CDockWidgetSideTab::Left] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[CDockWidgetSideTab::Left])
BorderDistance[SideBarLocation::Left] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[SideBarLocation::Left])
{
borders |= BorderLeft;
}
qDebug() << "BorderDistance[CDockWidgetSideTab::Left] " << BorderDistance[CDockWidgetSideTab::Left];
Distance = qAbs(ContentRect.bottomRight().x() - DockAreaRect.bottomRight().x());
BorderDistance[CDockWidgetSideTab::Right] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[CDockWidgetSideTab::Right])
BorderDistance[SideBarLocation::Right] = (Distance < MinBorderDistance) ? 0 : Distance;
if (!BorderDistance[SideBarLocation::Right])
{
borders |= BorderRight;
}
qDebug() << "BorderDistance[CDockWidgetSideTab::Right] " << BorderDistance[CDockWidgetSideTab::Right];
auto SideTab = CDockWidgetSideTab::Right;
auto SideTab = SideBarLocation::Right;
switch (borders)
{
// 1. It's touching all borders
case BorderAll: SideTab = HorizontalOrientation ? CDockWidgetSideTab::Bottom : CDockWidgetSideTab::Right; break;
case BorderAll: SideTab = HorizontalOrientation ? SideBarLocation::Bottom : SideBarLocation::Right; break;
// 2. It's touching 3 borders
case BorderVerticalBottom : SideTab = CDockWidgetSideTab::Bottom; break;
case BorderVerticalTop : SideTab = CDockWidgetSideTab::Top; break;
case BorderHorizontalLeft: SideTab = CDockWidgetSideTab::Left; break;
case BorderHorizontalRight: SideTab = CDockWidgetSideTab::Right; break;
case BorderVerticalBottom : SideTab = SideBarLocation::Bottom; break;
case BorderVerticalTop : SideTab = SideBarLocation::Top; break;
case BorderHorizontalLeft: SideTab = SideBarLocation::Left; break;
case BorderHorizontalRight: SideTab = SideBarLocation::Right; break;
// 3. Its touching horizontal or vertical borders
case BorderVertical : SideTab = CDockWidgetSideTab::Bottom; break;
case BorderHorizontal: SideTab = CDockWidgetSideTab::Right; break;
case BorderVertical : SideTab = SideBarLocation::Bottom; break;
case BorderHorizontal: SideTab = SideBarLocation::Right; break;
// 4. Its in a corner
case BorderTopLeft : SideTab = HorizontalOrientation ? CDockWidgetSideTab::Top : CDockWidgetSideTab::Left; break;
case BorderTopRight : SideTab = HorizontalOrientation ? CDockWidgetSideTab::Top : CDockWidgetSideTab::Right; break;
case BorderBottomLeft : SideTab = HorizontalOrientation ? CDockWidgetSideTab::Bottom : CDockWidgetSideTab::Left; break;
case BorderBottomRight : SideTab = HorizontalOrientation ? CDockWidgetSideTab::Bottom : CDockWidgetSideTab::Right; break;
case BorderTopLeft : SideTab = HorizontalOrientation ? SideBarLocation::Top : SideBarLocation::Left; break;
case BorderTopRight : SideTab = HorizontalOrientation ? SideBarLocation::Top : SideBarLocation::Right; break;
case BorderBottomLeft : SideTab = HorizontalOrientation ? SideBarLocation::Bottom : SideBarLocation::Left; break;
case BorderBottomRight : SideTab = HorizontalOrientation ? SideBarLocation::Bottom : SideBarLocation::Right; break;
// 5 Ists touching only one border
case BorderLeft: SideTab = CDockWidgetSideTab::Left; break;
case BorderRight: SideTab = CDockWidgetSideTab::Right; break;
case BorderTop: SideTab = CDockWidgetSideTab::Top; break;
case BorderBottom: SideTab = CDockWidgetSideTab::Bottom; break;
case BorderLeft: SideTab = SideBarLocation::Left; break;
case BorderRight: SideTab = SideBarLocation::Right; break;
case BorderTop: SideTab = SideBarLocation::Top; break;
case BorderBottom: SideTab = SideBarLocation::Bottom; break;
}
return SideTab;
@ -2016,7 +2017,7 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
bool IsFloating = s.attributes().value("Floating").toInt();
ADS_PRINT("Restore CDockContainerWidget Floating" << IsFloating);
QWidget*NewRootSplitter {};
QWidget* NewRootSplitter {};
if (!Testing)
{
d->VisibleDockAreaCount = -1;// invalidate the dock area count
@ -2098,25 +2099,25 @@ void CDockContainerWidget::createRootSplitter()
void CDockContainerWidget::createSideTabBarWidgets()
{
{
auto Area = CDockWidgetSideTab::Left;
auto Area = SideBarLocation::Left;
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 0);
}
{
auto Area = CDockWidgetSideTab::Right;
auto Area = SideBarLocation::Right;
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
d->Layout->addWidget(d->SideTabBarWidgets[Area], 1, 2);
}
{
auto Area = CDockWidgetSideTab::Bottom;
auto Area = SideBarLocation::Bottom;
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
d->Layout->addWidget(d->SideTabBarWidgets[Area], 2, 1);
}
{
auto Area = CDockWidgetSideTab::Top;
auto Area = SideBarLocation::Top;
d->SideTabBarWidgets[Area] = new CSideTabBar(this, Area);
d->Layout->addWidget(d->SideTabBarWidgets[Area], 0, 1);
}
@ -2267,7 +2268,7 @@ void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea)
}
//============================================================================
CSideTabBar* CDockContainerWidget::sideTabBar(CDockWidgetSideTab::SideTabBarArea area) const
CSideTabBar* CDockContainerWidget::sideTabBar(SideBarLocation area) const
{
return d->SideTabBarWidgets[area];
}

View File

@ -100,7 +100,8 @@ 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
*/
CAutoHideDockContainer* createAndInitializeAutoHideDockWidgetContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder);
CAutoHideDockContainer* createAndInitializeAutoHideDockWidgetContainer(
SideBarLocation area, CDockWidget* DockWidget, CDockWidget::eAutoHideInsertOrder insertOrder);
/**
* Helper function for creation of the root splitter
@ -220,7 +221,7 @@ public:
/**
* Get's the auto hide dock side tab bar area based on the dock area widget position
*/
CDockWidgetSideTab::SideTabBarArea calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget);
SideBarLocation calculateSideTabBarArea(CDockAreaWidget* DockAreaWidget);
/**
* Removes dockwidget
@ -320,7 +321,7 @@ public:
/**
* Returns the side tab widget for the given area
*/
CSideTabBar* sideTabBar(CDockWidgetSideTab::SideTabBarArea area) const;
CSideTabBar* sideTabBar(SideBarLocation area) const;
/**

View File

@ -867,13 +867,15 @@ CDockAreaWidget* CDockManager::addDockWidgetToContainer(DockWidgetArea area,
}
//============================================================================
CAutoHideDockContainer* CDockManager::addAutoHideDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockWidget::eAutoHideInsertOrder insertOrder)
CAutoHideDockContainer* CDockManager::addAutoHideDockWidget(SideBarLocation area, CDockWidget* Dockwidget,
CDockWidget::eAutoHideInsertOrder insertOrder)
{
return addAutoHideDockWidgetToContainer(area, Dockwidget, this, insertOrder);
}
//============================================================================
CAutoHideDockContainer* CDockManager::addAutoHideDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eAutoHideInsertOrder insertOrder)
CAutoHideDockContainer* CDockManager::addAutoHideDockWidgetToContainer(SideBarLocation area, CDockWidget* Dockwidget,
CDockContainerWidget* DockContainerWidget, CDockWidget::eAutoHideInsertOrder insertOrder)
{
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
auto container = DockContainerWidget->createAndInitializeAutoHideDockWidgetContainer(area, Dockwidget, insertOrder);

View File

@ -340,14 +340,16 @@ public:
* An overlay widget is used for auto hide functionality
* \return Returns the CAutoHideDockContainer that contains the new DockWidget
*/
CAutoHideDockContainer* addAutoHideDockWidget(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockWidget::eAutoHideInsertOrder insertOrder = CDockWidget::Last);
CAutoHideDockContainer* addAutoHideDockWidget(SideBarLocation area, CDockWidget* Dockwidget,
CDockWidget::eAutoHideInsertOrder 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 CAutoHideDockContainer that contains the new DockWidget
*/
CAutoHideDockContainer* addAutoHideDockWidgetToContainer(CDockWidgetSideTab::SideTabBarArea area, CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eAutoHideInsertOrder = CDockWidget::Last);
CAutoHideDockContainer* addAutoHideDockWidgetToContainer(SideBarLocation area,
CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget, CDockWidget::eAutoHideInsertOrder = CDockWidget::Last);
/**
* This function will add the given Dockwidget to the given dock area as

View File

@ -344,6 +344,10 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
CDockWidget::~CDockWidget()
{
ADS_PRINT("~CDockWidget()");
if (d->SideTabWidget)
{
delete d->SideTabWidget;
}
delete d;
}

View File

@ -98,6 +98,7 @@ CDockWidgetSideTab::CDockWidgetSideTab(CDockWidget* DockWidget, QWidget* parent)
//============================================================================
CDockWidgetSideTab::~CDockWidgetSideTab()
{
qDebug() << "~CDockWidgetSideTab()";
delete d;
}
@ -111,7 +112,7 @@ void CDockWidgetSideTab::updateStyle()
//============================================================================
CDockWidgetSideTab::SideTabBarArea CDockWidgetSideTab::sideTabBarArea() const
SideBarLocation CDockWidgetSideTab::sideTabBarArea() const
{
auto dockAreaWidget = d->DockWidget->dockAreaWidget();
if (dockAreaWidget && dockAreaWidget->isAutoHide())
@ -141,7 +142,7 @@ Qt::Orientation CDockWidgetSideTab::orientation() const
//============================================================================
void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area)
void CDockWidgetSideTab::updateOrientationAndSpacing(SideBarLocation area)
{
setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical);

View File

@ -50,7 +50,7 @@ class ADS_EXPORT CDockWidgetSideTab : public CPushButton
{
Q_OBJECT
Q_PROPERTY(SideTabBarArea sideTabBarArea READ sideTabBarArea)
Q_PROPERTY(ads::SideBarLocation sideTabBarArea READ sideTabBarArea)
Q_PROPERTY(Qt::Orientation orientation READ orientation)
Q_PROPERTY(bool activeTab READ isActiveTab)
@ -71,18 +71,6 @@ protected:
public:
using Super = CPushButton;
/**
* Dock widget side tab bar locations
*/
enum SideTabBarArea
{
Top,
Left,
Right,
Bottom
};
Q_ENUM(SideTabBarArea)
/**
* Default Constructor
* param[in] DockWidget The dock widget this title bar belongs to
@ -103,7 +91,7 @@ public:
/**
* Getter for side tab bar area property
*/
SideTabBarArea sideTabBarArea() const;
SideBarLocation sideTabBarArea() const;
/**
* Set orientation vertical or horizontal
@ -118,7 +106,7 @@ public:
/**
* Update the orientation, visibility and spacing based on the area and the config
*/
void updateOrientationAndSpacing(SideTabBarArea area);
void updateOrientationAndSpacing(SideBarLocation area);
/**
* Returns true, if this is the active tab. The tab is active if the auto hide widget is visible

View File

@ -352,6 +352,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
//============================================================================
CDockWidgetTab::~CDockWidgetTab()
{
qDebug() << "~CDockWidgetTab " << text();
ADS_PRINT("~CDockWidgetTab()");
delete d;
}

View File

@ -721,6 +721,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget *DockWidget) :
//============================================================================
CFloatingDockContainer::~CFloatingDockContainer()
{
qDebug() << "~CFloatingDockContainer " << windowTitle();
ADS_PRINT("~CFloatingDockContainer");
if (d->DockManager)
{

View File

@ -297,7 +297,6 @@ bool CResizeHandle::isResizing() const
//============================================================================
void CResizeHandle::setMinResizeSize(int MinSize)
{
qDebug() << "CResizeHandle::setMinResizeSize " << MinSize;
d->MinSize = MinSize;
}
@ -305,7 +304,6 @@ void CResizeHandle::setMinResizeSize(int MinSize)
//============================================================================
void CResizeHandle::setMaxResizeSize(int MaxSize)
{
qDebug() << "CResizeHandle::setMaxResizeSize " << MaxSize;
d->MaxSize = MaxSize;
}

View File

@ -54,7 +54,7 @@ struct SideTabBarPrivate
CDockContainerWidget* ContainerWidget;
QBoxLayout* TabsLayout;
Qt::Orientation Orientation;
CDockWidgetSideTab::SideTabBarArea SideTabArea = CDockWidgetSideTab::Left;
SideBarLocation SideTabArea = SideBarLocation::Left;
/**
* Convenience function to check if this is a horizontal side bar
@ -73,13 +73,13 @@ SideTabBarPrivate::SideTabBarPrivate(CSideTabBar* _public) :
//============================================================================
CSideTabBar::CSideTabBar(CDockContainerWidget* parent, CDockWidgetSideTab::SideTabBarArea area) :
CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) :
Super(parent),
d(new SideTabBarPrivate(this))
{
d->SideTabArea = area;
d->ContainerWidget = parent;
d->Orientation = (area == CDockWidgetSideTab::Bottom || area == CDockWidgetSideTab::Top)
d->Orientation = (area == SideBarLocation::Bottom || area == SideBarLocation::Top)
? Qt::Horizontal : Qt::Vertical;
auto mainLayout = new QBoxLayout(d->Orientation == Qt::Vertical ? QBoxLayout::TopToBottom : QBoxLayout::LeftToRight);
@ -126,6 +126,7 @@ void CSideTabBar::insertSideTab(int Index, CDockWidgetSideTab* SideTab)
//============================================================================
void CSideTabBar::removeSideTab(CDockWidgetSideTab* SideTab)
{
qDebug() << "CSideTabBar::removeSideTab " << SideTab->text();
d->TabsLayout->removeWidget(SideTab);
if (d->TabsLayout->isEmpty())
{
@ -168,7 +169,7 @@ int CSideTabBar::tabCount() const
//============================================================================
CDockWidgetSideTab::SideTabBarArea CSideTabBar::sideTabBarArea() const
SideBarLocation CSideTabBar::sideTabBarArea() const
{
return d->SideTabArea;
}

View File

@ -45,7 +45,7 @@ class CDockWidgetSideTab;
class ADS_EXPORT CSideTabBar : public QFrame
{
Q_OBJECT
Q_PROPERTY(int sideTabBarArea READ sideTabBarArea)
Q_PROPERTY(ads::SideBarLocation sideTabBarArea READ sideTabBarArea)
Q_PROPERTY(Qt::Orientation orientation READ orientation)
private:
@ -62,7 +62,7 @@ public:
/**
* Default Constructor
*/
CSideTabBar(CDockContainerWidget* parent, CDockWidgetSideTab::SideTabBarArea area);
CSideTabBar(CDockContainerWidget* parent, SideBarLocation area);
/**
* Virtual Destructor
@ -97,7 +97,7 @@ public:
/**
* Getter for side tab bar area property
*/
CDockWidgetSideTab::SideTabBarArea sideTabBarArea() const;
SideBarLocation sideTabBarArea() const;
Q_SIGNALS:
void sideTabAutoHideToggleRequested();

View File

@ -69,6 +69,7 @@ QT_FORWARD_DECLARE_CLASS(QSplitter)
namespace ads
{
Q_NAMESPACE
class CDockSplitter;
enum DockWidgetArea
@ -130,6 +131,19 @@ enum eBitwiseOperator
};
/**
* Each dock container supports 4 sidbars
*/
enum SideBarLocation
{
Top,
Left,
Right,
Bottom
};
Q_ENUMS(SideBarLocation);
namespace internal
{
static const bool RestoreTesting = true;