diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-29 13:40:19 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-29 13:40:19 -0400 |
commit | 06e86f64225d09ce1896f1ba860dbb1cedd71568 (patch) | |
tree | 69ec044da87ba3646005635eef4292e2128c1c97 /src-qt5/core | |
parent | Some more tweaks to the default stylesheet for the window frame. (diff) | |
download | lumina-06e86f64225d09ce1896f1ba860dbb1cedd71568.tar.gz lumina-06e86f64225d09ce1896f1ba860dbb1cedd71568.tar.bz2 lumina-06e86f64225d09ce1896f1ba860dbb1cedd71568.zip |
Add in a "show" animation for windows when they appear
This is a good example of how animations can be setup/used in the window
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.cpp | 14 | ||||
-rw-r--r-- | src-qt5/core/libLumina/RootSubWindow.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/RootSubWindow.cpp index 1814776a..bf242eff 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/RootSubWindow.cpp @@ -136,6 +136,9 @@ void RootSubWindow::initWindowFrame(){ maxB = new QToolButton(this); minB = new QToolButton(this); otherB = new QToolButton(this); + anim = new QPropertyAnimation(this); + anim->setTargetObject(this); + anim->setDuration(300); //1/3 second (appx) titleLabel = new QLabel(this); titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); otherM = new QMenu(this); //menu of other actions @@ -162,12 +165,13 @@ void RootSubWindow::initWindowFrame(){ maxB->setObjectName("Button_Maximize"); otherM->setObjectName("Menu_Actions"); titleLabel->setObjectName("Label_Title"); - this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border: 1px solid transparent; } QToolButton::hover{border-color: white;} QToolButton::menu-arrow{ image: none; }"); + this->setStyleSheet("QWidget#WindowFrame{background-color: rgba(0,0,0,125);} QWidget#Label_Title{background-color: transparent; color: white; } QToolButton{background-color: transparent; border: 1px solid transparent; } QToolButton::hover{border-color: white;} QToolButton::pressed{ background-color: white; } QToolButton::menu-arrow{ image: none; }"); //And adjust the margins mainLayout->setContentsMargins(WIN_BORDER,WIN_BORDER,WIN_BORDER,WIN_BORDER); //default border mainLayout->setSpacing(0); titleBar->setSpacing(1); titleBar->setContentsMargins(0,0,0,0); + //Now load the icons for the button LIconCache::instance()->loadIcon(closeB, "window-close"); LIconCache::instance()->loadIcon(maxB, "window-maximize"); @@ -259,7 +263,13 @@ void RootSubWindow::propertiesChanged(QList<NativeWindow::Property> props, QList switch(props[i]){ case NativeWindow::Visible: //qDebug() << "Got Visibility Change:" << vals[i]; - if(vals[i].toBool()){ WinWidget->setVisible(true); this->show(); } + if(vals[i].toBool()){ + WinWidget->setVisible(true); + this->show(); + anim->setPropertyName("windowOpacity"); + anim->setStartValue(0.0); anim->setEndValue(1.0); + anim->start(); + } else{ this->hide(); } break; case NativeWindow::Title: diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/RootSubWindow.h index cb502107..5e291aa3 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/RootSubWindow.h @@ -18,6 +18,7 @@ #include <QLabel> #include <QToolButton> #include <QMenu> +#include <QPropertyAnimation> #include <NativeWindow.h> @@ -47,6 +48,8 @@ private: QToolButton *closeB, *maxB, *minB, *otherB; QLabel *titleLabel; QMenu *otherM; //menu of other actions + //Other random objects (animations,etc) + QPropertyAnimation *anim; void initWindowFrame(); void LoadProperties( QList< NativeWindow::Property> list); |