@@ -131,7 +131,7 @@ void DockWidgetPrivate::capturedState()
131131// ============================================================================
132132void DockWidgetPrivate::showDockWidget ()
133133{
134- if (!CapturedState.DockContainer )
134+ /* if (!CapturedState.DockContainer)
135135 {
136136 auto FloatingWidget = new CFloatingDockContainer(_this);
137137 FloatingWidget->setGeometry(CapturedState.GlobalGeometry);
@@ -151,6 +151,16 @@ void DockWidgetPrivate::showDockWidget()
151151 for (const auto& TreeItem : DockTree)
152152 {
153153
154+ }*/
155+
156+ std::cout << " DockWidgetPrivate::showDockWidget()" << std::endl;
157+ _this->show ();
158+ DockArea->show ();
159+
160+ QSplitter* Splitter = internal::findParent<QSplitter*>(_this);
161+ if (Splitter)
162+ {
163+ Splitter->show ();
154164 }
155165}
156166
@@ -270,7 +280,7 @@ QAction* CDockWidget::toggleViewAction() const
270280// ============================================================================
271281void CDockWidget::toggleView (bool Open)
272282{
273- if ((d->DockArea != nullptr ) == Open)
283+ /* if ((d->DockArea != nullptr) == Open)
274284 {
275285 return;
276286 }
@@ -280,9 +290,18 @@ void CDockWidget::toggleView(bool Open)
280290 hideDockWidget(true);
281291 }
282292 else if (Open && !d->DockArea)
293+ {
294+ d->showDockWidget();
295+ }*/
296+
297+ if (Open)
283298 {
284299 d->showDockWidget ();
285300 }
301+ else
302+ {
303+ hideDockWidget (true );
304+ }
286305}
287306
288307
@@ -298,7 +317,7 @@ void CDockWidget::setDockArea(CDockAreaWidget* DockArea)
298317// ============================================================================
299318void CDockWidget::hideDockWidget (bool RemoveFromDockArea)
300319{
301- d->capturedState ();
320+ /* d->capturedState();
302321 if (d->DockArea && RemoveFromDockArea)
303322 {
304323 d->DockArea->removeDockWidget(this);
@@ -307,7 +326,48 @@ void CDockWidget::hideDockWidget(bool RemoveFromDockArea)
307326 this->setDockArea(nullptr);
308327 // Remove title from dock area widget to prevent its deletion if dock
309328 // area is deleted
310- d->TitleWidget ->setParent (this );
329+ d->TitleWidget->setParent(this);*/
330+
331+ std::cout << " CDockWidget::hideDockWidget" << std::endl;
332+ this ->hide ();
333+ d->ToggleViewAction ->setChecked (false );
334+ d->TitleWidget ->hide ();
335+ CDockAreaWidget* DockArea = d->DockArea ;
336+ for (int i = 0 ; i < DockArea->count (); ++i)
337+ {
338+ if (DockArea->dockWidget (i)->isVisible ())
339+ {
340+ return ;
341+ }
342+ }
343+
344+ if (DockArea->count () > 1 )
345+ {
346+ if (DockArea->currentIndex () == (DockArea->count () - 1 ))
347+ {
348+ DockArea->setCurrentIndex (DockArea->currentIndex () - 1 );
349+ }
350+ else
351+ {
352+ DockArea->setCurrentIndex (DockArea->currentIndex () + 1 );
353+ }
354+ }
355+ QSplitter* Splitter = internal::findParent<QSplitter*>(this );
356+ if (!Splitter)
357+ {
358+ return ;
359+ }
360+
361+ std::cout << " DockWidgets " << Splitter->count () << std::endl;
362+ for (int i = 0 ; i < Splitter->count (); ++i)
363+ {
364+ if (Splitter->widget (i)->isVisible ())
365+ {
366+ return ;
367+ }
368+ }
369+
370+ Splitter->hide ();
311371}
312372
313373} // namespace ads
0 commit comments