diff --git a/src/blackgui/enableforframelesswindow.cpp b/src/blackgui/enableforframelesswindow.cpp index 72619f0c3..1e6b663ed 100644 --- a/src/blackgui/enableforframelesswindow.cpp +++ b/src/blackgui/enableforframelesswindow.cpp @@ -9,6 +9,7 @@ #include "blackgui/enableforframelesswindow.h" #include "blackgui/guiutility.h" +#include "blackgui/foreignwindows.h" #include "blackmisc/icons.h" #include "blackmisc/stringutils.h" #include "blackmisc/worker.h" @@ -34,7 +35,7 @@ using namespace BlackMisc; namespace BlackGui { CEnableForFramelessWindow::CEnableForFramelessWindow(CEnableForFramelessWindow::WindowMode mode, bool isMainApplicationWindow, const char *framelessPropertyName, QWidget *correspondingWidget) : - m_windowMode(mode), m_mainApplicationWindow(isMainApplicationWindow), m_widget(correspondingWidget), m_framelessPropertyName(framelessPropertyName) + m_windowMode(mode), m_isMainApplicationWindow(isMainApplicationWindow), m_widget(correspondingWidget), m_framelessPropertyName(framelessPropertyName) { Q_ASSERT(correspondingWidget); Q_ASSERT(!m_framelessPropertyName.isEmpty()); @@ -77,6 +78,12 @@ namespace BlackGui this->windowFlagsChanged(); } + void CEnableForFramelessWindow::activate() + { + if (!m_widget) { return; } + m_widget->setWindowState(Qt::WindowActive); + } + CEnableForFramelessWindow::WindowMode CEnableForFramelessWindow::stringToWindowMode(const QString &s) { QString ws(s.trimmed().toLower()); diff --git a/src/blackgui/enableforframelesswindow.h b/src/blackgui/enableforframelesswindow.h index 16fb4b5a2..c058e9bb8 100644 --- a/src/blackgui/enableforframelesswindow.h +++ b/src/blackgui/enableforframelesswindow.h @@ -49,7 +49,6 @@ namespace BlackGui //! \param isMainApplicationWindow is this the main (there should be only one) application window //! \param framelessPropertyname qss property indication frameless //! \param correspondingWidget the widget representing the window - //! CEnableForFramelessWindow(WindowMode mode, bool isMainApplicationWindow, const char *framelessPropertyname, QWidget *correspondingWidget); //! Window mode @@ -62,11 +61,14 @@ namespace BlackGui bool isFrameless() const { return m_windowMode == WindowFrameless; } //! Is main application, explicitly set - bool isMainApplicationWindow() const { return m_mainApplicationWindow; } + bool isMainApplicationWindow() const { return m_isMainApplicationWindow; } //! Always on top? void alwaysOnTop(bool onTop); + //! Activates the window + void activate(); + //! Corresponding QMainWindow QWidget *getWidget() const { return m_widget; } @@ -81,7 +83,7 @@ namespace BlackGui QPushButton *m_framelessCloseButton = nullptr; //!< close button WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode WindowMode m_originalWindowMode = WindowNormal; //!< mode when initialized - bool m_mainApplicationWindow = false; //!< is this the main application window (only 1)? + bool m_isMainApplicationWindow = false; //!< is this the main application window (only 1)? QWidget *m_widget = nullptr; //!< corresponding window or dock widget QSizeGrip *m_framelessSizeGrip = nullptr; //!< size grip object QByteArray m_framelessPropertyName; //!< property name for frameless widgets