From 34549c2f7f20c24efb1785f71216e316ccdb1e06 Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Fri, 28 Apr 2017 16:35:53 +0200 Subject: [PATCH] Improve window hints and tray icon --- cropeditor/cropview.cpp | 2 +- mainwindow.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cropeditor/cropview.cpp b/cropeditor/cropview.cpp index 5f383bd..924c11d 100644 --- a/cropeditor/cropview.cpp +++ b/cropeditor/cropview.cpp @@ -5,7 +5,7 @@ CropView::CropView(QGraphicsScene *scene) : QGraphicsView(scene) setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint); + setWindowFlags(Qt::BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool); } void CropView::keyPressEvent(QKeyEvent *e) diff --git a/mainwindow.cpp b/mainwindow.cpp index 048eff7..2c07b56 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -46,6 +46,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi menu->addActions({ fullscreen, area }); connect(quit, &QAction::triggered, this, &MainWindow::quit); connect(shtoggle, &QAction::triggered, this, &MainWindow::toggleVisible); + connect(tray, &QSystemTrayIcon::messageClicked, this, &MainWindow::toggleVisible); + connect(tray, &QSystemTrayIcon::activated, this, [this](QSystemTrayIcon::ActivationReason reason) { + if (reason == QSystemTrayIcon::DoubleClick) toggleVisible(); + }); connect(fullscreen, &QAction::triggered, this, &MainWindow::on_actionFullscreen_triggered); connect(area, &QAction::triggered, this, &MainWindow::on_actionArea_triggered); tray->setContextMenu(menu);