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)
546
546
void CDockAreaWidget::setCurrentIndex (int index)
547
547
{
548
548
auto TabBar = d->tabBar ();
549
- /* if (TabBar->currentIndex() == index)
550
- {
551
- return;
552
- }*/
553
-
554
549
if (index < 0 || index > (TabBar->count () - 1 ))
555
550
{
556
551
qWarning () << Q_FUNC_INFO << " Invalid index" << index;
557
552
return ;
558
553
}
559
554
555
+ auto cw = d->ContentsLayout ->currentWidget ();
556
+ auto nw = d->ContentsLayout ->widget (index);
557
+ if (cw == nw && !nw->isHidden ())
558
+ {
559
+ return ;
560
+ }
561
+
560
562
emit currentChanging (index);
561
563
TabBar->setCurrentIndex (index);
562
564
d->ContentsLayout ->setCurrentIndex (index);
Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ void DockWidgetPrivate::showDockWidget()
134
134
}
135
135
else
136
136
{
137
- DockArea->toggleView (true );
138
137
DockArea->setCurrentDockWidget (_this);
138
+ DockArea->toggleView (true );
139
139
TabWidget->show ();
140
140
QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea);
141
141
while (Splitter && !Splitter->isVisible ())
@@ -525,20 +525,14 @@ bool CDockWidget::event(QEvent *e)
525
525
switch (e->type ())
526
526
{
527
527
case QEvent::Hide:
528
+ std::cout << this ->objectName ().toStdString () << " visible: " << isVisible ()
529
+ << " hidden: " << isHidden () << " visibleTo: " << isVisibleTo (d->DockManager ) << std::endl;
528
530
emit visibilityChanged (false );
529
531
break ;
530
532
531
533
case QEvent::Show:
532
534
{
533
535
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
- }
542
536
emit visibilityChanged (geometry ().right () >= parentTopLeft.x () && geometry ().bottom () >= parentTopLeft.y ());
543
537
}
544
538
break ;
You can’t perform that action at this time.
0 commit comments