From 6331ded27b98c14295f7e7367b321e97366ad897 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 18 Jul 2017 18:56:59 -0400 Subject: Get the resize/movement functionality all finished. --- src-qt5/core/libLumina/RootSubWindow.cpp | 34 +++++++++++++++++++------------- src-qt5/core/libLumina/RootSubWindow.h | 2 ++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index d4c0ceeb..a759dc09 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -311,7 +311,8 @@ void RootSubWindow::propertiesChanged(QList props, QList case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i] << this->geometry() << WIN->geometry(); if(vals[i].toBool()){ - animResetProp = WIN->geometry(); //this->geometry(); + if(lastGeom.isNull()){ animResetProp = WIN->geometry(); } + else{ animResetProp = lastGeom; } anim->setPropertyName("geometry"); anim->setStartValue( QRect(animResetProp.toRect().center(), QSize(0,0)) ); anim->setEndValue(animResetProp); @@ -320,6 +321,7 @@ void RootSubWindow::propertiesChanged(QList props, QList this->show(); }else{ animResetProp = this->geometry(); //hide event - should already be the right geom + lastGeom = this->geometry(); anim->setPropertyName("geometry"); anim->setStartValue(this->geometry()); anim->setEndValue( QRect(this->geometry().center(), QSize(0,0) ) ); @@ -337,21 +339,25 @@ void RootSubWindow::propertiesChanged(QList props, QList break; case NativeWindow::GlobalPos: //qDebug() << "Got Global Pos:" << this->pos() << WinWidget->mapToGlobal(QPoint(0,0)) << WIN->geometry().topLeft() << vals[i].toPoint(); - this->move( vals[i].toPoint() - (WinWidget->mapToGlobal(QPoint(0,0)) - this->pos()) ); //WIN->geometry().topLeft() ); + if(activeState == RootSubWindow::Normal){ + this->move( vals[i].toPoint() - (WinWidget->mapToGlobal(QPoint(0,0)) - this->pos()) ); //WIN->geometry().topLeft() ); + } break; case NativeWindow::Size: - qDebug() << " - SIZE CHANGE"; - if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ - if(vals[i].toSize() != WinWidget->size()){ - qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); - WinWidget->resize(vals[i].toSize()); - this->resize( WIN->geometry().size() ); - qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + //qDebug() << " - SIZE CHANGE"; + if(activeState == RootSubWindow::Normal){ + if(WIN->property(NativeWindow::FrameExtents).isNull() && (istate() != QPropertyAnimation::Running){ + if(vals[i].toSize() != WinWidget->size()){ + //qDebug() << "Got Widget Size Change:" << vals[i].toSize() << WinWidget->size(); + WinWidget->resize(vals[i].toSize()); + this->resize( WIN->geometry().size() ); + //qDebug() << " - Size after change:" << WinWidget->size() << this->size() << WIN->geometry(); + } } } break; diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index 804dcc9d..9c86e2bf 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -53,6 +53,8 @@ private: QPropertyAnimation *anim; QVariant animResetProp; QTimer *moveTimer; + QRect lastGeom; //frame coordinates + void initWindowFrame(); void enableFrame(bool); -- cgit