From e02063f3e0f7e512f3bd571c88073049f9463989 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Sat, 3 Feb 2018 19:33:26 +0100 Subject: [PATCH] CaptureWidget: define flags outside of the constructor --- src/capture/widgets/capturewidget.cpp | 14 -------------- src/core/controller.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/capture/widgets/capturewidget.cpp b/src/capture/widgets/capturewidget.cpp index 94f09021..a2ee94ee 100644 --- a/src/capture/widgets/capturewidget.cpp +++ b/src/capture/widgets/capturewidget.cpp @@ -71,17 +71,6 @@ CaptureWidget::CaptureWidget(const uint id, const QString &forcedSavePath, << &m_LSide << &m_TSide << &m_RSide << &m_BSide; // set base config of the widget -#ifdef Q_OS_WIN - setWindowFlags(Qt::WindowStaysOnTopHint - | Qt::FramelessWindowHint - | Qt::Popup); -#else - setWindowFlags(Qt::BypassWindowManagerHint - | Qt::WindowStaysOnTopHint - | Qt::FramelessWindowHint - | Qt::Tool); -#endif - setMouseTracking(true); updateCursor(); initShortcuts(); @@ -94,9 +83,6 @@ CaptureWidget::CaptureWidget(const uint id, const QString &forcedSavePath, this->close(); } m_screenshot = new Screenshot(fullScreenshot, this); - QSize size = fullScreenshot.size(); - // we need to increase by 1 the size to reach to the end of the screen - setGeometry(0 ,0 , size.width(), size.height()); // create buttons m_buttonHandler = new ButtonHandler(rect(), this); diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 5a0dde39..e5a07199 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -72,7 +72,19 @@ void Controller::createVisualCapture(const uint id, const QString &forcedSavePat modalWidget->deleteLater(); } } while (modalWidget); + m_captureWindow = new CaptureWidget(id, forcedSavePath); +#ifdef Q_OS_WIN + setWindowFlags(Qt::WindowStaysOnTopHint + | Qt::FramelessWindowHint + | Qt::Popup); +#else + m_captureWindow->setWindowFlags(Qt::BypassWindowManagerHint + | Qt::WindowStaysOnTopHint + | Qt::FramelessWindowHint + | Qt::Tool); +#endif + m_captureWindow->resize(m_captureWindow->pixmap().size()); connect(m_captureWindow, &CaptureWidget::captureFailed, this, &Controller::captureFailed); connect(m_captureWindow, &CaptureWidget::captureTaken,