Improve window hints and tray icon

This commit is contained in:
ArsenArsen 2017-04-28 16:35:53 +02:00
parent 66547cb023
commit 34549c2f7f
2 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,7 @@ CropView::CropView(QGraphicsScene *scene) : QGraphicsView(scene)
setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes. setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes.
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint); setWindowFlags(Qt::BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool);
} }
void CropView::keyPressEvent(QKeyEvent *e) void CropView::keyPressEvent(QKeyEvent *e)

View File

@ -46,6 +46,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
menu->addActions({ fullscreen, area }); menu->addActions({ fullscreen, area });
connect(quit, &QAction::triggered, this, &MainWindow::quit); connect(quit, &QAction::triggered, this, &MainWindow::quit);
connect(shtoggle, &QAction::triggered, this, &MainWindow::toggleVisible); 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(fullscreen, &QAction::triggered, this, &MainWindow::on_actionFullscreen_triggered);
connect(area, &QAction::triggered, this, &MainWindow::on_actionArea_triggered); connect(area, &QAction::triggered, this, &MainWindow::on_actionArea_triggered);
tray->setContextMenu(menu); tray->setContextMenu(menu);