mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
Fixed bug in AutoHidedockContainer that causes warnings and resizing issues
The bug caused ""setGeometry: Unable to set geometry XxY+Width+Height on QWidgetWindow/'WidgetClassWindow" warnings for OpenGL and QAxWidgets and causes resizing issues for AutoHideDockContainers that contained theses widgets
This commit is contained in:
parent
8e7b7f536e
commit
d010fe7a95
@ -493,7 +493,6 @@ void MainWindowPrivate::createContent()
|
||||
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(), RighDockArea);
|
||||
auto LabelDockWidget = createLongTextLabelDockWidget();
|
||||
std::cout << "DockWidget " << LabelDockWidget->objectName().toStdString() << std::endl;
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, LabelDockWidget, BottomDockArea);
|
||||
|
||||
// Tests CustomCloseHandling without DeleteOnClose
|
||||
@ -528,13 +527,7 @@ void MainWindowPrivate::createContent()
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
// ActiveX widget only works without OpaqueUndocking and without
|
||||
// auto hide feature
|
||||
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking)
|
||||
&& !ads::CDockManager::testAutoHideConfigFlag(ads::CDockManager::AutoHideFeatureEnabled))
|
||||
{
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
||||
}
|
||||
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -679,7 +672,7 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
||||
|
||||
// uncomment the following line if you want to use opaque undocking and
|
||||
// opaque splitter resizing
|
||||
// CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
|
||||
//CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig);
|
||||
|
||||
// uncomment the following line if you want a fixed tab width that does
|
||||
// not change if the visibility of the close button changes
|
||||
@ -853,16 +846,13 @@ void CMainWindow::createEditor()
|
||||
ads::CDockAreaWidget* EditorArea = d->LastDockedEditor ? d->LastDockedEditor->dockAreaWidget() : nullptr;
|
||||
if (EditorArea)
|
||||
{
|
||||
std::cout << "DockAreaCount before: " << EditorArea->dockContainer()->dockAreaCount() << std::endl;
|
||||
d->DockManager->setConfigFlag(ads::CDockManager::EqualSplitOnInsertion, true);
|
||||
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, EditorArea);
|
||||
std::cout << "DockAreaCount after: " << DockWidget->dockContainer()->dockAreaCount() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->LastCreatedFloatingEditor)
|
||||
{
|
||||
std::cout << "LastCreated" << std::endl;
|
||||
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, d->LastCreatedFloatingEditor->dockAreaWidget());
|
||||
}
|
||||
else
|
||||
|
@ -201,15 +201,15 @@ CDockContainerWidget* CAutoHideDockContainer::dockContainer() const
|
||||
|
||||
|
||||
//============================================================================
|
||||
CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBarLocation area, CDockContainerWidget* parent) :
|
||||
Super(parent),
|
||||
CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area, CDockContainerWidget* parent) :
|
||||
Super(parent),
|
||||
d(new AutoHideDockContainerPrivate(this))
|
||||
{
|
||||
hide(); // auto hide dock container is initially always hidden
|
||||
d->SideTabBarArea = area;
|
||||
d->SideTab = componentsFactory()->createDockWidgetSideTab(nullptr);
|
||||
connect(d->SideTab, &CAutoHideTab::pressed, this, &CAutoHideDockContainer::toggleCollapseState);
|
||||
d->DockArea = new CDockAreaWidget(DockManager, parent);
|
||||
d->DockArea = new CDockAreaWidget(DockWidget->dockManager(), parent);
|
||||
d->DockArea->setObjectName("autoHideDockArea");
|
||||
d->DockArea->setAutoHideDockContainer(this);
|
||||
|
||||
@ -219,7 +219,6 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa
|
||||
d->Layout->setContentsMargins(0, 0, 0, 0);
|
||||
d->Layout->setSpacing(0);
|
||||
setLayout(d->Layout);
|
||||
d->Layout->addWidget(d->DockArea);
|
||||
d->ResizeHandle = new CResizeHandle(edgeFromSideTabBarArea(area), this);
|
||||
d->ResizeHandle->setMinResizeSize(64);
|
||||
bool OpaqueResize = CDockManager::testConfigFlag(CDockManager::OpaqueSplitterResize);
|
||||
@ -227,17 +226,13 @@ CAutoHideDockContainer::CAutoHideDockContainer(CDockManager* DockManager, SideBa
|
||||
d->Layout->insertWidget(resizeHandleLayoutPosition(area), d->ResizeHandle);
|
||||
d->Size = d->DockArea->size();
|
||||
|
||||
updateSize();
|
||||
parent->registerAutoHideWidget(this);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CAutoHideDockContainer::CAutoHideDockContainer(CDockWidget* DockWidget, SideBarLocation area, CDockContainerWidget* parent) :
|
||||
CAutoHideDockContainer(DockWidget->dockManager(), area, parent)
|
||||
{
|
||||
addDockWidget(DockWidget);
|
||||
hide();
|
||||
parent->registerAutoHideWidget(this);
|
||||
// The dock area should not be added to the layout before it contains the
|
||||
// dock widget. If you add it to the layout before it contains the dock widget
|
||||
// then you will likely see this warning for OpenGL widgets or QAxWidgets:
|
||||
// setGeometry: Unable to set geometry XxY+Width+Height on QWidgetWindow/'WidgetClassWindow
|
||||
d->Layout->addWidget(d->DockArea);
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,11 +79,6 @@ protected:
|
||||
|
||||
public:
|
||||
using Super = QFrame;
|
||||
/**
|
||||
* Create Auto Hide widget with a dock manager
|
||||
*/
|
||||
CAutoHideDockContainer(CDockManager* DockManager, SideBarLocation area,
|
||||
CDockContainerWidget* parent);
|
||||
|
||||
/**
|
||||
* Create Auto Hide widget with the given dock widget
|
||||
|
Loading…
Reference in New Issue
Block a user