mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Added parentSplitter() fucntion to DockArea and removed dead code from DockContainerWidget
This commit is contained in:
parent
761bfc50d6
commit
68f1084bf0
@ -464,6 +464,13 @@ CAutoHideDockContainer* CDockAreaWidget::autoHideDockContainer() const
|
|||||||
return d->AutoHideDockContainer;
|
return d->AutoHideDockContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
CDockSplitter* CDockAreaWidget::parentSplitter() const
|
||||||
|
{
|
||||||
|
return internal::findParent<CDockSplitter*>(this);
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CDockAreaWidget::isAutoHide() const
|
bool CDockAreaWidget::isAutoHide() const
|
||||||
{
|
{
|
||||||
@ -600,7 +607,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
this->toggleView(false);
|
this->toggleView(false);
|
||||||
|
|
||||||
// Hide empty parent splitters
|
// Hide empty parent splitters
|
||||||
auto Splitter = internal::findParent<CDockSplitter*>(this);
|
auto Splitter = parentSplitter();
|
||||||
internal::hideEmptyParentSplitters(Splitter);
|
internal::hideEmptyParentSplitters(Splitter);
|
||||||
|
|
||||||
//Hide empty floating widget
|
//Hide empty floating widget
|
||||||
|
@ -47,6 +47,7 @@ class CDockContainerWidget;
|
|||||||
class DockContainerWidgetPrivate;
|
class DockContainerWidgetPrivate;
|
||||||
class CDockAreaTitleBar;
|
class CDockAreaTitleBar;
|
||||||
class CDockingStateReader;
|
class CDockingStateReader;
|
||||||
|
class CDockSplitter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,6 +217,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
CAutoHideDockContainer* autoHideDockContainer() const;
|
CAutoHideDockContainer* autoHideDockContainer() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the parent splitter that contains this dock area
|
||||||
|
*/
|
||||||
|
CDockSplitter* parentSplitter() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the dock area is in an auto hide container
|
* Returns true if the dock area is in an auto hide container
|
||||||
*/
|
*/
|
||||||
|
@ -587,16 +587,7 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
|
|||||||
auto InsertParam = internal::dockAreaInsertParameters(area);
|
auto InsertParam = internal::dockAreaInsertParameters(area);
|
||||||
auto NewDockAreas = FloatingContainer->findChildren<CDockAreaWidget*>(
|
auto NewDockAreas = FloatingContainer->findChildren<CDockAreaWidget*>(
|
||||||
QString(), Qt::FindChildrenRecursively);
|
QString(), Qt::FindChildrenRecursively);
|
||||||
QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetArea);
|
auto TargetAreaSplitter = TargetArea->parentSplitter();
|
||||||
|
|
||||||
if (!TargetAreaSplitter)
|
|
||||||
{
|
|
||||||
QSplitter* Splitter = newSplitter(InsertParam.orientation());
|
|
||||||
Layout->replaceWidget(TargetArea, Splitter);
|
|
||||||
Splitter->addWidget(TargetArea);
|
|
||||||
updateSplitterHandles(Splitter);
|
|
||||||
TargetAreaSplitter = Splitter;
|
|
||||||
}
|
|
||||||
int AreaIndex = TargetAreaSplitter->indexOf(TargetArea);
|
int AreaIndex = TargetAreaSplitter->indexOf(TargetArea);
|
||||||
auto FloatingSplitter = FloatingContainer->rootSplitter();
|
auto FloatingSplitter = FloatingContainer->rootSplitter();
|
||||||
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
||||||
@ -742,7 +733,7 @@ void DockContainerWidgetPrivate::moveToNewSection(QWidget* Widget, CDockAreaWidg
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto InsertParam = internal::dockAreaInsertParameters(area);
|
auto InsertParam = internal::dockAreaInsertParameters(area);
|
||||||
QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetArea);
|
auto TargetAreaSplitter = TargetArea->parentSplitter();
|
||||||
int AreaIndex = TargetAreaSplitter->indexOf(TargetArea);
|
int AreaIndex = TargetAreaSplitter->indexOf(TargetArea);
|
||||||
auto Sizes = TargetAreaSplitter->sizes();
|
auto Sizes = TargetAreaSplitter->sizes();
|
||||||
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
||||||
@ -877,7 +868,7 @@ void DockContainerWidgetPrivate::moveToContainer(QWidget* Widget, DockWidgetArea
|
|||||||
// it already has and do nothing, if it is the same place. It would
|
// it already has and do nothing, if it is the same place. It would
|
||||||
// also work without this check, but it looks nicer with the check
|
// also work without this check, but it looks nicer with the check
|
||||||
// because there will be no layout updates
|
// because there will be no layout updates
|
||||||
auto Splitter = internal::findParent<CDockSplitter*>(DroppedDockArea);
|
auto Splitter = DroppedDockArea->parentSplitter();
|
||||||
auto InsertParam = internal::dockAreaInsertParameters(area);
|
auto InsertParam = internal::dockAreaInsertParameters(area);
|
||||||
if (Splitter == RootSplitter && InsertParam.orientation() == Splitter->orientation())
|
if (Splitter == RootSplitter && InsertParam.orientation() == Splitter->orientation())
|
||||||
{
|
{
|
||||||
@ -1364,7 +1355,7 @@ CDockAreaWidget* DockContainerWidgetPrivate::addDockWidgetToDockArea(DockWidgetA
|
|||||||
NewDockArea->addDockWidget(Dockwidget);
|
NewDockArea->addDockWidget(Dockwidget);
|
||||||
auto InsertParam = internal::dockAreaInsertParameters(area);
|
auto InsertParam = internal::dockAreaInsertParameters(area);
|
||||||
|
|
||||||
QSplitter* TargetAreaSplitter = internal::findParent<QSplitter*>(TargetDockArea);
|
auto TargetAreaSplitter = TargetDockArea->parentSplitter();
|
||||||
int index = TargetAreaSplitter ->indexOf(TargetDockArea);
|
int index = TargetAreaSplitter ->indexOf(TargetDockArea);
|
||||||
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
||||||
{
|
{
|
||||||
@ -1381,7 +1372,7 @@ CDockAreaWidget* DockContainerWidgetPrivate::addDockWidgetToDockArea(DockWidgetA
|
|||||||
{
|
{
|
||||||
ADS_PRINT("TargetAreaSplitter->orientation() != InsertParam.orientation()");
|
ADS_PRINT("TargetAreaSplitter->orientation() != InsertParam.orientation()");
|
||||||
auto TargetAreaSizes = TargetAreaSplitter->sizes();
|
auto TargetAreaSizes = TargetAreaSplitter->sizes();
|
||||||
QSplitter* NewSplitter = newSplitter(InsertParam.orientation());
|
auto NewSplitter = newSplitter(InsertParam.orientation());
|
||||||
NewSplitter->addWidget(TargetDockArea);
|
NewSplitter->addWidget(TargetDockArea);
|
||||||
|
|
||||||
insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append());
|
insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append());
|
||||||
@ -1572,7 +1563,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
|
|||||||
|
|
||||||
area->disconnect(this);
|
area->disconnect(this);
|
||||||
d->DockAreas.removeAll(area);
|
d->DockAreas.removeAll(area);
|
||||||
CDockSplitter* Splitter = internal::findParent<CDockSplitter*>(area);
|
auto Splitter = area->parentSplitter();
|
||||||
|
|
||||||
// Remove are from parent splitter and recursively hide tree of parent
|
// Remove are from parent splitter and recursively hide tree of parent
|
||||||
// splitters if it has no visible content
|
// splitters if it has no visible content
|
||||||
@ -1943,7 +1934,7 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
|
|||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
QSplitter* CDockContainerWidget::rootSplitter() const
|
CDockSplitter* CDockContainerWidget::rootSplitter() const
|
||||||
{
|
{
|
||||||
return d->RootSplitter;
|
return d->RootSplitter;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ struct FloatingDragPreviewPrivate;
|
|||||||
class CDockingStateReader;
|
class CDockingStateReader;
|
||||||
class CAutoHideSideBar;
|
class CAutoHideSideBar;
|
||||||
class CAutoHideTab;
|
class CAutoHideTab;
|
||||||
|
class CDockSplitter;
|
||||||
struct AutoHideTabPrivate;
|
struct AutoHideTabPrivate;
|
||||||
struct AutoHideDockContainerPrivate;
|
struct AutoHideDockContainerPrivate;
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Access function for the internal root splitter
|
* Access function for the internal root splitter
|
||||||
*/
|
*/
|
||||||
QSplitter* rootSplitter() const;
|
CDockSplitter* rootSplitter() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and initializes a dockwidget auto hide container into the given area.
|
* Creates and initializes a dockwidget auto hide container into the given area.
|
||||||
|
@ -1318,7 +1318,7 @@ QList<int> CDockManager::splitterSizes(CDockAreaWidget *ContainedArea) const
|
|||||||
{
|
{
|
||||||
if (ContainedArea)
|
if (ContainedArea)
|
||||||
{
|
{
|
||||||
auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea);
|
auto Splitter = ContainedArea->parentSplitter();
|
||||||
if (Splitter)
|
if (Splitter)
|
||||||
{
|
{
|
||||||
return Splitter->sizes();
|
return Splitter->sizes();
|
||||||
@ -1335,7 +1335,7 @@ void CDockManager::setSplitterSizes(CDockAreaWidget *ContainedArea, const QList<
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Splitter = internal::findParent<CDockSplitter*>(ContainedArea);
|
auto Splitter = ContainedArea->parentSplitter();
|
||||||
if (Splitter && Splitter->count() == sizes.count())
|
if (Splitter && Splitter->count() == sizes.count())
|
||||||
{
|
{
|
||||||
Splitter->setSizes(sizes);
|
Splitter->setSizes(sizes);
|
||||||
|
@ -184,11 +184,11 @@ void DockWidgetPrivate::showDockWidget()
|
|||||||
DockArea->setCurrentDockWidget(_this);
|
DockArea->setCurrentDockWidget(_this);
|
||||||
DockArea->toggleView(true);
|
DockArea->toggleView(true);
|
||||||
TabWidget->show();
|
TabWidget->show();
|
||||||
QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea);
|
auto Splitter = DockArea->parentSplitter();
|
||||||
while (Splitter && !Splitter->isVisible() && !DockArea->isAutoHide())
|
while (Splitter && !Splitter->isVisible() && !DockArea->isAutoHide())
|
||||||
{
|
{
|
||||||
Splitter->show();
|
Splitter->show();
|
||||||
Splitter = internal::findParent<QSplitter*>(Splitter);
|
Splitter = internal::findParent<CDockSplitter*>(Splitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDockContainerWidget* Container = DockArea->dockContainer();
|
CDockContainerWidget* Container = DockArea->dockContainer();
|
||||||
|
@ -268,7 +268,7 @@ T findParent(const QWidget* w)
|
|||||||
}
|
}
|
||||||
parentWidget = parentWidget->parentWidget();
|
parentWidget = parentWidget->parentWidget();
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user