finalize api update
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
ee2a9e6b19
commit
eeda750a61
|
@ -154,49 +154,69 @@
|
|||
#endif
|
||||
|
||||
#ifndef HKEY_CLASSES_ROOT
|
||||
# define HKEY_CLASSES_ROOT ((HKEY)(ULONG_PTR)((LONG)0x80000000))
|
||||
# define HKEY_CLASSES_ROOT (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000000))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_CURRENT_USER
|
||||
# define HKEY_CURRENT_USER ((HKEY)(ULONG_PTR)((LONG)0x80000001))
|
||||
# define HKEY_CURRENT_USER (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000001))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_LOCAL_MACHINE
|
||||
# define HKEY_LOCAL_MACHINE ((HKEY)(ULONG_PTR)((LONG)0x80000002))
|
||||
# define HKEY_LOCAL_MACHINE (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000002))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_USERS
|
||||
# define HKEY_USERS ((HKEY)(ULONG_PTR)((LONG)0x80000003))
|
||||
# define HKEY_USERS (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000003))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_PERFORMANCE_DATA
|
||||
# define HKEY_PERFORMANCE_DATA ((HKEY)(ULONG_PTR)((LONG)0x80000004))
|
||||
# define HKEY_PERFORMANCE_DATA (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000004))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_CURRENT_CONFIG
|
||||
# define HKEY_CURRENT_CONFIG ((HKEY)(ULONG_PTR)((LONG)0x80000005))
|
||||
# define HKEY_CURRENT_CONFIG (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000005))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_DYN_DATA
|
||||
# define HKEY_DYN_DATA ((HKEY)(ULONG_PTR)((LONG)0x80000006))
|
||||
# define HKEY_DYN_DATA (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000006))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_CURRENT_USER_LOCAL_SETTINGS
|
||||
# define HKEY_CURRENT_USER_LOCAL_SETTINGS ((HKEY)(ULONG_PTR)((LONG)0x80000007))
|
||||
# define HKEY_CURRENT_USER_LOCAL_SETTINGS (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000007))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_PERFORMANCE_TEXT
|
||||
# define HKEY_PERFORMANCE_TEXT ((HKEY)(ULONG_PTR)((LONG)0x80000050))
|
||||
# define HKEY_PERFORMANCE_TEXT (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000050))))
|
||||
#endif
|
||||
|
||||
#ifndef HKEY_PERFORMANCE_NLSTEXT
|
||||
# define HKEY_PERFORMANCE_NLSTEXT ((HKEY)(ULONG_PTR)((LONG)0x80000060))
|
||||
# define HKEY_PERFORMANCE_NLSTEXT (reinterpret_cast<HKEY>(static_cast<ULONG_PTR>(static_cast<LONG>(0x80000060))))
|
||||
#endif
|
||||
|
||||
#ifndef STATUS_SUCCESS
|
||||
# define STATUS_SUCCESS (static_cast<NTSTATUS>(0x00000000L))
|
||||
#endif
|
||||
|
||||
#ifndef WTNCA_NODRAWCAPTION
|
||||
# define WTNCA_NODRAWCAPTION (0x00000001) // don't draw the window caption
|
||||
#endif
|
||||
|
||||
#ifndef WTNCA_NODRAWICON
|
||||
# define WTNCA_NODRAWICON (0x00000002) // don't draw the system icon
|
||||
#endif
|
||||
|
||||
#ifndef WTNCA_NOSYSMENU
|
||||
# define WTNCA_NOSYSMENU (0x00000004) // don't expose the system menu icon functionality
|
||||
#endif
|
||||
|
||||
#ifndef WTNCA_NOMIRRORHELP
|
||||
# define WTNCA_NOMIRRORHELP (0x00000008) // don't mirror the question mark, even in RTL layout
|
||||
#endif
|
||||
|
||||
#ifndef WTNCA_VALIDBITS
|
||||
# define WTNCA_VALIDBITS (WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON | WTNCA_NOSYSMENU | WTNCA_NOMIRRORHELP)
|
||||
#endif
|
||||
|
||||
#ifndef EXTERN_C
|
||||
# define EXTERN_C extern "C"
|
||||
#endif
|
||||
|
@ -349,7 +369,7 @@ using WINDOWCOMPOSITIONATTRIBDATA = struct WINDOWCOMPOSITIONATTRIBDATA
|
|||
{
|
||||
WINDOWCOMPOSITIONATTRIB Attrib;
|
||||
PVOID pvData;
|
||||
SIZE_T cbData;
|
||||
DWORD cbData;
|
||||
};
|
||||
using PWINDOWCOMPOSITIONATTRIBDATA = WINDOWCOMPOSITIONATTRIBDATA *;
|
||||
using NPWINDOWCOMPOSITIONATTRIBDATA = WINDOWCOMPOSITIONATTRIBDATA NEAR *;
|
||||
|
@ -358,6 +378,18 @@ using LPWINDOWCOMPOSITIONATTRIBDATA = WINDOWCOMPOSITIONATTRIBDATA FAR *;
|
|||
using GetWindowCompositionAttributePtr = BOOL(WINAPI *)(HWND, PWINDOWCOMPOSITIONATTRIBDATA);
|
||||
using SetWindowCompositionAttributePtr = BOOL(WINAPI *)(HWND, PWINDOWCOMPOSITIONATTRIBDATA);
|
||||
|
||||
using _WINDOWTHEMEATTRIBUTETYPE = enum _WINDOWTHEMEATTRIBUTETYPE
|
||||
{
|
||||
_WTA_NONCLIENT = 1
|
||||
};
|
||||
|
||||
using WTA_OPTIONS2 = struct WTA_OPTIONS2
|
||||
{
|
||||
DWORD dwFlags; // Values for each style option specified in the bitmask.
|
||||
DWORD dwMask; // Bitmask for flags that are changing.
|
||||
};
|
||||
using PWTA_OPTIONS2 = WTA_OPTIONS2 *;
|
||||
|
||||
EXTERN_C_START
|
||||
|
||||
DECLSPEC_IMPORT MMRESULT WINAPI
|
||||
|
@ -397,7 +429,7 @@ GetSystemMetricsForDpi(
|
|||
|
||||
DECLSPEC_IMPORT UINT WINAPI
|
||||
GetDpiForWindow(
|
||||
_In_ HWND hwnd
|
||||
_In_ HWND hWnd
|
||||
);
|
||||
|
||||
DECLSPEC_IMPORT UINT WINAPI
|
||||
|
|
|
@ -99,7 +99,7 @@ FRAMELESSHELPER_CORE_API void showSystemMenu(
|
|||
const bool scaled);
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API QColor getFrameBorderColor(const bool active);
|
||||
FRAMELESSHELPER_CORE_API void updateWindowFrameBorderColor(const WId windowId, const bool dark);
|
||||
FRAMELESSHELPER_CORE_API void fixupQtInternals(const WId windowId);
|
||||
FRAMELESSHELPER_CORE_API void maybeFixupQtInternals(const WId windowId);
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API bool isWindowFrameBorderVisible();
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API bool isFrameBorderColorized();
|
||||
FRAMELESSHELPER_CORE_API void installSystemMenuHook(
|
||||
|
|
|
@ -50,7 +50,7 @@ class FRAMELESSHELPER_QUICK_API FramelessQuickHelper : public QQuickItem
|
|||
Q_PROPERTY(bool windowFixedSize READ isWindowFixedSize WRITE setWindowFixedSize NOTIFY windowFixedSizeChanged FINAL)
|
||||
Q_PROPERTY(bool blurBehindWindowEnabled READ isBlurBehindWindowEnabled WRITE setBlurBehindWindowEnabled NOTIFY blurBehindWindowEnabledChanged FINAL)
|
||||
Q_PROPERTY(QQuickWindow* window READ window NOTIFY windowChanged2 FINAL)
|
||||
Q_PROPERTY(bool extendsContentIntoTitleBar READ isContentExtendedIntoTitleBar WRITE setContentExtendedIntoTitleBar NOTIFY extendsContentIntoTitleBarChanged FINAL)
|
||||
Q_PROPERTY(bool extendsContentIntoTitleBar READ isContentExtendedIntoTitleBar WRITE extendsContentIntoTitleBar NOTIFY extendsContentIntoTitleBarChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit FramelessQuickHelper(QQuickItem *parent = nullptr);
|
||||
|
@ -65,8 +65,7 @@ public:
|
|||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
[[deprecated("Use the extendsContentIntoTitleBar property instead.")]] void extendsContentIntoTitleBar();
|
||||
void setContentExtendedIntoTitleBar(const bool value);
|
||||
void extendsContentIntoTitleBar(const bool value = true);
|
||||
|
||||
void setTitleBarItem(QQuickItem *value);
|
||||
void setSystemButton(QQuickItem *item, const QuickGlobal::SystemButtonType buttonType);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "framelessquickhelper.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QQuickItem;
|
||||
|
@ -51,7 +52,7 @@ public:
|
|||
Q_NODISCARD static const FramelessQuickHelperPrivate *get(const FramelessQuickHelper *pub);
|
||||
|
||||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||
void setContentExtendedIntoTitleBar(const bool value);
|
||||
void extendsContentIntoTitleBar(const bool value);
|
||||
|
||||
Q_NODISCARD QQuickItem *getTitleBarItem() const;
|
||||
void setTitleBarItem(QQuickItem *value);
|
||||
|
@ -95,6 +96,7 @@ private:
|
|||
QPointer<FramelessQuickHelper> q_ptr = nullptr;
|
||||
QColor m_savedWindowBackgroundColor = {};
|
||||
bool m_blurBehindWindowEnabled = false;
|
||||
std::optional<bool> m_extendIntoTitleBar = std::nullopt;
|
||||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -44,7 +44,7 @@ class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelper : public QObject
|
|||
Q_PROPERTY(bool windowFixedSize READ isWindowFixedSize WRITE setWindowFixedSize NOTIFY windowFixedSizeChanged FINAL)
|
||||
Q_PROPERTY(bool blurBehindWindowEnabled READ isBlurBehindWindowEnabled WRITE setBlurBehindWindowEnabled NOTIFY blurBehindWindowEnabledChanged FINAL)
|
||||
Q_PROPERTY(QWidget* window READ window NOTIFY windowChanged FINAL)
|
||||
Q_PROPERTY(bool extendsContentIntoTitleBar READ isContentExtendedIntoTitleBar WRITE setContentExtendedIntoTitleBar NOTIFY extendsContentIntoTitleBarChanged FINAL)
|
||||
Q_PROPERTY(bool extendsContentIntoTitleBar READ isContentExtendedIntoTitleBar WRITE extendsContentIntoTitleBar NOTIFY extendsContentIntoTitleBarChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit FramelessWidgetsHelper(QObject *parent = nullptr);
|
||||
|
@ -59,8 +59,7 @@ public:
|
|||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
[[deprecated("Use the extendsContentIntoTitleBar property instead.")]] void extendsContentIntoTitleBar();
|
||||
void setContentExtendedIntoTitleBar(const bool value);
|
||||
void extendsContentIntoTitleBar(const bool value = true);
|
||||
|
||||
void setTitleBarWidget(QWidget *widget);
|
||||
void setSystemButton(QWidget *widget, const Global::SystemButtonType buttonType);
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
Q_NODISCARD static const FramelessWidgetsHelperPrivate *get(const FramelessWidgetsHelper *pub);
|
||||
|
||||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||
void setContentExtendedIntoTitleBar(const bool value);
|
||||
void extendsContentIntoTitleBar(const bool value);
|
||||
|
||||
Q_NODISCARD QWidget *getTitleBarWidget() const;
|
||||
void setTitleBarWidget(QWidget *widget);
|
||||
|
|
|
@ -512,7 +512,7 @@ void FramelessHelperWin::addWindow(const SystemParameters ¶ms)
|
|||
}
|
||||
g_win32Helper()->mutex.unlock();
|
||||
// Some Qt internals have to be corrected.
|
||||
Utils::fixupQtInternals(windowId);
|
||||
Utils::maybeFixupQtInternals(windowId);
|
||||
// Qt maintains a frame margin internally, we need to update it accordingly
|
||||
// otherwise we'll get lots of warning messages when we change the window
|
||||
// geometry, it will also affect the final window geometry because QPA will
|
||||
|
@ -520,6 +520,8 @@ void FramelessHelperWin::addWindow(const SystemParameters ¶ms)
|
|||
Utils::updateInternalWindowFrameMargins(params.getWindowHandle(), true);
|
||||
// Tell DWM our preferred frame margin.
|
||||
Utils::updateWindowFrameMargins(windowId, false);
|
||||
// Tell DWM we don't use the window icon/caption/sysmenu, don't draw them.
|
||||
Utils::disableOriginalTitleBarFunctionalities(windowId);
|
||||
static const bool isWin10RS1OrGreater = Utils::isWindowsVersionOrGreater(WindowsVersion::_10_1607);
|
||||
if (isWin10RS1OrGreater) {
|
||||
// Tell DWM we may need dark theme non-client area (title bar & frame border).
|
||||
|
|
|
@ -45,6 +45,34 @@
|
|||
#include <uxtheme.h>
|
||||
#include <d2d1.h>
|
||||
|
||||
EXTERN_C [[nodiscard]] FRAMELESSHELPER_CORE_API HRESULT WINAPI
|
||||
SetWindowThemeAttribute2(const HWND hWnd, const _WINDOWTHEMEATTRIBUTETYPE attrib,
|
||||
PVOID pvData, const DWORD cbData
|
||||
)
|
||||
{
|
||||
Q_ASSERT(hWnd);
|
||||
Q_ASSERT(pvData);
|
||||
if (!hWnd || !pvData) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
FRAMELESSHELPER_STRING_CONSTANT(uxtheme)
|
||||
FRAMELESSHELPER_STRING_CONSTANT(SetWindowThemeAttribute)
|
||||
const auto loader = FRAMELESSHELPER_PREPEND_NAMESPACE(SysApiLoader)::instance();
|
||||
if (!loader->isAvailable(kuxtheme, kSetWindowThemeAttribute)) {
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
return (loader->get<decltype(&::SetWindowThemeAttribute2)>(kSetWindowThemeAttribute))(hWnd, attrib, pvData, cbData);
|
||||
}
|
||||
|
||||
EXTERN_C [[nodiscard]] FRAMELESSHELPER_CORE_API HRESULT WINAPI
|
||||
SetWindowThemeNonClientAttributes2(const HWND hWnd, const DWORD dwMask, const DWORD dwAttributes)
|
||||
{
|
||||
WTA_OPTIONS2 options = {};
|
||||
options.dwFlags = dwAttributes;
|
||||
options.dwMask = dwMask;
|
||||
return SetWindowThemeAttribute2(hWnd, _WTA_NONCLIENT, &options, sizeof(options));
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QMargins)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
@ -1145,7 +1173,7 @@ void Utils::updateWindowFrameBorderColor(const WId windowId, const bool dark)
|
|||
}
|
||||
}
|
||||
|
||||
void Utils::fixupQtInternals(const WId windowId)
|
||||
void Utils::maybeFixupQtInternals(const WId windowId)
|
||||
{
|
||||
Q_ASSERT(windowId);
|
||||
if (!windowId) {
|
||||
|
@ -1167,8 +1195,7 @@ void Utils::fixupQtInternals(const WId windowId)
|
|||
static constexpr const DWORD badClassStyle = (CS_HREDRAW | CS_VREDRAW);
|
||||
if (classStyle & badClassStyle) {
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
if (SetClassLongPtrW(hwnd, GCL_STYLE,
|
||||
static_cast<LONG_PTR>(classStyle & ~badClassStyle)) == 0) {
|
||||
if (SetClassLongPtrW(hwnd, GCL_STYLE, (classStyle & ~badClassStyle)) == 0) {
|
||||
WARNING << getSystemErrorMessage(kSetClassLongPtrW);
|
||||
} else {
|
||||
shouldUpdateFrame = true;
|
||||
|
@ -1191,8 +1218,7 @@ void Utils::fixupQtInternals(const WId windowId)
|
|||
(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME);
|
||||
if (!(windowStyle & goodWindowStyle)) {
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
if (SetWindowLongPtrW(hwnd, GWL_STYLE,
|
||||
static_cast<LONG_PTR>((windowStyle & ~WS_POPUP) | goodWindowStyle)) == 0) {
|
||||
if (SetWindowLongPtrW(hwnd, GWL_STYLE, ((windowStyle & ~WS_POPUP) | goodWindowStyle)) == 0) {
|
||||
WARNING << getSystemErrorMessage(kSetWindowLongPtrW);
|
||||
} else {
|
||||
shouldUpdateFrame = true;
|
||||
|
@ -1802,28 +1828,17 @@ bool Utils::isBlurBehindWindowSupported()
|
|||
|
||||
void Utils::disableOriginalTitleBarFunctionalities(const WId windowId, const bool disable)
|
||||
{
|
||||
#if 0
|
||||
Q_ASSERT(windowId);
|
||||
if (!windowId) {
|
||||
return;
|
||||
}
|
||||
if (!API_THEME_AVAILABLE(SetWindowThemeAttribute)) {
|
||||
return;
|
||||
}
|
||||
const auto hwnd = reinterpret_cast<HWND>(windowId);
|
||||
WTA_OPTIONS options;
|
||||
SecureZeroMemory(&options, sizeof(options));
|
||||
options.dwFlags = options.dwMask = (disable ?
|
||||
(WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON | WTNCA_NOSYSMENU) : 0);
|
||||
const HRESULT hr = API_CALL_FUNCTION(SetWindowThemeAttribute,
|
||||
hwnd, WTA_NONCLIENT, &options, sizeof(options));
|
||||
static constexpr const DWORD validBits = (WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON | WTNCA_NOSYSMENU);
|
||||
const DWORD mask = (disable ? validBits : 0);
|
||||
const HRESULT hr = SetWindowThemeNonClientAttributes2(hwnd, mask, mask);
|
||||
if (FAILED(hr)) {
|
||||
WARNING << __getSystemErrorMessage(kSetWindowThemeAttribute, hr);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(windowId);
|
||||
Q_UNUSED(disable);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Utils::setQtDarkModeAwareEnabled(const bool enable)
|
||||
|
|
|
@ -103,7 +103,8 @@ FramelessQuickHelperPrivate::FramelessQuickHelperPrivate(FramelessQuickHelper *q
|
|||
|
||||
FramelessQuickHelperPrivate::~FramelessQuickHelperPrivate()
|
||||
{
|
||||
detach();
|
||||
extendsContentIntoTitleBar(false);
|
||||
m_extendIntoTitleBar = std::nullopt;
|
||||
}
|
||||
|
||||
FramelessQuickHelperPrivate *FramelessQuickHelperPrivate::get(FramelessQuickHelper *pub)
|
||||
|
@ -129,7 +130,7 @@ bool FramelessQuickHelperPrivate::isContentExtendedIntoTitleBar() const
|
|||
return getWindowData().ready;
|
||||
}
|
||||
|
||||
void FramelessQuickHelperPrivate::setContentExtendedIntoTitleBar(const bool value)
|
||||
void FramelessQuickHelperPrivate::extendsContentIntoTitleBar(const bool value)
|
||||
{
|
||||
if (isContentExtendedIntoTitleBar() == value) {
|
||||
return;
|
||||
|
@ -139,6 +140,7 @@ void FramelessQuickHelperPrivate::setContentExtendedIntoTitleBar(const bool valu
|
|||
} else {
|
||||
detach();
|
||||
}
|
||||
m_extendIntoTitleBar = value;
|
||||
emitSignalForAllInstances(FRAMELESSHELPER_BYTEARRAY_LITERAL("extendsContentIntoTitleBarChanged"));
|
||||
}
|
||||
|
||||
|
@ -570,7 +572,7 @@ bool FramelessQuickHelperPrivate::eventFilter(QObject *object, QEvent *event)
|
|||
} else {
|
||||
const auto changeEvent = static_cast<QWindowStateChangeEvent *>(event);
|
||||
if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) {
|
||||
Utils::fixupQtInternals(windowId);
|
||||
Utils::maybeFixupQtInternals(windowId);
|
||||
if (isWin11OrGreater && roundCorner) {
|
||||
Utils::forceSquareCornersForWindow(windowId, false);
|
||||
}
|
||||
|
@ -864,7 +866,7 @@ FramelessQuickHelper *FramelessQuickHelper::get(QObject *object)
|
|||
instance->setParentItem(parentItem);
|
||||
instance->setParent(parent);
|
||||
// No need to do this here, we'll do it once the item has been assigned to a specific window.
|
||||
//instance->d_func()->attach();
|
||||
//instance->extendsContentIntoTitleBar();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
@ -902,15 +904,10 @@ bool FramelessQuickHelper::isContentExtendedIntoTitleBar() const
|
|||
return d->isContentExtendedIntoTitleBar();
|
||||
}
|
||||
|
||||
void FramelessQuickHelper::extendsContentIntoTitleBar()
|
||||
{
|
||||
setContentExtendedIntoTitleBar(true);
|
||||
}
|
||||
|
||||
void FramelessQuickHelper::setContentExtendedIntoTitleBar(const bool value)
|
||||
void FramelessQuickHelper::extendsContentIntoTitleBar(const bool value)
|
||||
{
|
||||
Q_D(FramelessQuickHelper);
|
||||
d->setContentExtendedIntoTitleBar(value);
|
||||
d->extendsContentIntoTitleBar(value);
|
||||
}
|
||||
|
||||
void FramelessQuickHelper::setTitleBarItem(QQuickItem *value)
|
||||
|
@ -1020,7 +1017,9 @@ void FramelessQuickHelper::itemChange(const ItemChange change, const ItemChangeD
|
|||
}
|
||||
}
|
||||
Q_D(FramelessQuickHelper);
|
||||
d->attach();
|
||||
if (d->m_extendIntoTitleBar.value_or(true)) {
|
||||
extendsContentIntoTitleBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ void FramelessQuickWindowPrivate::initialize()
|
|||
{
|
||||
Q_Q(FramelessQuickWindow);
|
||||
QQuickItem * const rootItem = q->contentItem();
|
||||
FramelessQuickHelper::get(rootItem)->setContentExtendedIntoTitleBar(true);
|
||||
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
||||
m_topBorderRectangle.reset(new QQuickRectangle(rootItem));
|
||||
m_topBorderRectangle->setZ(999); // Make sure the frame border stays on top of eveything.
|
||||
m_topBorderRectangle->setColor(kDefaultTransparentColor);
|
||||
|
|
|
@ -71,7 +71,7 @@ const FramelessDialogPrivate *FramelessDialogPrivate::get(const FramelessDialog
|
|||
void FramelessDialogPrivate::initialize()
|
||||
{
|
||||
Q_Q(FramelessDialog);
|
||||
FramelessWidgetsHelper::get(q)->setContentExtendedIntoTitleBar(true);
|
||||
FramelessWidgetsHelper::get(q)->extendsContentIntoTitleBar();
|
||||
m_helper.reset(new WidgetsSharedHelper(this));
|
||||
m_helper->setup(q);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ const FramelessMainWindowPrivate *FramelessMainWindowPrivate::get(const Frameles
|
|||
void FramelessMainWindowPrivate::initialize()
|
||||
{
|
||||
Q_Q(FramelessMainWindow);
|
||||
FramelessWidgetsHelper::get(q)->setContentExtendedIntoTitleBar(true);
|
||||
FramelessWidgetsHelper::get(q)->extendsContentIntoTitleBar();
|
||||
m_helper.reset(new WidgetsSharedHelper(this));
|
||||
m_helper->setup(q);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ const FramelessWidgetPrivate *FramelessWidgetPrivate::get(const FramelessWidget
|
|||
void FramelessWidgetPrivate::initialize()
|
||||
{
|
||||
Q_Q(FramelessWidget);
|
||||
FramelessWidgetsHelper::get(q)->setContentExtendedIntoTitleBar(true);
|
||||
FramelessWidgetsHelper::get(q)->extendsContentIntoTitleBar();
|
||||
m_helper.reset(new WidgetsSharedHelper(this));
|
||||
m_helper->setup(q);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ FramelessWidgetsHelperPrivate::FramelessWidgetsHelperPrivate(FramelessWidgetsHel
|
|||
|
||||
FramelessWidgetsHelperPrivate::~FramelessWidgetsHelperPrivate()
|
||||
{
|
||||
detach();
|
||||
extendsContentIntoTitleBar(false);
|
||||
}
|
||||
|
||||
FramelessWidgetsHelperPrivate *FramelessWidgetsHelperPrivate::get(FramelessWidgetsHelper *pub)
|
||||
|
@ -438,7 +438,7 @@ void FramelessWidgetsHelperPrivate::detach()
|
|||
emitSignalForAllInstances(FRAMELESSHELPER_BYTEARRAY_LITERAL("windowChanged"));
|
||||
}
|
||||
|
||||
void FramelessWidgetsHelperPrivate::setContentExtendedIntoTitleBar(const bool value)
|
||||
void FramelessWidgetsHelperPrivate::extendsContentIntoTitleBar(const bool value)
|
||||
{
|
||||
if (isContentExtendedIntoTitleBar() == value) {
|
||||
return;
|
||||
|
@ -821,7 +821,7 @@ FramelessWidgetsHelper *FramelessWidgetsHelper::get(QObject *object)
|
|||
FramelessWidgetsHelper *instance = parent->findChild<FramelessWidgetsHelper *>();
|
||||
if (!instance) {
|
||||
instance = new FramelessWidgetsHelper(parent);
|
||||
instance->d_func()->attach();
|
||||
instance->extendsContentIntoTitleBar();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
@ -856,15 +856,10 @@ bool FramelessWidgetsHelper::isContentExtendedIntoTitleBar() const
|
|||
return d->isContentExtendedIntoTitleBar();
|
||||
}
|
||||
|
||||
void FramelessWidgetsHelper::extendsContentIntoTitleBar()
|
||||
{
|
||||
setContentExtendedIntoTitleBar(true);
|
||||
}
|
||||
|
||||
void FramelessWidgetsHelper::setContentExtendedIntoTitleBar(const bool value)
|
||||
void FramelessWidgetsHelper::extendsContentIntoTitleBar(const bool value)
|
||||
{
|
||||
Q_D(FramelessWidgetsHelper);
|
||||
d->setContentExtendedIntoTitleBar(value);
|
||||
d->extendsContentIntoTitleBar(value);
|
||||
}
|
||||
|
||||
void FramelessWidgetsHelper::setTitleBarWidget(QWidget *widget)
|
||||
|
|
|
@ -168,7 +168,7 @@ void WidgetsSharedHelper::changeEventHandler(QEvent *event)
|
|||
} else {
|
||||
const auto changeEvent = static_cast<QWindowStateChangeEvent *>(event);
|
||||
if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) {
|
||||
Utils::fixupQtInternals(windowId);
|
||||
Utils::maybeFixupQtInternals(windowId);
|
||||
if (isWin11OrGreater && roundCorner) {
|
||||
Utils::forceSquareCornersForWindow(windowId, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue