File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -546,17 +546,19 @@ void CDockAreaWidget::internalSetCurrentDockWidget(CDockWidget* DockWidget)
546546void CDockAreaWidget::setCurrentIndex (int index)
547547{
548548 auto TabBar = d->tabBar ();
549- /* if (TabBar->currentIndex() == index)
550- {
551- return;
552- }*/
553-
554549 if (index < 0 || index > (TabBar->count () - 1 ))
555550 {
556551 qWarning () << Q_FUNC_INFO << " Invalid index" << index;
557552 return ;
558553 }
559554
555+ auto cw = d->ContentsLayout ->currentWidget ();
556+ auto nw = d->ContentsLayout ->widget (index);
557+ if (cw == nw && !nw->isHidden ())
558+ {
559+ return ;
560+ }
561+
560562 emit currentChanging (index);
561563 TabBar->setCurrentIndex (index);
562564 d->ContentsLayout ->setCurrentIndex (index);
Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ void DockWidgetPrivate::showDockWidget()
134134 }
135135 else
136136 {
137- DockArea->toggleView (true );
138137 DockArea->setCurrentDockWidget (_this);
138+ DockArea->toggleView (true );
139139 TabWidget->show ();
140140 QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea);
141141 while (Splitter && !Splitter->isVisible ())
@@ -525,20 +525,14 @@ bool CDockWidget::event(QEvent *e)
525525 switch (e->type ())
526526 {
527527 case QEvent::Hide:
528+ std::cout << this ->objectName ().toStdString () << " visible: " << isVisible ()
529+ << " hidden: " << isHidden () << " visibleTo: " << isVisibleTo (d->DockManager ) << std::endl;
528530 emit visibilityChanged (false );
529531 break ;
530532
531533 case QEvent::Show:
532534 {
533535 QPoint parentTopLeft (0 , 0 );
534- if (isWindow ())
535- {
536- if (const QWindow *window = windowHandle ())
537- parentTopLeft = window->screen ()->availableVirtualGeometry ().topLeft ();
538- else
539- parentTopLeft = QGuiApplication::primaryScreen ()->availableVirtualGeometry ().topLeft ();
540- std::cout << " QEvent::Show isWindow()" << std::endl;
541- }
542536 emit visibilityChanged (geometry ().right () >= parentTopLeft.x () && geometry ().bottom () >= parentTopLeft.y ());
543537 }
544538 break ;
You can’t perform that action at this time.
0 commit comments