mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Improved sizing of AutoHideWidgets when dragging between side bars
This commit is contained in:
parent
7140e5e32a
commit
e239cdb354
@ -117,7 +117,7 @@ struct AutoHideDockContainerPrivate
|
|||||||
CResizeHandle* ResizeHandle = nullptr;
|
CResizeHandle* ResizeHandle = nullptr;
|
||||||
QSize Size; // creates invalid size
|
QSize Size; // creates invalid size
|
||||||
QPointer<CAutoHideTab> SideTab;
|
QPointer<CAutoHideTab> SideTab;
|
||||||
QSize InitialDockWidgetSize;
|
QSize SizeCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@ -216,7 +216,7 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarL
|
|||||||
bool OpaqueResize = CDockManager::testConfigFlag(CDockManager::OpaqueSplitterResize);
|
bool OpaqueResize = CDockManager::testConfigFlag(CDockManager::OpaqueSplitterResize);
|
||||||
d->ResizeHandle->setOpaqueResize(OpaqueResize);
|
d->ResizeHandle->setOpaqueResize(OpaqueResize);
|
||||||
d->Size = d->DockArea->size();
|
d->Size = d->DockArea->size();
|
||||||
d->InitialDockWidgetSize = DockWidget->size();
|
d->SizeCache = DockWidget->size();
|
||||||
|
|
||||||
addDockWidget(DockWidget);
|
addDockWidget(DockWidget);
|
||||||
parent->registerAutoHideWidget(this);
|
parent->registerAutoHideWidget(this);
|
||||||
@ -239,12 +239,6 @@ void CAutoHideDockContainer::updateSize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto rect = dockContainerParent->contentRect();
|
auto rect = dockContainerParent->contentRect();
|
||||||
qDebug() << "dockContainerParent->contentRect() " << rect;
|
|
||||||
qDebug() << "dockWidget()->rect()" << dockWidget()->rect();
|
|
||||||
qDebug() << "dockAreaWidget()->rect(): " << dockAreaWidget()->rect();
|
|
||||||
qDebug() << "CAutoHideDockContainer::isVisible " << this->isVisible();
|
|
||||||
qDebug() << "CAutoHideDockContainer::rect " << this->rect();
|
|
||||||
|
|
||||||
switch (sideBarLocation())
|
switch (sideBarLocation())
|
||||||
{
|
{
|
||||||
case SideBarLocation::SideBarTop:
|
case SideBarLocation::SideBarTop:
|
||||||
@ -279,8 +273,14 @@ void CAutoHideDockContainer::updateSize()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "CAutoHideDockContainer::rect (after): " << this->rect();
|
if (orientation() == Qt::Horizontal)
|
||||||
qDebug() << "dockAreaWidget()->rect(): " << dockAreaWidget()->rect();
|
{
|
||||||
|
d->SizeCache.setHeight(this->height());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d->SizeCache.setWidth(this->width());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -658,31 +658,24 @@ bool CAutoHideDockContainer::event(QEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
|
||||||
QSize CAutoHideDockContainer::initialDockWidgetSize() const
|
|
||||||
{
|
|
||||||
return d->InitialDockWidgetSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
Qt::Orientation CAutoHideDockContainer::orientation() const
|
Qt::Orientation CAutoHideDockContainer::orientation() const
|
||||||
{
|
{
|
||||||
return autoHideSideBar()->orientation();
|
return ads::internal::isHorizontalSideBarLocation(d->SideTabBarArea)
|
||||||
|
? Qt::Horizontal : Qt::Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CAutoHideDockContainer::resetToInitialDockWidgetSize()
|
void CAutoHideDockContainer::resetToInitialDockWidgetSize()
|
||||||
{
|
{
|
||||||
auto OriginalSize = initialDockWidgetSize();
|
|
||||||
if (orientation() == Qt::Horizontal)
|
if (orientation() == Qt::Horizontal)
|
||||||
{
|
{
|
||||||
setSize(OriginalSize.height());
|
setSize(d->SizeCache.height());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setSize(OriginalSize.width());
|
setSize(d->SizeCache.width());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,8 +684,6 @@ void CAutoHideDockContainer::resetToInitialDockWidgetSize()
|
|||||||
void CAutoHideDockContainer::moveToNewSideBarLocation(SideBarLocation NewSideBarLocation,
|
void CAutoHideDockContainer::moveToNewSideBarLocation(SideBarLocation NewSideBarLocation,
|
||||||
int TabIndex)
|
int TabIndex)
|
||||||
{
|
{
|
||||||
qDebug() << "CAutoHideDockContainer::moveToNewSideBarLocation TabIndex " <<
|
|
||||||
TabIndex << " this->tabIndex: " << this->tabIndex();
|
|
||||||
if (NewSideBarLocation == sideBarLocation() && TabIndex == this->tabIndex())
|
if (NewSideBarLocation == sideBarLocation() && TabIndex == this->tabIndex())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -172,12 +172,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSize(int Size);
|
void setSize(int Size);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the original size of the dock widget at the time it has been
|
|
||||||
* added to this auto hide widget
|
|
||||||
*/
|
|
||||||
QSize initialDockWidgetSize() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the with or hight to the initial dock widget size dependinng on
|
* Resets the with or hight to the initial dock widget size dependinng on
|
||||||
* the orientation.
|
* the orientation.
|
||||||
|
Loading…
Reference in New Issue
Block a user