From 4cf4cfb1dd2fda4cd6d8114228e6827e6e4d4fd7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 26 Jul 2017 15:33:24 -0400 Subject: Start adding the window arrangement framework to Lumina2. --- src-qt5/core/libLumina/RootSubWindow.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src-qt5/core/libLumina/RootSubWindow.cpp') diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index c2da8aef..322e524f 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -266,9 +266,9 @@ void RootSubWindow::LoadAllProperties(){ QList< NativeWindow::Property> list; list << NativeWindow::WinTypes << NativeWindow::WinActions << NativeWindow::States << NativeWindow::MinSize << NativeWindow::MaxSize << NativeWindow::Title << NativeWindow::ShortTitle - << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos << NativeWindow::Visible << NativeWindow::Active; + << NativeWindow::Icon << NativeWindow::Size << NativeWindow::GlobalPos;// << NativeWindow::Visible << NativeWindow::Active; LoadProperties(list); - WIN->requestProperty(NativeWindow::Visible, true); + //WIN->requestProperty(NativeWindow::Visible, true); } //Button Actions - public so they can be tied to key shortcuts and stuff as well @@ -342,13 +342,25 @@ void RootSubWindow::propertiesChanged(QList props, QList vals << vals.takeAt(i); i--; }else if(anim->state() != QPropertyAnimation::Running ){ - if(vals[i].toSize() != WinWidget->size() && activeState==Normal && vals[i]==WIN->property(NativeWindow::Size)){ + if(WIN->property(NativeWindow::Size).toSize() != WinWidget->size() && activeState==Normal ){ this->setGeometry(WIN->geometry()); } } break; case NativeWindow::MinSize: - WinWidget->setMinimumSize(vals[i].toSize()); + if(vals[i].toSize().isValid()){ + //Just larger than titlebar, with enough space for 8 characters in the titlebar (+4 buttons) + //qDebug() << "Got invalid Min Size: Set a reasonable default minimum"; + WinWidget->setMinimumSize( QSize( this->fontMetrics().height()*4 + this->fontMetrics().width("O")*10, this->fontMetrics().height()*10) ); + WIN->setProperty(NativeWindow::MinSize, WinWidget->minimumSize()); + }else{ + WinWidget->setMinimumSize(vals[i].toSize()); + } + if(WIN->property(NativeWindow::Size).toSize().width() < WinWidget->minimumSize().width() \ + || WIN->property(NativeWindow::Size).toSize().height() < WinWidget->minimumSize().height() ){ + WIN->setProperty(NativeWindow::Size, WinWidget->minimumSize(), true); //force this + //WinWidget->resize(WinWidget->minimumSize()); + } break; case NativeWindow::MaxSize: WinWidget->setMaximumSize(vals[i].toSize()); -- cgit