add set size to allow the user to set a size for the pinned widget manually

This commit is contained in:
Syarif Fakhri 2022-10-28 14:20:30 +08:00
parent 85da93c2fe
commit c2bd56e2e9
3 changed files with 16 additions and 18 deletions

View File

@ -322,7 +322,7 @@ CDockAreaWidget* CAutoHideDockContainer::dockAreaWidget() const
void CAutoHideDockContainer::moveContentsToParent()
{
cleanupAndDelete();
// If we unpin the auto hide tock widget, then we insert it into the same
// If we unpin the auto hide dock widget, then we insert it into the same
// location like it had as a auto hide widget. This brings the least surprise
// to the user and he does not have to search where the widget was inserted.
parentContainer()->addDockWidget(d->getDockWidgetArea(d->SideTabBarArea), d->DockWidget);
@ -439,6 +439,12 @@ void CAutoHideDockContainer::toggleCollapseState()
collapseView(isVisible());
}
void CAutoHideDockContainer::setSize(int width, int height)
{
d->Size = QSize(width, height);
updateSize();
}
//============================================================================
bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
@ -511,7 +517,7 @@ void CAutoHideDockContainer::resizeEvent(QResizeEvent* event)
Super::resizeEvent(event);
if (d->ResizeHandle->isResizing())
{
d->Size = this->size();
d->Size = this->size();
d->updateResizeHandleSizeLimitMax();
}
}

View File

@ -97,7 +97,7 @@ public:
*/
void addDockWidget(CDockWidget* DockWidget);
/**
/**
* Returns the side tab bar area of this Auto Hide dock container
*/
SideBarLocation sideTabBarArea() const;
@ -144,6 +144,13 @@ public:
* Toggles the current collapse state
*/
void toggleCollapseState();
/**
* Use this instead of resize. This will ensure the size is consistent internally.
* E.g. If you set a height less than the parent height when it's vertical
* It will simply be rescaled to the parent height while the width will be resized
*/
void setSize(int width, int height);
};
}

View File

@ -95,7 +95,6 @@ struct DockWidgetPrivate
QList<QAction*> TitleBarActions;
CDockWidget::eMinimumSizeHintMode MinimumSizeHintMode = CDockWidget::MinimumSizeHintFromDockWidget;
WidgetFactory* Factory = nullptr;
double DefaultAutoHideDockProportion = 0.25;
CDockWidget::eAutoHideInsertOrder AutoHideInsertOrder = CDockWidget::Last;
/**
@ -1131,20 +1130,6 @@ bool CDockWidget::isCurrentTab() const
}
//============================================================================
void CDockWidget::setDefaultAutoHideDockProportion(float Proportion)
{
d->DefaultAutoHideDockProportion = Proportion;
}
//============================================================================
float CDockWidget::DefaultAutoHideDockProportion() const
{
return d->DefaultAutoHideDockProportion;
}
//============================================================================
void CDockWidget::setAutoHideInsertOrder(eAutoHideInsertOrder insertOrder)
{