Some changes for debugging visibility changed stuff

This commit is contained in:
Uwe Kindler 2020-01-15 07:49:22 +01:00
parent 03bd4a4505
commit 29ebc83b35
2 changed files with 10 additions and 14 deletions

View File

@ -546,17 +546,19 @@ void CDockAreaWidget::internalSetCurrentDockWidget(CDockWidget* DockWidget)
void CDockAreaWidget::setCurrentIndex(int index) void CDockAreaWidget::setCurrentIndex(int index)
{ {
auto TabBar = d->tabBar(); auto TabBar = d->tabBar();
/*if (TabBar->currentIndex() == index)
{
return;
}*/
if (index < 0 || index > (TabBar->count() - 1)) if (index < 0 || index > (TabBar->count() - 1))
{ {
qWarning() << Q_FUNC_INFO << "Invalid index" << index; qWarning() << Q_FUNC_INFO << "Invalid index" << index;
return; return;
} }
auto cw = d->ContentsLayout->currentWidget();
auto nw = d->ContentsLayout->widget(index);
if (cw == nw && !nw->isHidden())
{
return;
}
emit currentChanging(index); emit currentChanging(index);
TabBar->setCurrentIndex(index); TabBar->setCurrentIndex(index);
d->ContentsLayout->setCurrentIndex(index); d->ContentsLayout->setCurrentIndex(index);

View File

@ -134,8 +134,8 @@ void DockWidgetPrivate::showDockWidget()
} }
else else
{ {
DockArea->toggleView(true);
DockArea->setCurrentDockWidget(_this); DockArea->setCurrentDockWidget(_this);
DockArea->toggleView(true);
TabWidget->show(); TabWidget->show();
QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea); QSplitter* Splitter = internal::findParent<QSplitter*>(DockArea);
while (Splitter && !Splitter->isVisible()) while (Splitter && !Splitter->isVisible())
@ -525,20 +525,14 @@ bool CDockWidget::event(QEvent *e)
switch (e->type()) switch (e->type())
{ {
case QEvent::Hide: case QEvent::Hide:
std::cout << this->objectName().toStdString() << " visible: " << isVisible()
<< " hidden: " << isHidden() << " visibleTo: " << isVisibleTo(d->DockManager) << std::endl;
emit visibilityChanged(false); emit visibilityChanged(false);
break; break;
case QEvent::Show: case QEvent::Show:
{ {
QPoint parentTopLeft(0, 0); QPoint parentTopLeft(0, 0);
if (isWindow())
{
if (const QWindow *window = windowHandle())
parentTopLeft = window->screen()->availableVirtualGeometry().topLeft();
else
parentTopLeft = QGuiApplication::primaryScreen()->availableVirtualGeometry().topLeft();
std::cout << "QEvent::Show isWindow()" << std::endl;
}
emit visibilityChanged(geometry().right() >= parentTopLeft.x() && geometry().bottom() >= parentTopLeft.y()); emit visibilityChanged(geometry().right() >= parentTopLeft.x() && geometry().bottom() >= parentTopLeft.y());
} }
break; break;