11 #include <QMouseEvent>
14 #include <QPushButton>
34 bool isMainApplicationWindow,
35 const char *framelessPropertyName,
37 : m_windowMode(mode), m_isMainApplicationWindow(isMainApplicationWindow), m_widget(correspondingWidget),
38 m_framelessPropertyName(framelessPropertyName)
40 Q_ASSERT(correspondingWidget);
62 if (isFrameless == frameless) {
return; }
70 if (nonFrameLessMode == WindowFrameless) { nonFrameLessMode = WindowNormal; }
71 this->
setMode(frameless ? WindowFrameless : nonFrameLessMode);
84 QRect newGeometry = oldGeometry;
98 else { flags &= ~
Qt::WindowStaysOnTopHint; }
112 if (ws.isEmpty()) {
return WindowNormal; }
113 if (ws.contains(
"frameless") || ws.startsWith(
"f")) {
return WindowFrameless; }
114 if (ws.contains(
"tool") || ws.startsWith(
"t")) {
return WindowTool; }
120 static const QString n(
"normal");
121 static const QString f(
"frameless");
122 static const QString t(
"tool");
126 case WindowFrameless:
return f;
127 case WindowNormal:
return n;
128 case WindowTool:
return t;
141 Q_ASSERT_X(
m_widget,
"CEnableForFramelessWindow::setWindowAttributes",
"Missing widget representing window");
143 "Missing property name");
145 const bool frameless = (mode == WindowFrameless);
167 Q_ASSERT_X(
m_widget,
"CEnableForFramelessWindow::setDynamicProperties",
"Missing widget representing window");
169 "Missing property name");
244 if (!widgetSelf) {
return; }
253 if (!widgetSelf) {
return; }
263 if (!statusBar) {
return; }
299 return menuBarLayout;
int m_windowFrameSizeH
window frame height
QWidget * getWidget() const
Corresponding QMainWindow.
bool handleMousePressEvent(QMouseEvent *event)
Mouse press, required for frameless window.
void setMode(WindowMode mode)
Window mode.
void addFramelessSizeGripToStatusBar(QStatusBar *statusBar)
Resize grip handle.
static Qt::WindowFlags modeToWindowFlags(WindowMode mode)
Translate mode.
void showMinimizedModeChecked()
Check mode and then show minimized.
static WindowMode stringToWindowMode(const QString &s)
String to window mode.
bool isToolWindow() const
Tool window.
virtual void windowFlagsChanged()
Can be used as notification if window mode changes.
void hideFramelessSizeGripInStatusBar()
Resize grip handle.
virtual void setFrameless(bool frameless)
Framless.
static const QString & windowModeToString(WindowMode m)
String to window mode.
QPoint m_framelessDragPosition
position, if moving is handled with frameless window
bool m_isMainApplicationWindow
is this the main application window (only 1)?
void setWindowAttributes(WindowMode mode)
Attributes.
bool handleChangeEvent(QEvent *event)
Mouse window change event.
WindowMode m_windowMode
Window mode,.
WindowMode m_originalWindowMode
mode when initialized
QByteArray m_framelessPropertyName
property name for frameless widgets
void toolToNormalWindow()
Remove tool and add desktop window.
QHBoxLayout * addFramelessCloseButton(QMenuBar *menuBar)
Close button for frameless windows.
void showNormalModeChecked()
Check mode and then show normal.
int m_windowFrameSizeW
window frame width
bool handleMouseMoveEvent(QMouseEvent *event)
Mouse moving, required for frameless window.
void activate()
Activates the window.
QPushButton * m_framelessCloseButton
close button
QSizeGrip * m_framelessSizeGrip
size grip object
QSize m_moveSize
size when moved (in frameless window)
void alwaysOnTop(bool onTop)
Always on top?
bool isFrameless() const
Frameless?
void normalToToolWindow()
Remove desktop and add tool window.
QWidget * m_widget
corresponding window or dock widget
void setDynamicProperties(bool frameless)
Set dynamic properties such as frameless.
static bool isTopLevelWindow(QWidget *widget)
Is top level window?
Free functions in swift::misc.
SWIFT_MISC_EXPORT const QString & boolToTrueFalse(bool v)
Bool to true/false.
const char * constData() const const
bool isEmpty() const const
QEvent::Type type() const const
const QObjectList & children() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void setObjectName(QAnyStringView name)
bool setProperty(const char *name, QVariant &&value)
bool isNull() const const
QPoint toPoint() const const
QPointF globalPosition() const const
QString toLower() const const
QString trimmed() const const