add way to disable window maximization

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-10-08 15:25:22 +08:00
parent e77a2db663
commit d483c39b9a
22 changed files with 158 additions and 49 deletions

View File

@ -460,12 +460,12 @@ GetScaleFactorForMonitor(
EXTERN_C_END EXTERN_C_END
[[maybe_unused]] static constexpr const int kAutoHideTaskBarThickness = 2; // The thickness of an auto-hide taskbar in pixels. [[maybe_unused]] inline constexpr const int kAutoHideTaskBarThickness = 2; // The thickness of an auto-hide taskbar in pixels.
[[maybe_unused]] static constexpr const wchar_t kDwmRegistryKey[] = LR"(Software\Microsoft\Windows\DWM)"; [[maybe_unused]] inline constexpr const wchar_t kDwmRegistryKey[] = LR"(Software\Microsoft\Windows\DWM)";
[[maybe_unused]] static constexpr const wchar_t kPersonalizeRegistryKey[] = LR"(Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)"; [[maybe_unused]] inline constexpr const wchar_t kPersonalizeRegistryKey[] = LR"(Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)";
[[maybe_unused]] static constexpr const wchar_t kThemeSettingChangeEventName[] = L"ImmersiveColorSet"; [[maybe_unused]] inline constexpr const wchar_t kThemeSettingChangeEventName[] = L"ImmersiveColorSet";
[[maybe_unused]] static constexpr const wchar_t kDwmColorKeyName[] = L"ColorPrevalence"; [[maybe_unused]] inline constexpr const wchar_t kDwmColorKeyName[] = L"ColorPrevalence";
[[maybe_unused]] static constexpr const wchar_t kSystemDarkThemeResourceName[] = L"DarkMode_Explorer"; [[maybe_unused]] inline constexpr const wchar_t kSystemDarkThemeResourceName[] = L"DarkMode_Explorer";
[[maybe_unused]] static constexpr const wchar_t kSystemLightThemeResourceName[] = L"Explorer"; [[maybe_unused]] inline constexpr const wchar_t kSystemLightThemeResourceName[] = L"Explorer";
[[maybe_unused]] static constexpr const wchar_t kDesktopRegistryKey[] = LR"(Control Panel\Desktop)"; [[maybe_unused]] inline constexpr const wchar_t kDesktopRegistryKey[] = LR"(Control Panel\Desktop)";

View File

@ -190,7 +190,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcCoreGlobal)
#include <framelesshelper.version> #include <framelesshelper.version>
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION = [[maybe_unused]] inline constexpr const int FRAMELESSHELPER_VERSION =
FRAMELESSHELPER_MAKE_VERSION(FRAMELESSHELPER_VERSION_MAJOR, FRAMELESSHELPER_VERSION_MINOR, FRAMELESSHELPER_MAKE_VERSION(FRAMELESSHELPER_VERSION_MAJOR, FRAMELESSHELPER_VERSION_MINOR,
FRAMELESSHELPER_VERSION_PATCH, FRAMELESSHELPER_VERSION_TWEAK); FRAMELESSHELPER_VERSION_PATCH, FRAMELESSHELPER_VERSION_TWEAK);
@ -199,17 +199,17 @@ namespace Global
Q_NAMESPACE_EXPORT(FRAMELESSHELPER_CORE_API) Q_NAMESPACE_EXPORT(FRAMELESSHELPER_CORE_API)
[[maybe_unused]] static constexpr const int kDefaultResizeBorderThickness = 8; [[maybe_unused]] inline constexpr const int kDefaultResizeBorderThickness = 8;
[[maybe_unused]] static constexpr const int kDefaultCaptionHeight = 23; [[maybe_unused]] inline constexpr const int kDefaultCaptionHeight = 23;
[[maybe_unused]] static constexpr const int kDefaultTitleBarHeight = 32; [[maybe_unused]] inline constexpr const int kDefaultTitleBarHeight = 32;
[[maybe_unused]] static constexpr const int kDefaultExtendedTitleBarHeight = 48; [[maybe_unused]] inline constexpr const int kDefaultExtendedTitleBarHeight = 48;
[[maybe_unused]] static constexpr const int kDefaultWindowFrameBorderThickness = 1; [[maybe_unused]] inline constexpr const int kDefaultWindowFrameBorderThickness = 1;
[[maybe_unused]] static constexpr const int kDefaultTitleBarFontPointSize = 11; [[maybe_unused]] inline constexpr const int kDefaultTitleBarFontPointSize = 11;
[[maybe_unused]] static constexpr const int kDefaultTitleBarContentsMargin = 10; [[maybe_unused]] inline constexpr const int kDefaultTitleBarContentsMargin = 10;
[[maybe_unused]] static constexpr const QSize kDefaultWindowIconSize = {16, 16}; [[maybe_unused]] inline constexpr const QSize kDefaultWindowIconSize = {16, 16};
[[maybe_unused]] static constexpr const QSize kDefaultSystemButtonSize = {qRound(qreal(kDefaultTitleBarHeight) * 1.5), kDefaultTitleBarHeight}; [[maybe_unused]] inline constexpr const QSize kDefaultSystemButtonSize = {qRound(qreal(kDefaultTitleBarHeight) * 1.5), kDefaultTitleBarHeight};
[[maybe_unused]] static constexpr const QSize kDefaultSystemButtonIconSize = kDefaultWindowIconSize; [[maybe_unused]] inline constexpr const QSize kDefaultSystemButtonIconSize = kDefaultWindowIconSize;
[[maybe_unused]] static constexpr const QSize kDefaultWindowSize = {160, 160}; // Value taken from QPA. [[maybe_unused]] inline constexpr const QSize kDefaultWindowSize = {160, 160}; // Value taken from QPA.
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
# define kDefaultBlackColor QColorConstants::Black # define kDefaultBlackColor QColorConstants::Black
@ -217,19 +217,19 @@ Q_NAMESPACE_EXPORT(FRAMELESSHELPER_CORE_API)
# define kDefaultTransparentColor QColorConstants::Transparent # define kDefaultTransparentColor QColorConstants::Transparent
# define kDefaultDarkGrayColor QColorConstants::DarkGray # define kDefaultDarkGrayColor QColorConstants::DarkGray
#else // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) #else // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultBlackColor = {0, 0, 0}; // #000000 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultBlackColor = {0, 0, 0}; // #000000
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultWhiteColor = {255, 255, 255}; // #FFFFFF [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultWhiteColor = {255, 255, 255}; // #FFFFFF
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultTransparentColor = {0, 0, 0, 0}; [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultTransparentColor = {0, 0, 0, 0};
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultDarkGrayColor = {169, 169, 169}; // #A9A9A9 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultDarkGrayColor = {169, 169, 169}; // #A9A9A9
#endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) #endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultSystemLightColor = {240, 240, 240}; // #F0F0F0 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemLightColor = {240, 240, 240}; // #F0F0F0
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultSystemDarkColor = {32, 32, 32}; // #202020 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemDarkColor = {32, 32, 32}; // #202020
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultFrameBorderActiveColor = {77, 77, 77}; // #4D4D4D [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultFrameBorderActiveColor = {77, 77, 77}; // #4D4D4D
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultFrameBorderInactiveColorDark = {87, 89, 89}; // #575959 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultFrameBorderInactiveColorDark = {87, 89, 89}; // #575959
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultFrameBorderInactiveColorLight = {166, 166, 166}; // #A6A6A6 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultFrameBorderInactiveColorLight = {166, 166, 166}; // #A6A6A6
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultSystemButtonBackgroundColor = {204, 204, 204}; // #CCCCCC [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemButtonBackgroundColor = {204, 204, 204}; // #CCCCCC
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultSystemCloseButtonBackgroundColor = {232, 17, 35}; // #E81123 [[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemCloseButtonBackgroundColor = {232, 17, 35}; // #E81123
enum class Option enum class Option
{ {
@ -527,7 +527,7 @@ struct SystemParameters
}; };
#ifdef Q_OS_WINDOWS #ifdef Q_OS_WINDOWS
[[maybe_unused]] static constexpr const VersionNumber WindowsVersions[] = [[maybe_unused]] inline constexpr const VersionNumber WindowsVersions[] =
{ {
{ 5, 0, 2195}, // Windows 2000 { 5, 0, 2195}, // Windows 2000
{ 5, 1, 2600}, // Windows XP { 5, 1, 2600}, // Windows XP

View File

@ -77,7 +77,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQuickGlobal) Q_DECLARE_LOGGING_CATEGORY(lcQuickGlobal)
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_QUICK_URI[] = "org.wangwenx190.FramelessHelper"; [[maybe_unused]] inline constexpr const char FRAMELESSHELPER_QUICK_URI[] = "org.wangwenx190.FramelessHelper";
class FRAMELESSHELPER_QUICK_API QuickGlobal : public QObject class FRAMELESSHELPER_QUICK_API QuickGlobal : public QObject
{ {

View File

@ -83,6 +83,8 @@ public Q_SLOTS:
protected: protected:
void itemChange(const ItemChange change, const ItemChangeData &value) override; void itemChange(const ItemChange change, const ItemChangeData &value) override;
void classBegin() override;
void componentComplete() override;
Q_SIGNALS: Q_SIGNALS:
void extendsContentIntoTitleBarChanged(); void extendsContentIntoTitleBarChanged();

View File

@ -29,6 +29,7 @@
#include <QtCore/qloggingcategory.h> #include <QtCore/qloggingcategory.h>
#include <QtGui/qcolor.h> #include <QtGui/qcolor.h>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include <QtQml/qqmlparserstatus.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QQuickWindow; class QQuickWindow;
@ -38,7 +39,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcFramelessQuickUtils) Q_DECLARE_LOGGING_CATEGORY(lcFramelessQuickUtils)
class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQmlParserStatus
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY_MOVE(FramelessQuickUtils) Q_DISABLE_COPY_MOVE(FramelessQuickUtils)
@ -81,6 +82,10 @@ public:
Q_NODISCARD Q_INVOKABLE QColor getSystemButtonBackgroundColor( Q_NODISCARD Q_INVOKABLE QColor getSystemButtonBackgroundColor(
const QuickGlobal::SystemButtonType button, const QuickGlobal::ButtonState state); const QuickGlobal::SystemButtonType button, const QuickGlobal::ButtonState state);
protected:
void classBegin() override;
void componentComplete() override;
Q_SIGNALS: Q_SIGNALS:
void systemThemeChanged(); void systemThemeChanged();
void systemAccentColorChanged(); void systemAccentColorChanged();

View File

@ -26,6 +26,7 @@
#include "framelesshelperquick_global.h" #include "framelesshelperquick_global.h"
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QtQml/qqmlparserstatus.h>
#include <QtQuick/qquickwindow.h> #include <QtQuick/qquickwindow.h>
Q_MOC_INCLUDE("framelessquickwindow_p_p.h") Q_MOC_INCLUDE("framelessquickwindow_p_p.h")
@ -34,7 +35,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessQuickWindowPrivate; class FramelessQuickWindowPrivate;
class FRAMELESSHELPER_QUICK_API FramelessQuickWindow : public QQuickWindow class FRAMELESSHELPER_QUICK_API FramelessQuickWindow : public QQuickWindow, public QQmlParserStatus
{ {
Q_OBJECT Q_OBJECT
#ifdef QML_NAMED_ELEMENT #ifdef QML_NAMED_ELEMENT
@ -66,6 +67,10 @@ public Q_SLOTS:
void toggleMaximized(); void toggleMaximized();
void toggleFullScreen(); void toggleFullScreen();
protected:
void classBegin() override;
void componentComplete() override;
Q_SIGNALS: Q_SIGNALS:
void hiddenChanged(); void hiddenChanged();
void normalChanged(); void normalChanged();

View File

@ -76,6 +76,10 @@ public Q_SLOTS:
void setInactiveForegroundColor(const QColor &value); void setInactiveForegroundColor(const QColor &value);
void setIconSize(const qreal value); void setIconSize(const qreal value);
protected:
void classBegin() override;
void componentComplete() override;
private: private:
void initialize(); void initialize();

View File

@ -90,6 +90,8 @@ public:
protected: protected:
void itemChange(const ItemChange change, const ItemChangeData &value) override; void itemChange(const ItemChange change, const ItemChangeData &value) override;
Q_NODISCARD bool eventFilter(QObject *object, QEvent *event) override; Q_NODISCARD bool eventFilter(QObject *object, QEvent *event) override;
void classBegin() override;
void componentComplete() override;
private Q_SLOTS: private Q_SLOTS:
void updateMaximizeButton(); void updateMaximizeButton();

View File

@ -27,13 +27,14 @@
#include "framelesshelperquick_global.h" #include "framelesshelperquick_global.h"
#include <QtCore/qloggingcategory.h> #include <QtCore/qloggingcategory.h>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include <QtQml/qqmlparserstatus.h>
#include <chromepalette.h> #include <chromepalette.h>
FRAMELESSHELPER_BEGIN_NAMESPACE FRAMELESSHELPER_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQuickChromePalette) Q_DECLARE_LOGGING_CATEGORY(lcQuickChromePalette)
class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette, public QQmlParserStatus
{ {
Q_OBJECT Q_OBJECT
#ifdef QML_ANONYMOUS #ifdef QML_ANONYMOUS
@ -44,6 +45,10 @@ class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette
public: public:
explicit QuickChromePalette(QObject *parent = nullptr); explicit QuickChromePalette(QObject *parent = nullptr);
~QuickChromePalette() override; ~QuickChromePalette() override;
protected:
void classBegin() override;
void componentComplete() override;
}; };
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE

View File

@ -54,6 +54,10 @@ public:
Q_NODISCARD QVariant source() const; Q_NODISCARD QVariant source() const;
void setSource(const QVariant &value); void setSource(const QVariant &value);
protected:
void classBegin() override;
void componentComplete() override;
Q_SIGNALS: Q_SIGNALS:
void sourceChanged(); void sourceChanged();

View File

@ -50,6 +50,8 @@ public:
protected: protected:
void itemChange(const ItemChange change, const ItemChangeData &value) override; void itemChange(const ItemChange change, const ItemChangeData &value) override;
[[nodiscard]] QSGNode *updatePaintNode(QSGNode *old, UpdatePaintNodeData *data) override; [[nodiscard]] QSGNode *updatePaintNode(QSGNode *old, UpdatePaintNodeData *data) override;
void classBegin() override;
void componentComplete() override;
private: private:
QScopedPointer<QuickMicaMaterialPrivate> d_ptr; QScopedPointer<QuickMicaMaterialPrivate> d_ptr;

View File

@ -33,12 +33,12 @@
#pragma once #pragma once
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@; [[maybe_unused]] inline constexpr const int FRAMELESSHELPER_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@;
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_MINOR = @PROJECT_VERSION_MINOR@; [[maybe_unused]] inline constexpr const int FRAMELESSHELPER_VERSION_MINOR = @PROJECT_VERSION_MINOR@;
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_PATCH = @PROJECT_VERSION_PATCH@; [[maybe_unused]] inline constexpr const int FRAMELESSHELPER_VERSION_PATCH = @PROJECT_VERSION_PATCH@;
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_TWEAK = @PROJECT_VERSION_TWEAK@; [[maybe_unused]] inline constexpr const int FRAMELESSHELPER_VERSION_TWEAK = @PROJECT_VERSION_TWEAK@;
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_VERSION_STR[] = "@PROJECT_VERSION@\0"; [[maybe_unused]] inline constexpr const char FRAMELESSHELPER_VERSION_STR[] = "@PROJECT_VERSION@\0";
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "@PROJECT_VERSION_COMMIT@\0"; [[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "@PROJECT_VERSION_COMMIT@\0";
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "@PROJECT_COMPILE_DATETIME@\0"; [[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "@PROJECT_COMPILE_DATETIME@\0";
#endif // _FRAMELESSHELPER_VERSION_DEFINED_ #endif // _FRAMELESSHELPER_VERSION_DEFINED_

View File

@ -41,7 +41,8 @@ Q_LOGGING_CATEGORY(lcFramelessHelperQt, "wangwenx190.framelesshelper.core.impl.q
using namespace Global; using namespace Global;
FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontOverrideCursor, "FRAMELESSHELPER_DONT_OVERRIDE_CURSOR") FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontOverrideCursorVar, "FRAMELESSHELPER_DONT_OVERRIDE_CURSOR")
FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontToggleMaximizeVar, "FRAMELESSHELPER_DONT_TOGGLE_MAXIMIZE")
struct QtHelperData struct QtHelperData
{ {
@ -179,7 +180,8 @@ bool FramelessHelperQt::eventFilter(QObject *object, QEvent *event)
const bool windowFixedSize = data.params.isWindowFixedSize(); const bool windowFixedSize = data.params.isWindowFixedSize();
const bool ignoreThisEvent = data.params.shouldIgnoreMouseEvents(scenePos); const bool ignoreThisEvent = data.params.shouldIgnoreMouseEvents(scenePos);
const bool insideTitleBar = data.params.isInsideTitleBarDraggableArea(scenePos); const bool insideTitleBar = data.params.isInsideTitleBarDraggableArea(scenePos);
const bool dontOverrideCursor = data.params.getProperty(kDontOverrideCursor, false).toBool(); const bool dontOverrideCursor = data.params.getProperty(kDontOverrideCursorVar, false).toBool();
const bool dontToggleMaximize = data.params.getProperty(kDontToggleMaximizeVar, false).toBool();
switch (type) { switch (type) {
case QEvent::MouseButtonPress: { case QEvent::MouseButtonPress: {
if (button == Qt::LeftButton) { if (button == Qt::LeftButton) {
@ -210,7 +212,7 @@ bool FramelessHelperQt::eventFilter(QObject *object, QEvent *event)
} }
} break; } break;
case QEvent::MouseButtonDblClick: { case QEvent::MouseButtonDblClick: {
if ((button == Qt::LeftButton) && !windowFixedSize && !ignoreThisEvent && insideTitleBar) { if (!dontToggleMaximize && (button == Qt::LeftButton) && !windowFixedSize && !ignoreThisEvent && insideTitleBar) {
Qt::WindowState newWindowState = Qt::WindowNoState; Qt::WindowState newWindowState = Qt::WindowNoState;
if (data.params.getWindowState() != Qt::WindowMaximized) { if (data.params.getWindowState() != Qt::WindowMaximized) {
newWindowState = Qt::WindowMaximized; newWindowState = Qt::WindowMaximized;
@ -221,7 +223,7 @@ bool FramelessHelperQt::eventFilter(QObject *object, QEvent *event)
} }
} break; } break;
case QEvent::MouseMove: { case QEvent::MouseMove: {
if (!windowFixedSize && !dontOverrideCursor) { if (!dontOverrideCursor && !windowFixedSize) {
const Qt::CursorShape cs = Utils::calculateCursorShape(window, scenePos); const Qt::CursorShape cs = Utils::calculateCursorShape(window, scenePos);
if (cs == Qt::ArrowCursor) { if (cs == Qt::ArrowCursor) {
if (data.cursorShapeChanged) { if (data.cursorShapeChanged) {

View File

@ -74,7 +74,8 @@ FRAMELESSHELPER_STRING_CONSTANT(SetWindowPos)
FRAMELESSHELPER_STRING_CONSTANT(TrackMouseEvent) FRAMELESSHELPER_STRING_CONSTANT(TrackMouseEvent)
FRAMELESSHELPER_STRING_CONSTANT(FindWindowW) FRAMELESSHELPER_STRING_CONSTANT(FindWindowW)
FRAMELESSHELPER_STRING_CONSTANT(UnregisterClassW) FRAMELESSHELPER_STRING_CONSTANT(UnregisterClassW)
FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontOverrideCursor, "FRAMELESSHELPER_DONT_OVERRIDE_CURSOR") FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontOverrideCursorVar, "FRAMELESSHELPER_DONT_OVERRIDE_CURSOR")
FRAMELESSHELPER_BYTEARRAY_CONSTANT2(DontToggleMaximizeVar, "FRAMELESSHELPER_DONT_TOGGLE_MAXIMIZE")
FRAMELESSHELPER_STRING_CONSTANT(DestroyWindow) FRAMELESSHELPER_STRING_CONSTANT(DestroyWindow)
[[maybe_unused]] static constexpr const char kFallbackTitleBarErrorMessage[] = [[maybe_unused]] static constexpr const char kFallbackTitleBarErrorMessage[] =
"FramelessHelper is unable to create the fallback title bar window, and thus the snap layout feature will be disabled" "FramelessHelper is unable to create the fallback title bar window, and thus the snap layout feature will be disabled"
@ -962,7 +963,10 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
(GetAsyncKeyState(VK_RBUTTON) < 0) : (GetAsyncKeyState(VK_LBUTTON) < 0)); (GetAsyncKeyState(VK_RBUTTON) < 0) : (GetAsyncKeyState(VK_LBUTTON) < 0));
const bool isTitleBar = (data.params.isInsideTitleBarDraggableArea(qtScenePos) && leftButtonPressed); const bool isTitleBar = (data.params.isInsideTitleBarDraggableArea(qtScenePos) && leftButtonPressed);
const bool isFixedSize = data.params.isWindowFixedSize(); const bool isFixedSize = data.params.isWindowFixedSize();
const bool dontOverrideCursor = data.params.getProperty(kDontOverrideCursor, false).toBool(); const bool dontOverrideCursor = data.params.getProperty(kDontOverrideCursorVar, false).toBool();
const bool dontToggleMaximize = data.params.getProperty(kDontToggleMaximizeVar, false).toBool();
// To disable window maximization, you should remove the WS_MAXIMIZEBOX style from the window instead.
Q_UNUSED(dontToggleMaximize);
if (frameBorderVisible) { if (frameBorderVisible) {
// This will handle the left, right and bottom parts of the frame // This will handle the left, right and bottom parts of the frame
// because we didn't change them. // because we didn't change them.

View File

@ -1028,4 +1028,14 @@ void FramelessQuickHelper::itemChange(const ItemChange change, const ItemChangeD
} }
} }
void FramelessQuickHelper::classBegin()
{
QQuickItem::classBegin();
}
void FramelessQuickHelper::componentComplete()
{
QQuickItem::componentComplete();
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE

View File

@ -134,4 +134,12 @@ QColor FramelessQuickUtils::getSystemButtonBackgroundColor(const QuickGlobal::Sy
FRAMELESSHELPER_ENUM_QUICK_TO_CORE(ButtonState, state)); FRAMELESSHELPER_ENUM_QUICK_TO_CORE(ButtonState, state));
} }
void FramelessQuickUtils::classBegin()
{
}
void FramelessQuickUtils::componentComplete()
{
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE

View File

@ -284,5 +284,13 @@ void FramelessQuickWindow::toggleFullScreen()
d->toggleFullScreen(); d->toggleFullScreen();
} }
void FramelessQuickWindow::classBegin()
{
}
void FramelessQuickWindow::componentComplete()
{
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE
#endif #endif

View File

@ -38,4 +38,12 @@ QuickChromePalette::QuickChromePalette(QObject *parent) : ChromePalette(parent)
QuickChromePalette::~QuickChromePalette() = default; QuickChromePalette::~QuickChromePalette() = default;
void QuickChromePalette::classBegin()
{
}
void QuickChromePalette::componentComplete()
{
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE

View File

@ -237,4 +237,14 @@ void QuickImageItem::setSource(const QVariant &value)
d->setSource(value); d->setSource(value);
} }
void QuickImageItem::classBegin()
{
QQuickPaintedItem::classBegin();
}
void QuickImageItem::componentComplete()
{
QQuickPaintedItem::componentComplete();
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE

View File

@ -258,6 +258,16 @@ QSGNode *QuickMicaMaterial::updatePaintNode(QSGNode *old, UpdatePaintNodeData *d
return node; return node;
} }
void QuickMicaMaterial::classBegin()
{
QQuickItem::classBegin();
}
void QuickMicaMaterial::componentComplete()
{
QQuickItem::componentComplete();
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE
#include "quickmicamaterial.moc" #include "quickmicamaterial.moc"

View File

@ -280,5 +280,15 @@ void QuickStandardSystemButton::initialize()
setBackground(m_backgroundItem.data()); setBackground(m_backgroundItem.data());
} }
void QuickStandardSystemButton::classBegin()
{
QQuickButton::classBegin();
}
void QuickStandardSystemButton::componentComplete()
{
QQuickButton::componentComplete();
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))

View File

@ -570,5 +570,15 @@ void QuickStandardTitleBar::updateAll()
updateChromeButtonColor(); updateChromeButtonColor();
} }
void QuickStandardTitleBar::classBegin()
{
QQuickRectangle::classBegin();
}
void QuickStandardTitleBar::componentComplete()
{
QQuickRectangle::componentComplete();
}
FRAMELESSHELPER_END_NAMESPACE FRAMELESSHELPER_END_NAMESPACE
#endif #endif