mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
Ref T257, activate (window) and formatting functions in CEnableForFramelessWindow
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
#include "blackgui/guiutility.h"
|
#include "blackgui/guiutility.h"
|
||||||
|
#include "blackgui/foreignwindows.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
#include "blackmisc/worker.h"
|
#include "blackmisc/worker.h"
|
||||||
@@ -34,7 +35,7 @@ using namespace BlackMisc;
|
|||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
CEnableForFramelessWindow::CEnableForFramelessWindow(CEnableForFramelessWindow::WindowMode mode, bool isMainApplicationWindow, const char *framelessPropertyName, QWidget *correspondingWidget) :
|
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(correspondingWidget);
|
||||||
Q_ASSERT(!m_framelessPropertyName.isEmpty());
|
Q_ASSERT(!m_framelessPropertyName.isEmpty());
|
||||||
@@ -77,6 +78,12 @@ namespace BlackGui
|
|||||||
this->windowFlagsChanged();
|
this->windowFlagsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEnableForFramelessWindow::activate()
|
||||||
|
{
|
||||||
|
if (!m_widget) { return; }
|
||||||
|
m_widget->setWindowState(Qt::WindowActive);
|
||||||
|
}
|
||||||
|
|
||||||
CEnableForFramelessWindow::WindowMode CEnableForFramelessWindow::stringToWindowMode(const QString &s)
|
CEnableForFramelessWindow::WindowMode CEnableForFramelessWindow::stringToWindowMode(const QString &s)
|
||||||
{
|
{
|
||||||
QString ws(s.trimmed().toLower());
|
QString ws(s.trimmed().toLower());
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ namespace BlackGui
|
|||||||
//! \param isMainApplicationWindow is this the main (there should be only one) application window
|
//! \param isMainApplicationWindow is this the main (there should be only one) application window
|
||||||
//! \param framelessPropertyname qss property indication frameless
|
//! \param framelessPropertyname qss property indication frameless
|
||||||
//! \param correspondingWidget the widget representing the window
|
//! \param correspondingWidget the widget representing the window
|
||||||
//!
|
|
||||||
CEnableForFramelessWindow(WindowMode mode, bool isMainApplicationWindow, const char *framelessPropertyname, QWidget *correspondingWidget);
|
CEnableForFramelessWindow(WindowMode mode, bool isMainApplicationWindow, const char *framelessPropertyname, QWidget *correspondingWidget);
|
||||||
|
|
||||||
//! Window mode
|
//! Window mode
|
||||||
@@ -62,11 +61,14 @@ namespace BlackGui
|
|||||||
bool isFrameless() const { return m_windowMode == WindowFrameless; }
|
bool isFrameless() const { return m_windowMode == WindowFrameless; }
|
||||||
|
|
||||||
//! Is main application, explicitly set
|
//! Is main application, explicitly set
|
||||||
bool isMainApplicationWindow() const { return m_mainApplicationWindow; }
|
bool isMainApplicationWindow() const { return m_isMainApplicationWindow; }
|
||||||
|
|
||||||
//! Always on top?
|
//! Always on top?
|
||||||
void alwaysOnTop(bool onTop);
|
void alwaysOnTop(bool onTop);
|
||||||
|
|
||||||
|
//! Activates the window
|
||||||
|
void activate();
|
||||||
|
|
||||||
//! Corresponding QMainWindow
|
//! Corresponding QMainWindow
|
||||||
QWidget *getWidget() const { return m_widget; }
|
QWidget *getWidget() const { return m_widget; }
|
||||||
|
|
||||||
@@ -81,7 +83,7 @@ namespace BlackGui
|
|||||||
QPushButton *m_framelessCloseButton = nullptr; //!< close button
|
QPushButton *m_framelessCloseButton = nullptr; //!< close button
|
||||||
WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode
|
WindowMode m_windowMode = WindowNormal; //!< Window mode, \sa WindowMode
|
||||||
WindowMode m_originalWindowMode = WindowNormal; //!< mode when initialized
|
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
|
QWidget *m_widget = nullptr; //!< corresponding window or dock widget
|
||||||
QSizeGrip *m_framelessSizeGrip = nullptr; //!< size grip object
|
QSizeGrip *m_framelessSizeGrip = nullptr; //!< size grip object
|
||||||
QByteArray m_framelessPropertyName; //!< property name for frameless widgets
|
QByteArray m_framelessPropertyName; //!< property name for frameless widgets
|
||||||
|
|||||||
Reference in New Issue
Block a user