mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-12 16:20:25 +08:00
Some changes for debugging visibility changed stuff
This commit is contained in:
parent
03bd4a4505
commit
29ebc83b35
@ -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);
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user