From 8f36bade9684e225fe74e044216f3dc6308649b6 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 3 Apr 2020 13:42:13 -0400 Subject: Get the window transparency and ring animation finished up. All set now. --- src-qt5/core/lumina-pingcursor/main.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src-qt5/core/lumina-pingcursor/main.cpp b/src-qt5/core/lumina-pingcursor/main.cpp index 19d4690e..9dfecd94 100644 --- a/src-qt5/core/lumina-pingcursor/main.cpp +++ b/src-qt5/core/lumina-pingcursor/main.cpp @@ -10,22 +10,34 @@ #include #include #include +#include +#include +#include + int main(int argc, char **argv){ //Setup the application QApplication App(argc, argv); App.setAttribute(Qt::AA_UseHighDpiPixmaps); //Display the OSD - QWidget splash(0, Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); + QLabel splash(0, Qt::Window | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::NoDropShadowWindowHint); splash.setWindowTitle(""); - splash.setStyleSheet("background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 transparent, stop:0.52 transparent, stop:0.565 rgba(82, 121, 76, 33), stop:0.65 rgba(159, 235, 148, 64), stop:0.721925 rgba(255, 238, 150, 129), stop:0.77 rgba(255, 128, 128, 204), stop:0.89 rgba(191, 128, 255, 64), stop:1 transparent);"); - splash.setWindowOpacity(0); splash.resize(100,100); + QWidget overlay( &splash ); + overlay.setStyleSheet("margin: 0px; border: none; background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 rgba(0, 0, 0, 0), stop:0.52 rgba(0, 0, 0, 0), stop:0.565 rgba(82, 121, 76, 33), stop:0.65 rgba(159, 235, 148, 64), stop:0.721925 rgba(255, 238, 150, 129), stop:0.77 rgba(130, 205, 47, 204), stop:0.89 rgba(100, 128, 255, 64), stop:1 rgba(0, 0, 0, 0));"); + overlay.setGeometry(QRect(0,0,100,100)); //Make sure it is centered on the current screen QPoint center = QCursor::pos(); splash.move(center.x()-(splash.size().width()/2), center.y()-(splash.size().height()/2)); + splash.setPixmap(QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId(), splash.x(), splash.y(), 100,100) ); splash.show(); - QDateTime end = QDateTime::currentDateTime().addMSecs(1000); - while(QDateTime::currentDateTime() < end){ App.processEvents(); } + QPropertyAnimation anim(&splash,"windowOpacity"); + anim.setDuration(1500); + anim.setStartValue(1); + anim.setKeyValueAt(0.30, 0); anim.setKeyValueAt(0.31, 1); + anim.setKeyValueAt(0.60, 0); anim.setKeyValueAt(0.61, 1); + anim.setEndValue(0); + anim.start(); + while(anim.state() != QAbstractAnimation::Stopped){ App.processEvents(); } splash.hide(); return 0; } -- cgit