large refactor
This commit is contained in:
parent
2db829884d
commit
6abb636a19
|
@ -55,6 +55,20 @@ option(FRAMELESSHELPER_EXAMPLES_STANDALONE "Build the demo projects as standalon
|
||||||
cmake_dependent_option(FRAMELESSHELPER_ENABLE_UNIVERSAL_BUILD "macOS only: build universal library/example for Mac." ON APPLE OFF)
|
cmake_dependent_option(FRAMELESSHELPER_ENABLE_UNIVERSAL_BUILD "macOS only: build universal library/example for Mac." ON APPLE OFF)
|
||||||
option(FRAMELESSHELPER_FORCE_LTO "Force enable LTO/LTCG even when building static libraries." OFF)
|
option(FRAMELESSHELPER_FORCE_LTO "Force enable LTO/LTCG even when building static libraries." OFF)
|
||||||
option(FRAMELESSHELPER_REPRODUCIBLE_OUTPUT "Don't update the build commit and date dynamically." ON)
|
option(FRAMELESSHELPER_REPRODUCIBLE_OUTPUT "Don't update the build commit and date dynamically." ON)
|
||||||
|
option(FRAMELESSHELPER_NO_WINDOW "Disable the pre-defined FramelessWindow wrapper class." OFF)
|
||||||
|
option(FRAMELESSHELPER_NO_TITLEBAR "Disable the pre-defined StandardTitleBar control." OFF)
|
||||||
|
option(FRAMELESSHELPER_NO_TRANSLATION "Don't bundle the I18N translations into the library." OFF)
|
||||||
|
option(FRAMELESSHELPER_NO_MICA_MATERIAL "Disable the cross-platform homemade Mica Material." OFF)
|
||||||
|
option(FRAMELESSHELPER_NO_BORDER_PAINTER "Disable the cross-platform window frame border painter." OFF)
|
||||||
|
option(FRAMELESSHELPER_NO_SYSTEM_BUTTON "Disable the pre-defined StandardSystemButton control." OFF)
|
||||||
|
|
||||||
|
set(PROJECT_VERSION_HEX "0x00000000")
|
||||||
|
math(EXPR PROJECT_VERSION_HEX "((${PROJECT_VERSION_MAJOR} & 0xff) << 24) | ((${PROJECT_VERSION_MINOR} & 0xff) << 16) | ((${PROJECT_VERSION_PATCH} & 0xff) << 8)" OUTPUT_FORMAT HEXADECIMAL)
|
||||||
|
|
||||||
|
set(FRAMELESSHELPER_64BIT_POSTFIX "")
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(FRAMELESSHELPER_64BIT_POSTFIX "64")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui)
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)
|
||||||
|
@ -80,7 +94,7 @@ if(FRAMELESSHELPER_ENABLE_VCLTL AND NOT MSVC)
|
||||||
message(WARNING "VC-LTL is only available for the MSVC toolchain.")
|
message(WARNING "VC-LTL is only available for the MSVC toolchain.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(__extra_flags)
|
set(__extra_flags "")
|
||||||
if(NOT FRAMELESSHELPER_BUILD_STATIC)
|
if(NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||||
list(APPEND __extra_flags ENABLE_LTO)
|
list(APPEND __extra_flags ENABLE_LTO)
|
||||||
endif()
|
endif()
|
||||||
|
@ -130,7 +144,7 @@ if(MSVC)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(__extra_flags)
|
set(__extra_flags "")
|
||||||
if(FRAMELESSHELPER_NO_INSTALL)
|
if(FRAMELESSHELPER_NO_INSTALL)
|
||||||
list(APPEND __extra_flags NO_INSTALL)
|
list(APPEND __extra_flags NO_INSTALL)
|
||||||
endif()
|
endif()
|
||||||
|
@ -158,7 +172,7 @@ if(FRAMELESSHELPER_BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT FRAMELESSHELPER_NO_INSTALL)
|
if(WIN32 AND NOT FRAMELESSHELPER_NO_INSTALL)
|
||||||
install(FILES "msbuild/FramelessHelper.props" DESTINATION ".")
|
install(FILES "msbuild/FramelessHelper.props" DESTINATION ".")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -234,5 +248,11 @@ if(NOT FRAMELESSHELPER_NO_SUMMARY)
|
||||||
message("[macOS]: Build universal library/example: ${FRAMELESSHELPER_ENABLE_UNIVERSAL_BUILD}")
|
message("[macOS]: Build universal library/example: ${FRAMELESSHELPER_ENABLE_UNIVERSAL_BUILD}")
|
||||||
message("Force enable LTO: ${FRAMELESSHELPER_FORCE_LTO}")
|
message("Force enable LTO: ${FRAMELESSHELPER_FORCE_LTO}")
|
||||||
message("Make output reproducible: ${FRAMELESSHELPER_REPRODUCIBLE_OUTPUT}")
|
message("Make output reproducible: ${FRAMELESSHELPER_REPRODUCIBLE_OUTPUT}")
|
||||||
|
message("Disable the FramelessWindow class (to reduce file size): ${FRAMELESSHELPER_NO_WINDOW}")
|
||||||
|
message("Disable the StandardTitleBar class (to reduce file size): ${FRAMELESSHELPER_NO_TITLEBAR}")
|
||||||
|
message("Don't embed the I18N resources (to reduce file size): ${FRAMELESSHELPER_NO_TRANSLATION}")
|
||||||
|
message("Disable the MicaMaterial class (to reduce file size): ${FRAMELESSHELPER_NO_MICA_MATERIAL}")
|
||||||
|
message("Disable the WindowBorderPainter class (to reduce file size): ${FRAMELESSHELPER_NO_BORDER_PAINTER}")
|
||||||
|
message("Disable the StandardSystemButton class (to reduce file size): ${FRAMELESSHELPER_NO_SYSTEM_BUTTON}")
|
||||||
message("-----------------------------------------------------------------")
|
message("-----------------------------------------------------------------")
|
||||||
endif()
|
endif()
|
||||||
|
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit 7215bd692b7a62f307c7dffbe200554a12aabbf4
|
Subproject commit a0d72f177e9a919c1f273b67d0456a052020781a
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class ChromePalettePrivate;
|
class ChromePalettePrivate;
|
||||||
|
@ -33,6 +35,7 @@ class ChromePalettePrivate;
|
||||||
class FRAMELESSHELPER_CORE_API ChromePalette : public QObject
|
class FRAMELESSHELPER_CORE_API ChromePalette : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(ChromePalette)
|
Q_DECLARE_PRIVATE(ChromePalette)
|
||||||
Q_DISABLE_COPY_MOVE(ChromePalette)
|
Q_DISABLE_COPY_MOVE(ChromePalette)
|
||||||
|
|
||||||
|
@ -123,3 +126,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct SystemParameters;
|
||||||
class FRAMELESSHELPER_CORE_API FramelessHelperQt : public QObject
|
class FRAMELESSHELPER_CORE_API FramelessHelperQt : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(FramelessHelperQt)
|
Q_DISABLE_COPY_MOVE(FramelessHelperQt)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
#include <QtCore/qabstractnativeeventfilter.h>
|
#include <QtCore/qabstractnativeeventfilter.h>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
struct SystemParameters;
|
struct SystemParameters;
|
||||||
|
@ -46,3 +48,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "framelesshelper.config"
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <QtCore/qmath.h>
|
#include <QtCore/qmath.h>
|
||||||
#include <QtCore/qpoint.h>
|
#include <QtCore/qpoint.h>
|
||||||
|
@ -165,6 +166,41 @@ QT_END_NAMESPACE
|
||||||
} while (false)
|
} while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_QUOTE
|
||||||
|
# define FRAMELESSHELPER_QUOTE(x) #x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_QUOTE2
|
||||||
|
# define FRAMELESSHELPER_QUOTE2(x) FRAMELESSHELPER_QUOTE(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_CONCAT
|
||||||
|
# define FRAMELESSHELPER_CONCAT(a, b) a##b
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_CONCAT2
|
||||||
|
# define FRAMELESSHELPER_CONCAT2(a, b) FRAMELESSHELPER_CONCAT(a, b)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
The FRAMELESSHELPER_CONFIG macro implements a safe compile time check for features of FramelessHelper.
|
||||||
|
Features can be in three states:
|
||||||
|
0 or undefined: This will lead to a compile error when testing for it
|
||||||
|
-1: The feature is not available
|
||||||
|
1: The feature is available
|
||||||
|
*/
|
||||||
|
#ifndef FRAMELESSHELPER_CONFIG
|
||||||
|
# define FRAMELESSHELPER_CONFIG(feature) ((1 / FRAMELESSHELPER_FEATURE_##feature) == 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_REQUIRE_CONFIG
|
||||||
|
# define FRAMELESSHELPER_REQUIRE_CONFIG(feature) static_assert(FRAMELESSHELPER_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " is not available!")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_CLASS_INFO
|
||||||
|
# define FRAMELESSHELPER_CLASS_INFO Q_CLASSINFO("__FRAMELESSHELPER__", FRAMELESSHELPER_QUOTE2(__FRAMELESSHELPER__))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_BYTEARRAY_CONSTANT2
|
#ifndef FRAMELESSHELPER_BYTEARRAY_CONSTANT2
|
||||||
# define FRAMELESSHELPER_BYTEARRAY_CONSTANT2(name, ba) \
|
# define FRAMELESSHELPER_BYTEARRAY_CONSTANT2(name, ba) \
|
||||||
[[maybe_unused]] static constexpr const auto k##name = FRAMELESSHELPER_BYTEARRAY(ba);
|
[[maybe_unused]] static constexpr const auto k##name = FRAMELESSHELPER_BYTEARRAY(ba);
|
||||||
|
@ -217,11 +253,12 @@ QT_END_NAMESPACE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
// Call this function in your main() function if you are using FramelessHelper as a static library,
|
// Call this function in your main() function if you are using FramelessHelper as a static library,
|
||||||
// it can make sure the resources bundled in the static library are correctly initialized.
|
// it can make sure the resources bundled in the static library are correctly initialized.
|
||||||
// NOTE: This function is intentionally not inside any namespaces.
|
// NOTE: This function is intentionally not inside any namespaces.
|
||||||
FRAMELESSHELPER_CORE_API void framelesshelpercore_initResource();
|
FRAMELESSHELPER_CORE_API void FramelessHelperCoreInitResource();
|
||||||
|
inline void framelesshelpercore_initResource() { FramelessHelperCoreInitResource(); }
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
@ -474,17 +511,43 @@ struct Dpi
|
||||||
{
|
{
|
||||||
return !operator==(lhs, rhs);
|
return !operator==(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator>(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||||
|
{
|
||||||
|
return ((lhs.x * lhs.y) > (rhs.x * rhs.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator>=(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||||
|
{
|
||||||
|
return (operator>(lhs, rhs) || operator==(lhs, rhs));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator<(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||||
|
{
|
||||||
|
return (operator!=(lhs, rhs) && !operator>(lhs, rhs));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator<=(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||||
|
{
|
||||||
|
return (operator<(lhs, rhs) || operator==(lhs, rhs));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Global
|
} // namespace Global
|
||||||
|
|
||||||
|
FRAMELESSHELPER_CORE_API void FramelessHelperCoreInitialize();
|
||||||
|
FRAMELESSHELPER_CORE_API void FramelessHelperCoreUninitialize();
|
||||||
|
[[nodiscard]] FRAMELESSHELPER_CORE_API Global::VersionInfo FramelessHelperVersion();
|
||||||
|
FRAMELESSHELPER_CORE_API void FramelessHelperEnableThemeAware();
|
||||||
|
FRAMELESSHELPER_CORE_API void FramelessHelperPrintLogo();
|
||||||
|
|
||||||
namespace FramelessHelper::Core
|
namespace FramelessHelper::Core
|
||||||
{
|
{
|
||||||
FRAMELESSHELPER_CORE_API void initialize();
|
inline void initialize() { FramelessHelperCoreInitialize(); }
|
||||||
FRAMELESSHELPER_CORE_API void uninitialize();
|
inline void uninitialize() { FramelessHelperCoreUninitialize(); }
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API Global::VersionInfo version();
|
[[nodiscard]] inline Global::VersionInfo version() { return FramelessHelperVersion(); }
|
||||||
FRAMELESSHELPER_CORE_API void setApplicationOSThemeAware();
|
inline void setApplicationOSThemeAware() { FramelessHelperEnableThemeAware(); }
|
||||||
FRAMELESSHELPER_CORE_API void outputLogo();
|
inline void outputLogo() { FramelessHelperPrintLogo(); }
|
||||||
} // namespace FramelessHelper::Core
|
} // namespace FramelessHelper::Core
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -34,6 +34,7 @@ class FramelessManagerPrivate;
|
||||||
class FRAMELESSHELPER_CORE_API FramelessManager : public QObject
|
class FRAMELESSHELPER_CORE_API FramelessManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(FramelessManager)
|
Q_DECLARE_PRIVATE(FramelessManager)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessManager)
|
Q_DISABLE_COPY_MOVE(FramelessManager)
|
||||||
Q_PROPERTY(Global::SystemTheme systemTheme READ systemTheme WRITE setOverrideTheme NOTIFY systemThemeChanged FINAL)
|
Q_PROPERTY(Global::SystemTheme systemTheme READ systemTheme WRITE setOverrideTheme NOTIFY systemThemeChanged FINAL)
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class MicaMaterialPrivate;
|
class MicaMaterialPrivate;
|
||||||
|
@ -33,6 +35,7 @@ class MicaMaterialPrivate;
|
||||||
class FRAMELESSHELPER_CORE_API MicaMaterial : public QObject
|
class FRAMELESSHELPER_CORE_API MicaMaterial : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(MicaMaterial)
|
Q_DISABLE_COPY_MOVE(MicaMaterial)
|
||||||
Q_DECLARE_PRIVATE(MicaMaterial)
|
Q_DECLARE_PRIVATE(MicaMaterial)
|
||||||
|
|
||||||
|
@ -83,3 +86,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class ChromePalette;
|
class ChromePalette;
|
||||||
|
@ -34,6 +36,7 @@ class ChromePalette;
|
||||||
class FRAMELESSHELPER_CORE_API ChromePalettePrivate : public QObject
|
class FRAMELESSHELPER_CORE_API ChromePalettePrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(ChromePalette)
|
Q_DECLARE_PUBLIC(ChromePalette)
|
||||||
Q_DISABLE_COPY_MOVE(ChromePalettePrivate)
|
Q_DISABLE_COPY_MOVE(ChromePalettePrivate)
|
||||||
|
|
||||||
|
@ -72,3 +75,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -31,6 +31,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
class FRAMELESSHELPER_CORE_API FramelessConfig : public QObject
|
class FRAMELESSHELPER_CORE_API FramelessConfig : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(FramelessConfig)
|
Q_DISABLE_COPY_MOVE(FramelessConfig)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -33,9 +33,6 @@ QT_END_NAMESPACE
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
using InitializeHookCallback = std::function<void()>;
|
|
||||||
using UninitializeHookCallback = std::function<void()>;
|
|
||||||
|
|
||||||
using GetWindowFlagsCallback = std::function<Qt::WindowFlags()>;
|
using GetWindowFlagsCallback = std::function<Qt::WindowFlags()>;
|
||||||
using SetWindowFlagsCallback = std::function<void(const Qt::WindowFlags)>;
|
using SetWindowFlagsCallback = std::function<void(const Qt::WindowFlags)>;
|
||||||
using GetWindowSizeCallback = std::function<QSize()>;
|
using GetWindowSizeCallback = std::function<QSize()>;
|
||||||
|
@ -102,9 +99,6 @@ using FramelessParamsConst = const SystemParameters *;
|
||||||
using FramelessParamsRef = SystemParameters &;
|
using FramelessParamsRef = SystemParameters &;
|
||||||
using FramelessParamsConstRef = const SystemParameters &;
|
using FramelessParamsConstRef = const SystemParameters &;
|
||||||
|
|
||||||
FRAMELESSHELPER_CORE_API void registerInitializeHook(const InitializeHookCallback &cb);
|
|
||||||
FRAMELESSHELPER_CORE_API void registerUninitializeHook(const UninitializeHookCallback &cb);
|
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#define DECLARE_SIZE_COMPARE_OPERATORS(Type1, Type2) \
|
#define DECLARE_SIZE_COMPARE_OPERATORS(Type1, Type2) \
|
||||||
|
|
|
@ -36,6 +36,7 @@ class FramelessManager;
|
||||||
class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
|
class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessManager)
|
Q_DECLARE_PUBLIC(FramelessManager)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessManagerPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessManagerPrivate)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
#include <QtGui/qbrush.h>
|
#include <QtGui/qbrush.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class MicaMaterial;
|
class MicaMaterial;
|
||||||
|
@ -34,6 +36,7 @@ class MicaMaterial;
|
||||||
class FRAMELESSHELPER_CORE_API MicaMaterialPrivate : public QObject
|
class FRAMELESSHELPER_CORE_API MicaMaterialPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(MicaMaterialPrivate)
|
Q_DISABLE_COPY_MOVE(MicaMaterialPrivate)
|
||||||
Q_DECLARE_PUBLIC(MicaMaterial)
|
Q_DECLARE_PUBLIC(MicaMaterial)
|
||||||
|
|
||||||
|
@ -69,3 +72,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include <QtCore/qvariant.h>
|
#include <QtCore/qvariant.h>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
#ifndef REGISTRYKEY_FORCE_QSETTINGS
|
#ifndef REGISTRYKEY_FORCE_QSETTINGS
|
||||||
# define REGISTRYKEY_FORCE_QSETTINGS (0)
|
# define REGISTRYKEY_FORCE_QSETTINGS (0)
|
||||||
#endif // REGISTRYKEY_FORCE_QSETTINGS
|
#endif // REGISTRYKEY_FORCE_QSETTINGS
|
||||||
|
@ -58,6 +60,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
class FRAMELESSHELPER_CORE_API RegistryKey : public QObject
|
class FRAMELESSHELPER_CORE_API RegistryKey : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(RegistryKey)
|
Q_DISABLE_COPY_MOVE(RegistryKey)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -91,3 +94,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -31,6 +31,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
class FRAMELESSHELPER_CORE_API SysApiLoader : public QObject
|
class FRAMELESSHELPER_CORE_API SysApiLoader : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(SysApiLoader)
|
Q_DISABLE_COPY_MOVE(SysApiLoader)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -86,7 +87,7 @@ FRAMELESSHELPER_END_NAMESPACE
|
||||||
# define API_NT_AVAILABLE(func) API_AVAILABLE(ntdll, func)
|
# define API_NT_AVAILABLE(func) API_AVAILABLE(ntdll, func)
|
||||||
#endif // Q_OS_WINDOWS
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
# define API_XLIB_AVAILABLE(func) API_AVAILABLE(libX11, func)
|
# define API_XLIB_AVAILABLE(func) API_AVAILABLE(libX11, func)
|
||||||
# define API_XCB_AVAILABLE(func) API_AVAILABLE(libxcb, func)
|
# define API_XCB_AVAILABLE(func) API_AVAILABLE(libxcb, func)
|
||||||
# define API_GTK_AVAILABLE(func) API_AVAILABLE(libgtk, func)
|
# define API_GTK_AVAILABLE(func) API_AVAILABLE(libgtk, func)
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class WindowBorderPainter;
|
class WindowBorderPainter;
|
||||||
|
@ -34,6 +36,7 @@ class WindowBorderPainter;
|
||||||
class FRAMELESSHELPER_CORE_API WindowBorderPainterPrivate : public QObject
|
class FRAMELESSHELPER_CORE_API WindowBorderPainterPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(WindowBorderPainter)
|
Q_DECLARE_PUBLIC(WindowBorderPainter)
|
||||||
Q_DISABLE_COPY_MOVE(WindowBorderPainterPrivate)
|
Q_DISABLE_COPY_MOVE(WindowBorderPainterPrivate)
|
||||||
|
|
||||||
|
@ -52,3 +55,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace WindowsVersionHelper
|
namespace WindowsVersionHelper
|
||||||
|
@ -68,3 +70,5 @@ DECL(1122H2)
|
||||||
} // namespace WindowsVersionHelper
|
} // namespace WindowsVersionHelper
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
#ifdef Q_OS_LINUX
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
# include <FramelessHelper/Core/framelesshelper_linux.h>
|
# include <FramelessHelper/Core/framelesshelper_linux.h>
|
||||||
#endif // Q_OS_LINUX
|
#endif // Q_OS_LINUX
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QScreen;
|
class QScreen;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -155,7 +155,7 @@ FRAMELESSHELPER_CORE_API void moveWindowToDesktopCenter(
|
||||||
FRAMELESSHELPER_CORE_API void printWin32Message(void *msg);
|
FRAMELESSHELPER_CORE_API void printWin32Message(void *msg);
|
||||||
#endif // Q_OS_WINDOWS
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API QScreen *x11_findScreenForVirtualDesktop
|
[[nodiscard]] FRAMELESSHELPER_CORE_API QScreen *x11_findScreenForVirtualDesktop
|
||||||
(const int virtualDesktopNumber);
|
(const int virtualDesktopNumber);
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_appRootWindow(const int screen);
|
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_appRootWindow(const int screen);
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class WindowBorderPainterPrivate;
|
class WindowBorderPainterPrivate;
|
||||||
|
@ -33,6 +35,7 @@ class WindowBorderPainterPrivate;
|
||||||
class FRAMELESSHELPER_CORE_API WindowBorderPainter : public QObject
|
class FRAMELESSHELPER_CORE_API WindowBorderPainter : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(WindowBorderPainter)
|
Q_DISABLE_COPY_MOVE(WindowBorderPainter)
|
||||||
Q_DECLARE_PRIVATE(WindowBorderPainter)
|
Q_DECLARE_PRIVATE(WindowBorderPainter)
|
||||||
|
|
||||||
|
@ -80,3 +83,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "quickimageitem.h"
|
|
|
@ -77,9 +77,14 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
[[maybe_unused]] inline constexpr const int FRAMELESSHELPER_QUICK_VERSION_MAJOR = 1;
|
[[maybe_unused]] inline constexpr const int FRAMELESSHELPER_QUICK_VERSION_MAJOR = 1;
|
||||||
[[maybe_unused]] inline constexpr const int FRAMELESSHELPER_QUICK_VERSION_MINOR = 0;
|
[[maybe_unused]] inline constexpr const int FRAMELESSHELPER_QUICK_VERSION_MINOR = 0;
|
||||||
|
|
||||||
|
FRAMELESSHELPER_QUICK_API void FramelessHelperQuickInitialize();
|
||||||
|
FRAMELESSHELPER_QUICK_API void FramelessHelperQuickUninitialize();
|
||||||
|
FRAMELESSHELPER_QUICK_API void FramelessHelperQuickRegisterTypes(QQmlEngine *);
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API QuickGlobal : public QObject
|
class FRAMELESSHELPER_QUICK_API QuickGlobal : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(QuickGlobal)
|
Q_DISABLE_COPY_MOVE(QuickGlobal)
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(FramelessHelperConstants)
|
QML_NAMED_ELEMENT(FramelessHelperConstants)
|
||||||
|
@ -148,8 +153,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QuickGlobal::WindowEdges)
|
||||||
|
|
||||||
namespace FramelessHelper::Quick
|
namespace FramelessHelper::Quick
|
||||||
{
|
{
|
||||||
FRAMELESSHELPER_QUICK_API void initialize();
|
inline void initialize() { FramelessHelperQuickInitialize(); }
|
||||||
FRAMELESSHELPER_QUICK_API void uninitialize();
|
inline void uninitialize() { FramelessHelperQuickUninitialize(); }
|
||||||
} // namespace FramelessHelper::Quick
|
} // namespace FramelessHelper::Quick
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -30,13 +30,18 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessQuickHelperPrivate;
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
class QuickMicaMaterial;
|
class QuickMicaMaterial;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
class QuickWindowBorder;
|
class QuickWindowBorder;
|
||||||
|
#endif
|
||||||
|
class FramelessQuickHelperPrivate;
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickHelper : public QQuickItem
|
class FRAMELESSHELPER_QUICK_API FramelessQuickHelper : public QQuickItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(FramelessHelper)
|
QML_NAMED_ELEMENT(FramelessHelper)
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,8 +68,12 @@ public:
|
||||||
Q_NODISCARD bool isBlurBehindWindowEnabled() const;
|
Q_NODISCARD bool isBlurBehindWindowEnabled() const;
|
||||||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
Q_NODISCARD QuickMicaMaterial *micaMaterial() const;
|
Q_NODISCARD QuickMicaMaterial *micaMaterial() const;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_NODISCARD QuickWindowBorder *windowBorder() const;
|
Q_NODISCARD QuickWindowBorder *windowBorder() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_NODISCARD bool isReady() const;
|
Q_NODISCARD bool isReady() const;
|
||||||
void waitForReady();
|
void waitForReady();
|
||||||
|
|
|
@ -34,7 +34,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace FramelessHelper::Quick
|
namespace FramelessHelper::Quick
|
||||||
{
|
{
|
||||||
FRAMELESSHELPER_QUICK_API void registerTypes(QQmlEngine *engine);
|
inline void registerTypes(QQmlEngine *engine) { FramelessHelperQuickRegisterTypes(engine); }
|
||||||
} // namespace FramelessHelper::Quick
|
} // namespace FramelessHelper::Quick
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -36,6 +36,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQmlParserStatus
|
class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQmlParserStatus
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(FramelessQuickUtils)
|
Q_DISABLE_COPY_MOVE(FramelessQuickUtils)
|
||||||
Q_INTERFACES(QQmlParserStatus)
|
Q_INTERFACES(QQmlParserStatus)
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
|
|
|
@ -24,9 +24,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
|
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
@ -36,6 +37,7 @@ class FramelessQuickApplicationWindowPrivate;
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindow : public QQuickApplicationWindow
|
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindow : public QQuickApplicationWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(FramelessApplicationWindow)
|
QML_NAMED_ELEMENT(FramelessApplicationWindow)
|
||||||
#endif
|
#endif
|
||||||
|
@ -82,4 +84,4 @@ private:
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -24,19 +24,23 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
#include <QtQuick/qquickwindow.h>
|
#include <QtQuick/qquickwindow.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessQuickApplicationWindow;
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
class QuickWindowBorder;
|
class QuickWindowBorder;
|
||||||
|
#endif
|
||||||
|
class FramelessQuickApplicationWindow;
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindowPrivate : public QObject
|
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindowPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessQuickApplicationWindow)
|
Q_DECLARE_PUBLIC(FramelessQuickApplicationWindow)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessQuickApplicationWindowPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessQuickApplicationWindowPrivate)
|
||||||
|
|
||||||
|
@ -48,10 +52,12 @@ public:
|
||||||
Q_NODISCARD static const FramelessQuickApplicationWindowPrivate *get(const FramelessQuickApplicationWindow *pub);
|
Q_NODISCARD static const FramelessQuickApplicationWindowPrivate *get(const FramelessQuickApplicationWindow *pub);
|
||||||
|
|
||||||
FramelessQuickApplicationWindow *q_ptr = nullptr;
|
FramelessQuickApplicationWindow *q_ptr = nullptr;
|
||||||
QuickWindowBorder *windowBorder = nullptr;
|
|
||||||
QQuickWindow::Visibility savedVisibility = QQuickWindow::Windowed;
|
QQuickWindow::Visibility savedVisibility = QQuickWindow::Windowed;
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
QuickWindowBorder *windowBorder = nullptr;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -33,14 +33,19 @@ QT_END_NAMESPACE
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessQuickHelper;
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
class QuickMicaMaterial;
|
class QuickMicaMaterial;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
class QuickWindowBorder;
|
class QuickWindowBorder;
|
||||||
|
#endif
|
||||||
|
class FramelessQuickHelper;
|
||||||
struct FramelessQuickHelperData;
|
struct FramelessQuickHelperData;
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
|
class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessQuickHelper)
|
Q_DECLARE_PUBLIC(FramelessQuickHelper)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessQuickHelperPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessQuickHelperPrivate)
|
||||||
|
|
||||||
|
@ -59,8 +64,12 @@ public:
|
||||||
void setProperty(const char *name, const QVariant &value);
|
void setProperty(const char *name, const QVariant &value);
|
||||||
Q_NODISCARD QVariant getProperty(const char *name, const QVariant &defaultValue = {});
|
Q_NODISCARD QVariant getProperty(const char *name, const QVariant &defaultValue = {});
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
Q_NODISCARD QuickMicaMaterial *findOrCreateMicaMaterial() const;
|
Q_NODISCARD QuickMicaMaterial *findOrCreateMicaMaterial() const;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_NODISCARD QuickWindowBorder *findOrCreateWindowBorder() const;
|
Q_NODISCARD QuickWindowBorder *findOrCreateWindowBorder() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_NODISCARD static FramelessQuickHelper *findOrCreateFramelessHelper(QObject *object);
|
Q_NODISCARD static FramelessQuickHelper *findOrCreateFramelessHelper(QObject *object);
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||||
|
|
||||||
#include <QtQuick/private/qquickwindowmodule_p.h>
|
#include <QtQuick/private/qquickwindowmodule_p.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
@ -36,6 +37,7 @@ class FramelessQuickWindowPrivate;
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickWindow : public QQuickWindowQmlImpl
|
class FRAMELESSHELPER_QUICK_API FramelessQuickWindow : public QQuickWindowQmlImpl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(FramelessWindow)
|
QML_NAMED_ELEMENT(FramelessWindow)
|
||||||
#endif
|
#endif
|
||||||
|
@ -82,4 +84,4 @@ private:
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -24,19 +24,23 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||||
|
|
||||||
#include <QtQuick/qquickwindow.h>
|
#include <QtQuick/qquickwindow.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessQuickWindow;
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
class QuickWindowBorder;
|
class QuickWindowBorder;
|
||||||
|
#endif
|
||||||
|
class FramelessQuickWindow;
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API FramelessQuickWindowPrivate : public QObject
|
class FRAMELESSHELPER_QUICK_API FramelessQuickWindowPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessQuickWindow)
|
Q_DECLARE_PUBLIC(FramelessQuickWindow)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessQuickWindowPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessQuickWindowPrivate)
|
||||||
|
|
||||||
|
@ -48,10 +52,12 @@ public:
|
||||||
Q_NODISCARD static const FramelessQuickWindowPrivate *get(const FramelessQuickWindow *pub);
|
Q_NODISCARD static const FramelessQuickWindowPrivate *get(const FramelessQuickWindow *pub);
|
||||||
|
|
||||||
FramelessQuickWindow *q_ptr = nullptr;
|
FramelessQuickWindow *q_ptr = nullptr;
|
||||||
QuickWindowBorder *windowBorder = nullptr;
|
|
||||||
QQuickWindow::Visibility savedVisibility = QQuickWindow::Windowed;
|
QQuickWindow::Visibility savedVisibility = QQuickWindow::Windowed;
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
QuickWindowBorder *windowBorder = nullptr;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -26,24 +26,38 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
#include <QtCore/qvariant.h>
|
#include <QtCore/qvariant.h>
|
||||||
|
#include <QtQuick/qquickpainteditem.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QuickImageItem;
|
class FRAMELESSHELPER_QUICK_API QuickImageItem : public QQuickPaintedItem
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API QuickImageItemPrivate : public QObject
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY_MOVE(QuickImageItemPrivate)
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(QuickImageItem)
|
#ifdef QML_NAMED_ELEMENT
|
||||||
|
QML_NAMED_ELEMENT(ImageItem)
|
||||||
|
#endif
|
||||||
|
Q_DISABLE_COPY_MOVE(QuickImageItem)
|
||||||
|
|
||||||
|
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QuickImageItemPrivate(QuickImageItem *q);
|
explicit QuickImageItem(QQuickItem *parent = nullptr);
|
||||||
~QuickImageItemPrivate() override;
|
~QuickImageItem() override;
|
||||||
|
|
||||||
Q_NODISCARD static QuickImageItemPrivate *get(QuickImageItem *q);
|
void paint(QPainter *painter) override;
|
||||||
Q_NODISCARD static const QuickImageItemPrivate *get(const QuickImageItem *q);
|
|
||||||
|
|
||||||
|
Q_NODISCARD QVariant source() const;
|
||||||
|
void setSource(const QVariant &value);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void sourceChanged();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void classBegin() override;
|
||||||
|
void componentComplete() override;
|
||||||
|
|
||||||
|
private:
|
||||||
void fromUrl(const QUrl &value, QPainter *painter) const;
|
void fromUrl(const QUrl &value, QPainter *painter) const;
|
||||||
void fromString(const QString &value, QPainter *painter) const;
|
void fromString(const QString &value, QPainter *painter) const;
|
||||||
void fromImage(const QImage &value, QPainter *painter) const;
|
void fromImage(const QImage &value, QPainter *painter) const;
|
||||||
|
@ -51,8 +65,8 @@ public:
|
||||||
void fromIcon(const QIcon &value, QPainter *painter) const;
|
void fromIcon(const QIcon &value, QPainter *painter) const;
|
||||||
Q_NODISCARD QRectF paintArea() const;
|
Q_NODISCARD QRectF paintArea() const;
|
||||||
|
|
||||||
QuickImageItem *q_ptr = nullptr;
|
private:
|
||||||
QVariant source = {};
|
QVariant m_source = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class MicaMaterial;
|
class MicaMaterial;
|
||||||
|
@ -34,6 +36,7 @@ class QuickMicaMaterial;
|
||||||
class FRAMELESSHELPER_QUICK_API QuickMicaMaterialPrivate : public QObject
|
class FRAMELESSHELPER_QUICK_API QuickMicaMaterialPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(QuickMicaMaterialPrivate)
|
Q_DISABLE_COPY_MOVE(QuickMicaMaterialPrivate)
|
||||||
Q_DECLARE_PUBLIC(QuickMicaMaterial)
|
Q_DECLARE_PUBLIC(QuickMicaMaterial)
|
||||||
|
|
||||||
|
@ -56,3 +59,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(system_button) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
#include <QtQuickTemplates2/private/qquickbutton_p.h>
|
#include <QtQuickTemplates2/private/qquickbutton_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -40,6 +40,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
class FRAMELESSHELPER_QUICK_API QuickStandardSystemButton : public QQuickButton
|
class FRAMELESSHELPER_QUICK_API QuickStandardSystemButton : public QQuickButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(StandardSystemButton)
|
QML_NAMED_ELEMENT(StandardSystemButton)
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,7 +52,7 @@ class FRAMELESSHELPER_QUICK_API QuickStandardSystemButton : public QQuickButton
|
||||||
Q_PROPERTY(QColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged FINAL)
|
Q_PROPERTY(QColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged FINAL)
|
||||||
Q_PROPERTY(QColor activeForegroundColor READ activeForegroundColor WRITE setActiveForegroundColor NOTIFY activeForegroundColorChanged FINAL)
|
Q_PROPERTY(QColor activeForegroundColor READ activeForegroundColor WRITE setActiveForegroundColor NOTIFY activeForegroundColorChanged FINAL)
|
||||||
Q_PROPERTY(QColor inactiveForegroundColor READ inactiveForegroundColor WRITE setInactiveForegroundColor NOTIFY inactiveForegroundColorChanged FINAL)
|
Q_PROPERTY(QColor inactiveForegroundColor READ inactiveForegroundColor WRITE setInactiveForegroundColor NOTIFY inactiveForegroundColorChanged FINAL)
|
||||||
Q_PROPERTY(qreal iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged FINAL)
|
Q_PROPERTY(qreal glyphSize READ glyphSize WRITE setGlyphSize NOTIFY glyphChanged FINAL)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QuickStandardSystemButton(QQuickItem *parent = nullptr);
|
explicit QuickStandardSystemButton(QQuickItem *parent = nullptr);
|
||||||
|
@ -65,7 +66,7 @@ public:
|
||||||
Q_NODISCARD QColor pressColor() const;
|
Q_NODISCARD QColor pressColor() const;
|
||||||
Q_NODISCARD QColor activeForegroundColor() const;
|
Q_NODISCARD QColor activeForegroundColor() const;
|
||||||
Q_NODISCARD QColor inactiveForegroundColor() const;
|
Q_NODISCARD QColor inactiveForegroundColor() const;
|
||||||
Q_NODISCARD qreal iconSize() const;
|
Q_NODISCARD qreal glyphSize() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void updateColor();
|
void updateColor();
|
||||||
|
@ -76,7 +77,7 @@ public Q_SLOTS:
|
||||||
void setPressColor(const QColor &value);
|
void setPressColor(const QColor &value);
|
||||||
void setActiveForegroundColor(const QColor &value);
|
void setActiveForegroundColor(const QColor &value);
|
||||||
void setInactiveForegroundColor(const QColor &value);
|
void setInactiveForegroundColor(const QColor &value);
|
||||||
void setIconSize(const qreal value);
|
void setGlyphSize(const qreal value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void classBegin() override;
|
void classBegin() override;
|
||||||
|
@ -93,7 +94,7 @@ Q_SIGNALS:
|
||||||
void pressColorChanged();
|
void pressColorChanged();
|
||||||
void activeForegroundColorChanged();
|
void activeForegroundColorChanged();
|
||||||
void inactiveForegroundColorChanged();
|
void inactiveForegroundColorChanged();
|
||||||
void iconSizeChanged();
|
void glyphSizeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQuickText *m_contentItem = nullptr;
|
QQuickText *m_contentItem = nullptr;
|
||||||
|
@ -108,6 +109,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -24,12 +24,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(titlebar) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/quickchromepalette.h>
|
#include <FramelessHelper/Quick/quickchromepalette.h>
|
||||||
#include <FramelessHelper/Quick/private/quickstandardsystembutton_p.h>
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
# include <FramelessHelper/Quick/private/quickstandardsystembutton_p.h>
|
||||||
|
#endif
|
||||||
#include <QtQuick/private/qquickrectangle_p.h>
|
#include <QtQuick/private/qquickrectangle_p.h>
|
||||||
#include <QtQuickTemplates2/private/qquicklabel_p.h>
|
#include <QtQuickTemplates2/private/qquicklabel_p.h>
|
||||||
|
|
||||||
|
@ -44,13 +46,14 @@ class QuickImageItem;
|
||||||
class FRAMELESSHELPER_QUICK_API QuickStandardTitleBar : public QQuickRectangle
|
class FRAMELESSHELPER_QUICK_API QuickStandardTitleBar : public QQuickRectangle
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(StandardTitleBar)
|
QML_NAMED_ELEMENT(StandardTitleBar)
|
||||||
#endif // QML_NAMED_ELEMENT
|
#endif // QML_NAMED_ELEMENT
|
||||||
Q_DISABLE_COPY_MOVE(QuickStandardTitleBar)
|
Q_DISABLE_COPY_MOVE(QuickStandardTitleBar)
|
||||||
Q_PROPERTY(Qt::Alignment titleLabelAlignment READ titleLabelAlignment WRITE setTitleLabelAlignment NOTIFY titleLabelAlignmentChanged FINAL)
|
Q_PROPERTY(Qt::Alignment titleLabelAlignment READ titleLabelAlignment WRITE setTitleLabelAlignment NOTIFY titleLabelAlignmentChanged FINAL)
|
||||||
Q_PROPERTY(QQuickLabel* titleLabel READ titleLabel CONSTANT FINAL)
|
Q_PROPERTY(QQuickLabel* titleLabel READ titleLabel CONSTANT FINAL)
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
Q_PROPERTY(QuickStandardSystemButton* minimizeButton READ minimizeButton CONSTANT FINAL)
|
Q_PROPERTY(QuickStandardSystemButton* minimizeButton READ minimizeButton CONSTANT FINAL)
|
||||||
Q_PROPERTY(QuickStandardSystemButton* maximizeButton READ maximizeButton CONSTANT FINAL)
|
Q_PROPERTY(QuickStandardSystemButton* maximizeButton READ maximizeButton CONSTANT FINAL)
|
||||||
Q_PROPERTY(QuickStandardSystemButton* closeButton READ closeButton CONSTANT FINAL)
|
Q_PROPERTY(QuickStandardSystemButton* closeButton READ closeButton CONSTANT FINAL)
|
||||||
|
@ -70,7 +73,7 @@ public:
|
||||||
void setTitleLabelAlignment(const Qt::Alignment value);
|
void setTitleLabelAlignment(const Qt::Alignment value);
|
||||||
|
|
||||||
Q_NODISCARD QQuickLabel *titleLabel() const;
|
Q_NODISCARD QQuickLabel *titleLabel() const;
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
Q_NODISCARD QuickStandardSystemButton *minimizeButton() const;
|
Q_NODISCARD QuickStandardSystemButton *minimizeButton() const;
|
||||||
Q_NODISCARD QuickStandardSystemButton *maximizeButton() const;
|
Q_NODISCARD QuickStandardSystemButton *maximizeButton() const;
|
||||||
Q_NODISCARD QuickStandardSystemButton *closeButton() const;
|
Q_NODISCARD QuickStandardSystemButton *closeButton() const;
|
||||||
|
@ -130,7 +133,7 @@ private:
|
||||||
Qt::Alignment m_labelAlignment = {};
|
Qt::Alignment m_labelAlignment = {};
|
||||||
QuickImageItem *m_windowIcon = nullptr;
|
QuickImageItem *m_windowIcon = nullptr;
|
||||||
QQuickLabel *m_windowTitleLabel = nullptr;
|
QQuickLabel *m_windowTitleLabel = nullptr;
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
QQuickRow *m_systemButtonsRow = nullptr;
|
QQuickRow *m_systemButtonsRow = nullptr;
|
||||||
QuickStandardSystemButton *m_minimizeButton = nullptr;
|
QuickStandardSystemButton *m_minimizeButton = nullptr;
|
||||||
QuickStandardSystemButton *m_maximizeButton = nullptr;
|
QuickStandardSystemButton *m_maximizeButton = nullptr;
|
||||||
|
@ -146,6 +149,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QuickWindowBorder;
|
class QuickWindowBorder;
|
||||||
|
@ -34,6 +36,7 @@ class WindowBorderPainter;
|
||||||
class FRAMELESSHELPER_QUICK_API QuickWindowBorderPrivate : public QObject
|
class FRAMELESSHELPER_QUICK_API QuickWindowBorderPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(QuickWindowBorderPrivate)
|
Q_DISABLE_COPY_MOVE(QuickWindowBorderPrivate)
|
||||||
Q_DECLARE_PUBLIC(QuickWindowBorder)
|
Q_DECLARE_PUBLIC(QuickWindowBorder)
|
||||||
|
|
||||||
|
@ -56,3 +59,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -28,11 +28,14 @@
|
||||||
#include <FramelessHelper/Core/chromepalette.h>
|
#include <FramelessHelper/Core/chromepalette.h>
|
||||||
#include <QtQml/qqmlparserstatus.h>
|
#include <QtQml/qqmlparserstatus.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette, public QQmlParserStatus
|
class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette, public QQmlParserStatus
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_ANONYMOUS
|
#ifdef QML_ANONYMOUS
|
||||||
QML_ANONYMOUS
|
QML_ANONYMOUS
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,3 +52,5 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
#include <QtQuick/qquickpainteditem.h>
|
#include <QtQuick/qquickpainteditem.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QuickMicaMaterialPrivate;
|
class QuickMicaMaterialPrivate;
|
||||||
|
@ -34,6 +36,7 @@ class QuickMicaMaterialPrivate;
|
||||||
class FRAMELESSHELPER_QUICK_API QuickMicaMaterial : public QQuickPaintedItem
|
class FRAMELESSHELPER_QUICK_API QuickMicaMaterial : public QQuickPaintedItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(MicaMaterial)
|
QML_NAMED_ELEMENT(MicaMaterial)
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,3 +87,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||||
#include <QtQuick/qquickpainteditem.h>
|
#include <QtQuick/qquickpainteditem.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QuickWindowBorderPrivate;
|
class QuickWindowBorderPrivate;
|
||||||
|
@ -34,6 +36,7 @@ class QuickWindowBorderPrivate;
|
||||||
class FRAMELESSHELPER_QUICK_API QuickWindowBorder : public QQuickPaintedItem
|
class FRAMELESSHELPER_QUICK_API QuickWindowBorder : public QQuickPaintedItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
#ifdef QML_NAMED_ELEMENT
|
#ifdef QML_NAMED_ELEMENT
|
||||||
QML_NAMED_ELEMENT(WindowBorder)
|
QML_NAMED_ELEMENT(WindowBorder)
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,3 +92,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
#include <QtWidgets/qdialog.h>
|
#include <QtWidgets/qdialog.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessDialogPrivate;
|
class FramelessDialogPrivate;
|
||||||
|
@ -34,6 +36,7 @@ class FramelessDialogPrivate;
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessDialog : public QDialog
|
class FRAMELESSHELPER_WIDGETS_API FramelessDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(FramelessDialog)
|
Q_DECLARE_PRIVATE(FramelessDialog)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessDialog)
|
Q_DISABLE_COPY_MOVE(FramelessDialog)
|
||||||
|
|
||||||
|
@ -46,3 +49,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -40,10 +40,13 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
FRAMELESSHELPER_WIDGETS_API void FramelessHelperWidgetsInitialize();
|
||||||
|
FRAMELESSHELPER_WIDGETS_API void FramelessHelperWidgetsUninitialize();
|
||||||
|
|
||||||
namespace FramelessHelper::Widgets
|
namespace FramelessHelper::Widgets
|
||||||
{
|
{
|
||||||
FRAMELESSHELPER_WIDGETS_API void initialize();
|
inline void initialize() { FramelessHelperWidgetsInitialize(); }
|
||||||
FRAMELESSHELPER_WIDGETS_API void uninitialize();
|
inline void uninitialize() { FramelessHelperWidgetsUninitialize(); }
|
||||||
} // namespace FramelessHelper::Widgets
|
} // namespace FramelessHelper::Widgets
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
#include <QtWidgets/qmainwindow.h>
|
#include <QtWidgets/qmainwindow.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessMainWindowPrivate;
|
class FramelessMainWindowPrivate;
|
||||||
|
@ -34,6 +36,7 @@ class FramelessMainWindowPrivate;
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindow : public QMainWindow
|
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(FramelessMainWindow)
|
Q_DECLARE_PRIVATE(FramelessMainWindow)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessMainWindow)
|
Q_DISABLE_COPY_MOVE(FramelessMainWindow)
|
||||||
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
|
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
|
||||||
|
@ -61,3 +64,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
#include <QtWidgets/qwidget.h>
|
#include <QtWidgets/qwidget.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessWidgetPrivate;
|
class FramelessWidgetPrivate;
|
||||||
|
@ -34,6 +36,7 @@ class FramelessWidgetPrivate;
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidget : public QWidget
|
class FRAMELESSHELPER_WIDGETS_API FramelessWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(FramelessWidget)
|
Q_DECLARE_PRIVATE(FramelessWidget)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessWidget)
|
Q_DISABLE_COPY_MOVE(FramelessWidget)
|
||||||
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
|
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
|
||||||
|
@ -61,3 +64,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -29,13 +29,18 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessWidgetsHelperPrivate;
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
class MicaMaterial;
|
class MicaMaterial;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
class WindowBorderPainter;
|
class WindowBorderPainter;
|
||||||
|
#endif
|
||||||
|
class FramelessWidgetsHelperPrivate;
|
||||||
|
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelper : public QObject
|
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(FramelessWidgetsHelper)
|
Q_DECLARE_PRIVATE(FramelessWidgetsHelper)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessWidgetsHelper)
|
Q_DISABLE_COPY_MOVE(FramelessWidgetsHelper)
|
||||||
Q_PROPERTY(QWidget* titleBarWidget READ titleBarWidget WRITE setTitleBarWidget NOTIFY titleBarWidgetChanged FINAL)
|
Q_PROPERTY(QWidget* titleBarWidget READ titleBarWidget WRITE setTitleBarWidget NOTIFY titleBarWidgetChanged FINAL)
|
||||||
|
@ -56,8 +61,12 @@ public:
|
||||||
Q_NODISCARD QWidget *window() const;
|
Q_NODISCARD QWidget *window() const;
|
||||||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
Q_NODISCARD MicaMaterial *micaMaterial() const;
|
Q_NODISCARD MicaMaterial *micaMaterial() const;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_NODISCARD WindowBorderPainter *windowBorder() const;
|
Q_NODISCARD WindowBorderPainter *windowBorder() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_NODISCARD bool isReady() const;
|
Q_NODISCARD bool isReady() const;
|
||||||
void waitForReady();
|
void waitForReady();
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessDialog;
|
class FramelessDialog;
|
||||||
|
@ -34,6 +36,7 @@ class WidgetsSharedHelper;
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessDialogPrivate : public QObject
|
class FRAMELESSHELPER_WIDGETS_API FramelessDialogPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessDialog)
|
Q_DECLARE_PUBLIC(FramelessDialog)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessDialogPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessDialogPrivate)
|
||||||
|
|
||||||
|
@ -49,3 +52,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessMainWindow;
|
class FramelessMainWindow;
|
||||||
|
@ -34,6 +36,7 @@ class WidgetsSharedHelper;
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindowPrivate : public QObject
|
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindowPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessMainWindow)
|
Q_DECLARE_PUBLIC(FramelessMainWindow)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessMainWindowPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessMainWindowPrivate)
|
||||||
|
|
||||||
|
@ -50,3 +53,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class FramelessWidget;
|
class FramelessWidget;
|
||||||
|
@ -34,6 +36,7 @@ class WidgetsSharedHelper;
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetPrivate : public QObject
|
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessWidget)
|
Q_DECLARE_PUBLIC(FramelessWidget)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessWidgetPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessWidgetPrivate)
|
||||||
|
|
||||||
|
@ -50,3 +53,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -30,15 +30,20 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
class MicaMaterial;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
class WindowBorderPainter;
|
||||||
|
#endif
|
||||||
class FramelessWidgetsHelper;
|
class FramelessWidgetsHelper;
|
||||||
struct FramelessWidgetsHelperData;
|
struct FramelessWidgetsHelperData;
|
||||||
class WidgetsSharedHelper;
|
class WidgetsSharedHelper;
|
||||||
class MicaMaterial;
|
|
||||||
class WindowBorderPainter;
|
|
||||||
|
|
||||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelperPrivate : public QObject
|
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelperPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(FramelessWidgetsHelper)
|
Q_DECLARE_PUBLIC(FramelessWidgetsHelper)
|
||||||
Q_DISABLE_COPY_MOVE(FramelessWidgetsHelperPrivate)
|
Q_DISABLE_COPY_MOVE(FramelessWidgetsHelperPrivate)
|
||||||
|
|
||||||
|
@ -57,8 +62,12 @@ public:
|
||||||
void setProperty(const char *name, const QVariant &value);
|
void setProperty(const char *name, const QVariant &value);
|
||||||
Q_NODISCARD QVariant getProperty(const char *name, const QVariant &defaultValue = {});
|
Q_NODISCARD QVariant getProperty(const char *name, const QVariant &defaultValue = {});
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
Q_NODISCARD MicaMaterial *getMicaMaterialIfAny() const;
|
Q_NODISCARD MicaMaterial *getMicaMaterialIfAny() const;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_NODISCARD WindowBorderPainter *getWindowBorderIfAny() const;
|
Q_NODISCARD WindowBorderPainter *getWindowBorderIfAny() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_NODISCARD static WidgetsSharedHelper *findOrCreateSharedHelper(QWidget *window);
|
Q_NODISCARD static WidgetsSharedHelper *findOrCreateSharedHelper(QWidget *window);
|
||||||
Q_NODISCARD static FramelessWidgetsHelper *findOrCreateFramelessHelper(QObject *object);
|
Q_NODISCARD static FramelessWidgetsHelper *findOrCreateFramelessHelper(QObject *object);
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class StandardSystemButton;
|
class StandardSystemButton;
|
||||||
|
@ -34,6 +36,7 @@ class StandardSystemButton;
|
||||||
class FRAMELESSHELPER_WIDGETS_API StandardSystemButtonPrivate : public QObject
|
class FRAMELESSHELPER_WIDGETS_API StandardSystemButtonPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(StandardSystemButton)
|
Q_DECLARE_PUBLIC(StandardSystemButton)
|
||||||
Q_DISABLE_COPY_MOVE(StandardSystemButtonPrivate)
|
Q_DISABLE_COPY_MOVE(StandardSystemButtonPrivate)
|
||||||
|
|
||||||
|
@ -59,3 +62,5 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -32,15 +32,20 @@ QT_BEGIN_NAMESPACE
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class StandardTitleBar;
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
class StandardSystemButton;
|
class StandardSystemButton;
|
||||||
|
#endif
|
||||||
class ChromePalette;
|
class ChromePalette;
|
||||||
|
class StandardTitleBar;
|
||||||
|
|
||||||
class FRAMELESSHELPER_WIDGETS_API StandardTitleBarPrivate : public QObject
|
class FRAMELESSHELPER_WIDGETS_API StandardTitleBarPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PUBLIC(StandardTitleBar)
|
Q_DECLARE_PUBLIC(StandardTitleBar)
|
||||||
Q_DISABLE_COPY_MOVE(StandardTitleBarPrivate)
|
Q_DISABLE_COPY_MOVE(StandardTitleBarPrivate)
|
||||||
|
|
||||||
|
@ -75,11 +80,11 @@ public:
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
StandardTitleBar *q_ptr = nullptr;
|
StandardTitleBar *q_ptr = nullptr;
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
StandardSystemButton *minimizeButton = nullptr;
|
StandardSystemButton *minimizeButton = nullptr;
|
||||||
StandardSystemButton *maximizeButton = nullptr;
|
StandardSystemButton *maximizeButton = nullptr;
|
||||||
StandardSystemButton *closeButton = nullptr;
|
StandardSystemButton *closeButton = nullptr;
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
QPointer<QWidget> window = nullptr;
|
QPointer<QWidget> window = nullptr;
|
||||||
bool extended = false;
|
bool extended = false;
|
||||||
Qt::Alignment labelAlignment = {};
|
Qt::Alignment labelAlignment = {};
|
||||||
|
@ -96,3 +101,5 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -29,14 +29,21 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
class MicaMaterial;
|
class MicaMaterial;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
class WindowBorderPainter;
|
class WindowBorderPainter;
|
||||||
|
#endif
|
||||||
|
|
||||||
class FRAMELESSHELPER_WIDGETS_API WidgetsSharedHelper : public QObject
|
class FRAMELESSHELPER_WIDGETS_API WidgetsSharedHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(WidgetsSharedHelper)
|
Q_DISABLE_COPY_MOVE(WidgetsSharedHelper)
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
Q_PROPERTY(bool micaEnabled READ isMicaEnabled WRITE setMicaEnabled NOTIFY micaEnabledChanged FINAL)
|
Q_PROPERTY(bool micaEnabled READ isMicaEnabled WRITE setMicaEnabled NOTIFY micaEnabledChanged FINAL)
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WidgetsSharedHelper(QObject *parent = nullptr);
|
explicit WidgetsSharedHelper(QObject *parent = nullptr);
|
||||||
|
@ -44,11 +51,14 @@ public:
|
||||||
|
|
||||||
void setup(QWidget *widget);
|
void setup(QWidget *widget);
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
Q_NODISCARD bool isMicaEnabled() const;
|
Q_NODISCARD bool isMicaEnabled() const;
|
||||||
void setMicaEnabled(const bool value);
|
void setMicaEnabled(const bool value);
|
||||||
|
|
||||||
Q_NODISCARD MicaMaterial *rawMicaMaterial() const;
|
Q_NODISCARD MicaMaterial *rawMicaMaterial() const;
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_NODISCARD WindowBorderPainter *rawWindowBorder() const;
|
Q_NODISCARD WindowBorderPainter *rawWindowBorder() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Q_NODISCARD bool eventFilter(QObject *object, QEvent *event) override;
|
Q_NODISCARD bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
|
@ -58,24 +68,34 @@ private Q_SLOTS:
|
||||||
void handleScreenChanged(QScreen *screen);
|
void handleScreenChanged(QScreen *screen);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
void repaintMica();
|
void repaintMica();
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
void repaintBorder();
|
void repaintBorder();
|
||||||
|
#endif
|
||||||
void emitCustomWindowStateSignals();
|
void emitCustomWindowStateSignals();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
void micaEnabledChanged();
|
void micaEnabledChanged();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<QWidget> m_targetWidget;
|
QPointer<QWidget> m_targetWidget;
|
||||||
QPointer<QScreen> m_screen;
|
QPointer<QScreen> m_screen;
|
||||||
|
qreal m_screenDpr = qreal(0);
|
||||||
|
QMetaObject::Connection m_screenDpiChangeConnection = {};
|
||||||
|
QMetaObject::Connection m_screenChangeConnection = {};
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
bool m_micaEnabled = false;
|
bool m_micaEnabled = false;
|
||||||
MicaMaterial *m_micaMaterial = nullptr;
|
MicaMaterial *m_micaMaterial = nullptr;
|
||||||
QMetaObject::Connection m_micaRedrawConnection = {};
|
QMetaObject::Connection m_micaRedrawConnection = {};
|
||||||
qreal m_screenDpr = 0.0;
|
#endif
|
||||||
QMetaObject::Connection m_screenDpiChangeConnection = {};
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
WindowBorderPainter *m_borderPainter = nullptr;
|
WindowBorderPainter *m_borderPainter = nullptr;
|
||||||
QMetaObject::Connection m_borderRepaintConnection = {};
|
QMetaObject::Connection m_borderRepaintConnection = {};
|
||||||
QMetaObject::Connection m_screenChangeConnection = {};
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
#include <QtWidgets/qpushbutton.h>
|
#include <QtWidgets/qpushbutton.h>
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class StandardSystemButtonPrivate;
|
class StandardSystemButtonPrivate;
|
||||||
|
@ -34,6 +36,7 @@ class StandardSystemButtonPrivate;
|
||||||
class FRAMELESSHELPER_WIDGETS_API StandardSystemButton : public QPushButton
|
class FRAMELESSHELPER_WIDGETS_API StandardSystemButton : public QPushButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(StandardSystemButton)
|
Q_DECLARE_PRIVATE(StandardSystemButton)
|
||||||
Q_DISABLE_COPY_MOVE(StandardSystemButton)
|
Q_DISABLE_COPY_MOVE(StandardSystemButton)
|
||||||
Q_PROPERTY(Global::SystemButtonType buttonType READ buttonType WRITE setButtonType NOTIFY buttonTypeChanged FINAL)
|
Q_PROPERTY(Global::SystemButtonType buttonType READ buttonType WRITE setButtonType NOTIFY buttonTypeChanged FINAL)
|
||||||
|
@ -92,3 +95,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -25,8 +25,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||||
#include <FramelessHelper/Widgets/standardsystembutton.h>
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
#include <FramelessHelper/Core/chromepalette.h>
|
#include <FramelessHelper/Core/chromepalette.h>
|
||||||
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
# include <FramelessHelper/Widgets/standardsystembutton.h>
|
||||||
|
#endif
|
||||||
#include <QtWidgets/qwidget.h>
|
#include <QtWidgets/qwidget.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
@ -36,14 +41,15 @@ class StandardTitleBarPrivate;
|
||||||
class FRAMELESSHELPER_WIDGETS_API StandardTitleBar : public QWidget
|
class FRAMELESSHELPER_WIDGETS_API StandardTitleBar : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DECLARE_PRIVATE(StandardTitleBar)
|
Q_DECLARE_PRIVATE(StandardTitleBar)
|
||||||
Q_DISABLE_COPY_MOVE(StandardTitleBar)
|
Q_DISABLE_COPY_MOVE(StandardTitleBar)
|
||||||
Q_PROPERTY(Qt::Alignment titleLabelAlignment READ titleLabelAlignment WRITE setTitleLabelAlignment NOTIFY titleLabelAlignmentChanged FINAL)
|
Q_PROPERTY(Qt::Alignment titleLabelAlignment READ titleLabelAlignment WRITE setTitleLabelAlignment NOTIFY titleLabelAlignmentChanged FINAL)
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
Q_PROPERTY(StandardSystemButton* minimizeButton READ minimizeButton CONSTANT FINAL)
|
Q_PROPERTY(StandardSystemButton* minimizeButton READ minimizeButton CONSTANT FINAL)
|
||||||
Q_PROPERTY(StandardSystemButton* maximizeButton READ maximizeButton CONSTANT FINAL)
|
Q_PROPERTY(StandardSystemButton* maximizeButton READ maximizeButton CONSTANT FINAL)
|
||||||
Q_PROPERTY(StandardSystemButton* closeButton READ closeButton CONSTANT FINAL)
|
Q_PROPERTY(StandardSystemButton* closeButton READ closeButton CONSTANT FINAL)
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
Q_PROPERTY(bool extended READ isExtended WRITE setExtended NOTIFY extendedChanged FINAL)
|
Q_PROPERTY(bool extended READ isExtended WRITE setExtended NOTIFY extendedChanged FINAL)
|
||||||
Q_PROPERTY(bool hideWhenClose READ isHideWhenClose WRITE setHideWhenClose NOTIFY hideWhenCloseChanged FINAL)
|
Q_PROPERTY(bool hideWhenClose READ isHideWhenClose WRITE setHideWhenClose NOTIFY hideWhenCloseChanged FINAL)
|
||||||
Q_PROPERTY(ChromePalette* chromePalette READ chromePalette CONSTANT FINAL)
|
Q_PROPERTY(ChromePalette* chromePalette READ chromePalette CONSTANT FINAL)
|
||||||
|
@ -59,7 +65,7 @@ public:
|
||||||
Q_NODISCARD Qt::Alignment titleLabelAlignment() const;
|
Q_NODISCARD Qt::Alignment titleLabelAlignment() const;
|
||||||
void setTitleLabelAlignment(const Qt::Alignment value);
|
void setTitleLabelAlignment(const Qt::Alignment value);
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
Q_NODISCARD StandardSystemButton *minimizeButton() const;
|
Q_NODISCARD StandardSystemButton *minimizeButton() const;
|
||||||
Q_NODISCARD StandardSystemButton *maximizeButton() const;
|
Q_NODISCARD StandardSystemButton *maximizeButton() const;
|
||||||
Q_NODISCARD StandardSystemButton *closeButton() const;
|
Q_NODISCARD StandardSystemButton *closeButton() const;
|
||||||
|
@ -104,3 +110,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<LibraryPath>$(MSBuildThisFileDirectory)lib64;$(MSBuildThisFileDirectory)lib64\debug;$(MSBuildThisFileDirectory)lib64\release;$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(MSBuildThisFileDirectory)lib;$(MSBuildThisFileDirectory)lib\debug;$(MSBuildThisFileDirectory)lib\release;$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings">
|
<PropertyGroup Label="QtSettings">
|
||||||
<QtHeaderSearchPath>$(MSBuildThisFileDirectory)include;$(MSBuildThisFileDirectory)include\FramelessHelper;$(MSBuildThisFileDirectory)include\FramelessHelper\Core;$(MSBuildThisFileDirectory)include\FramelessHelper\Core\private;$(MSBuildThisFileDirectory)include\FramelessHelper\Widgets;$(MSBuildThisFileDirectory)include\FramelessHelper\Widgets\private;$(MSBuildThisFileDirectory)include\FramelessHelper\Quick;$(MSBuildThisFileDirectory)include\FramelessHelper\Quick\private;$(QtHeaderSearchPath)</QtHeaderSearchPath>
|
<QtHeaderSearchPath>$(MSBuildThisFileDirectory)include;$(MSBuildThisFileDirectory)include\FramelessHelper;$(MSBuildThisFileDirectory)include\FramelessHelper\Core;$(MSBuildThisFileDirectory)include\FramelessHelper\Core\private;$(MSBuildThisFileDirectory)include\FramelessHelper\Widgets;$(MSBuildThisFileDirectory)include\FramelessHelper\Widgets\private;$(MSBuildThisFileDirectory)include\FramelessHelper\Quick;$(MSBuildThisFileDirectory)include\FramelessHelper\Quick\private;$(QtHeaderSearchPath)</QtHeaderSearchPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>FRAMELESSHELPER_CORE_STATIC;FRAMELESSHELPER_WIDGETS_STATIC;FRAMELESSHELPER_QUICK_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">FramelessHelperCored.lib;FramelessHelperWidgetsd.lib;FramelessHelperQuickd.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">FramelessHelperCore64d.lib;FramelessHelperWidgets64d.lib;FramelessHelperQuick64d.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
||||||
<AdditionalDependencies Condition="'$(Configuration)'=='Release'">FramelessHelperCore.lib;FramelessHelperWidgets.lib;FramelessHelperQuick.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
<AdditionalDependencies Condition="'$(Configuration)'=='Release'">FramelessHelperCore64.lib;FramelessHelperWidgets64.lib;FramelessHelperQuick64.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -26,6 +26,7 @@ DEPENDPATH += \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$CORE_EXTRA_INC_DIR/framelesshelper.version \
|
$$CORE_EXTRA_INC_DIR/framelesshelper.version \
|
||||||
|
$$CORE_EXTRA_INC_DIR/framelesshelper.config \
|
||||||
$$CORE_PUB_INC_DIR/chromepalette.h \
|
$$CORE_PUB_INC_DIR/chromepalette.h \
|
||||||
$$CORE_PUB_INC_DIR/framelesshelper_qt.h \
|
$$CORE_PUB_INC_DIR/framelesshelper_qt.h \
|
||||||
$$CORE_PUB_INC_DIR/framelesshelpercore_global.h \
|
$$CORE_PUB_INC_DIR/framelesshelpercore_global.h \
|
||||||
|
|
|
@ -22,44 +22,28 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Generated automatically by CMake.
|
||||||
|
// WARNING! DO NOT EDIT THIS FILE MANUALLY!
|
||||||
|
// ALL CHANGES WILL BE LOST AFTER RE-CONFIGURING!
|
||||||
|
// Also please do not include this file directly,
|
||||||
|
// it's designed to be included by FramelessHelper's own headers.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
#ifndef _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||||
#include <QtQuick/qquickpainteditem.h>
|
#define _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
#define FRAMELESSHELPER_FEATURE_static_build 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_widgets 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_quick 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_debug_output -1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_bundle_resource 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_private_qt 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_window 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_titlebar 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_translation 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_mica_material 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_border_painter 1
|
||||||
|
#define FRAMELESSHELPER_FEATURE_system_button 1
|
||||||
|
|
||||||
class QuickImageItemPrivate;
|
#endif // _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||||
|
|
||||||
class FRAMELESSHELPER_QUICK_API QuickImageItem : public QQuickPaintedItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
#ifdef QML_NAMED_ELEMENT
|
|
||||||
QML_NAMED_ELEMENT(ImageItem)
|
|
||||||
#endif
|
|
||||||
Q_DISABLE_COPY_MOVE(QuickImageItem)
|
|
||||||
Q_DECLARE_PRIVATE(QuickImageItem)
|
|
||||||
|
|
||||||
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit QuickImageItem(QQuickItem *parent = nullptr);
|
|
||||||
~QuickImageItem() override;
|
|
||||||
|
|
||||||
void paint(QPainter *painter) override;
|
|
||||||
|
|
||||||
Q_NODISCARD QVariant source() const;
|
|
||||||
void setSource(const QVariant &value);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void classBegin() override;
|
|
||||||
void componentComplete() override;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void sourceChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QScopedPointer<QuickImageItemPrivate> d_ptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
|
|
@ -41,4 +41,11 @@
|
||||||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "UNKNOWN";
|
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "UNKNOWN";
|
||||||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "UNKNOWN";
|
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "UNKNOWN";
|
||||||
|
|
||||||
|
#define __FRAMELESSHELPER_VERSION_MAJOR__ 2
|
||||||
|
#define __FRAMELESSHELPER_VERSION_MINOR__ 5
|
||||||
|
#define __FRAMELESSHELPER_VERSION_PATCH__ 0
|
||||||
|
//#define __FRAMELESSHELPER_VERSION_TWEAK__ 0
|
||||||
|
#define __FRAMELESSHELPER_VERSION__ 0x02050000
|
||||||
|
#define __FRAMELESSHELPER__ 0x02050000
|
||||||
|
|
||||||
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
||||||
|
|
|
@ -50,6 +50,55 @@ if(UNIX AND NOT APPLE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(FRAMELESSHELPER_FEATURE_static_build "-1")
|
||||||
|
if(FRAMELESSHELPER_BUILD_STATIC)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_static_build "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_widgets "-1")
|
||||||
|
if(FRAMELESSHELPER_BUILD_WIDGETS)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_widgets "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_quick "-1")
|
||||||
|
if(FRAMELESSHELPER_BUILD_QUICK)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_quick "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_debug_output "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_debug_output "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_bundle_resource "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_bundle_resource "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_private_qt "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_PRIVATE)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_private_qt "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_window "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_WINDOW)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_window "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_titlebar "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_titlebar "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_translation "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_TRANSLATION)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_translation "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_mica_material "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_MICA_MATERIAL)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_mica_material "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_border_painter "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_BORDER_PAINTER)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_border_painter "1")
|
||||||
|
endif()
|
||||||
|
set(FRAMELESSHELPER_FEATURE_system_button "-1")
|
||||||
|
if(NOT FRAMELESSHELPER_NO_SYSTEM_BUTTON)
|
||||||
|
set(FRAMELESSHELPER_FEATURE_system_button "1")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SUB_MODULE Core)
|
set(SUB_MODULE Core)
|
||||||
set(SUB_MODULE_FULL_NAME ${PROJECT_NAME}${SUB_MODULE})
|
set(SUB_MODULE_FULL_NAME ${PROJECT_NAME}${SUB_MODULE})
|
||||||
set(SUB_MODULE_TARGET ${SUB_MODULE_FULL_NAME})
|
set(SUB_MODULE_TARGET ${SUB_MODULE_FULL_NAME})
|
||||||
|
@ -59,16 +108,16 @@ set(INCLUDE_PREFIX ../../include/${SUB_MODULE_PATH})
|
||||||
|
|
||||||
configure_file(framelesshelper.version.in
|
configure_file(framelesshelper.version.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.version @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.version @ONLY)
|
||||||
|
configure_file(framelesshelper.config.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.config @ONLY)
|
||||||
|
|
||||||
set(PUBLIC_HEADERS
|
set(PUBLIC_HEADERS
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.version
|
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.version
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.config
|
||||||
${INCLUDE_PREFIX}/framelesshelpercore_global.h
|
${INCLUDE_PREFIX}/framelesshelpercore_global.h
|
||||||
${INCLUDE_PREFIX}/framelesshelper_qt.h
|
${INCLUDE_PREFIX}/framelesshelper_qt.h
|
||||||
${INCLUDE_PREFIX}/framelessmanager.h
|
${INCLUDE_PREFIX}/framelessmanager.h
|
||||||
${INCLUDE_PREFIX}/utils.h
|
${INCLUDE_PREFIX}/utils.h
|
||||||
${INCLUDE_PREFIX}/chromepalette.h
|
|
||||||
${INCLUDE_PREFIX}/micamaterial.h
|
|
||||||
${INCLUDE_PREFIX}/windowborderpainter.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PUBLIC_HEADERS_ALIAS
|
set(PUBLIC_HEADERS_ALIAS
|
||||||
|
@ -76,18 +125,12 @@ set(PUBLIC_HEADERS_ALIAS
|
||||||
${INCLUDE_PREFIX}/FramelessHelper_Qt
|
${INCLUDE_PREFIX}/FramelessHelper_Qt
|
||||||
${INCLUDE_PREFIX}/FramelessManager
|
${INCLUDE_PREFIX}/FramelessManager
|
||||||
${INCLUDE_PREFIX}/Utils
|
${INCLUDE_PREFIX}/Utils
|
||||||
${INCLUDE_PREFIX}/ChromePalette
|
|
||||||
${INCLUDE_PREFIX}/MicaMaterial
|
|
||||||
${INCLUDE_PREFIX}/WindowBorderPainter
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PRIVATE_HEADERS
|
set(PRIVATE_HEADERS
|
||||||
${INCLUDE_PREFIX}/private/framelessmanager_p.h
|
${INCLUDE_PREFIX}/private/framelessmanager_p.h
|
||||||
${INCLUDE_PREFIX}/private/framelessconfig_p.h
|
${INCLUDE_PREFIX}/private/framelessconfig_p.h
|
||||||
${INCLUDE_PREFIX}/private/sysapiloader_p.h
|
${INCLUDE_PREFIX}/private/sysapiloader_p.h
|
||||||
${INCLUDE_PREFIX}/private/chromepalette_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/micamaterial_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/windowborderpainter_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelesshelpercore_global_p.h
|
${INCLUDE_PREFIX}/private/framelesshelpercore_global_p.h
|
||||||
${INCLUDE_PREFIX}/private/versionnumber_p.h
|
${INCLUDE_PREFIX}/private/versionnumber_p.h
|
||||||
${INCLUDE_PREFIX}/private/scopeguard_p.h
|
${INCLUDE_PREFIX}/private/scopeguard_p.h
|
||||||
|
@ -99,10 +142,7 @@ set(SOURCES
|
||||||
framelessmanager.cpp
|
framelessmanager.cpp
|
||||||
framelessconfig.cpp
|
framelessconfig.cpp
|
||||||
sysapiloader.cpp
|
sysapiloader.cpp
|
||||||
chromepalette.cpp
|
|
||||||
framelesshelpercore_global.cpp
|
framelesshelpercore_global.cpp
|
||||||
micamaterial.cpp
|
|
||||||
windowborderpainter.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -140,6 +180,27 @@ elseif(UNIX)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/chromepalette.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/ChromePalette)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/chromepalette_p.h)
|
||||||
|
list(APPEND SOURCES chromepalette.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_MICA_MATERIAL)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/micamaterial.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/MicaMaterial)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/micamaterial_p.h)
|
||||||
|
list(APPEND SOURCES micamaterial.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_BORDER_PAINTER)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/windowborderpainter.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/WindowBorderPainter)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/windowborderpainter_p.h)
|
||||||
|
list(APPEND SOURCES windowborderpainter.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||||
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
||||||
if(NOT EXISTS "${__rc_path}")
|
if(NOT EXISTS "${__rc_path}")
|
||||||
|
@ -172,6 +233,7 @@ add_library(${PROJECT_NAME}::${SUB_MODULE_FULL_NAME} ALIAS ${SUB_MODULE_TARGET})
|
||||||
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
||||||
VERSION "${PROJECT_VERSION}"
|
VERSION "${PROJECT_VERSION}"
|
||||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||||
|
OUTPUT_NAME "${SUB_MODULE_TARGET}${FRAMELESSHELPER_64BIT_POSTFIX}"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(__export_targets ${SUB_MODULE_TARGET})
|
set(__export_targets ${SUB_MODULE_TARGET})
|
||||||
|
@ -203,24 +265,6 @@ if(NOT FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_CORE_STATIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
|
||||||
FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_CORE_NO_PRIVATE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
||||||
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
||||||
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
||||||
|
|
|
@ -24,24 +24,26 @@
|
||||||
|
|
||||||
#include "chromepalette.h"
|
#include "chromepalette.h"
|
||||||
#include "chromepalette_p.h"
|
#include "chromepalette_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcChromePalette, "wangwenx190.framelesshelper.core.chromepalette")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcChromePalette, "wangwenx190.framelesshelper.core.chromepalette")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcChromePalette)
|
# define INFO qCInfo(lcChromePalette)
|
||||||
# define DEBUG qCDebug(lcChromePalette)
|
# define DEBUG qCDebug(lcChromePalette)
|
||||||
# define WARNING qCWarning(lcChromePalette)
|
# define WARNING qCWarning(lcChromePalette)
|
||||||
# define CRITICAL qCCritical(lcChromePalette)
|
# define CRITICAL qCCritical(lcChromePalette)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -428,3 +430,5 @@ void ChromePalette::resetCloseButtonPressColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -33,18 +33,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessConfig, "wangwenx190.framelesshelper.core.framelessconfig")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessConfig, "wangwenx190.framelesshelper.core.framelessconfig")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessConfig)
|
# define INFO qCInfo(lcFramelessConfig)
|
||||||
# define DEBUG qCDebug(lcFramelessConfig)
|
# define DEBUG qCDebug(lcFramelessConfig)
|
||||||
# define WARNING qCWarning(lcFramelessConfig)
|
# define WARNING qCWarning(lcFramelessConfig)
|
||||||
# define CRITICAL qCCritical(lcFramelessConfig)
|
# define CRITICAL qCCritical(lcFramelessConfig)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -81,10 +80,15 @@ struct FramelessConfigData
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(FramelessConfigData, g_framelessConfigData)
|
Q_GLOBAL_STATIC(FramelessConfigData, g_framelessConfigData)
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
static inline void warnInappropriateOptions()
|
static inline void warnInappropriateOptions()
|
||||||
{
|
{
|
||||||
const FramelessConfig * const cfg = FramelessConfig::instance();
|
const FramelessConfig * const cfg = FramelessConfig::instance();
|
||||||
#ifndef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
|
if (cfg->isSet(Option::DisableWindowsSnapLayout)) {
|
||||||
|
WARNING << "Option::DisableWindowsSnapLayout is deprecated and will removed in a future version. It has not effect now.";
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (cfg->isSet(Option::UseCrossPlatformQtImplementation)) {
|
if (cfg->isSet(Option::UseCrossPlatformQtImplementation)) {
|
||||||
WARNING << "Option::UseCrossPlatformQtImplementation is default on non-Windows platforms.";
|
WARNING << "Option::UseCrossPlatformQtImplementation is default on non-Windows platforms.";
|
||||||
}
|
}
|
||||||
|
@ -108,6 +112,7 @@ static inline void warnInappropriateOptions()
|
||||||
WARNING << "Option::WindowUseRoundCorners has not been implemented yet.";
|
WARNING << "Option::WindowUseRoundCorners has not been implemented yet.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
FramelessConfig::FramelessConfig(QObject *parent) : QObject(parent)
|
FramelessConfig::FramelessConfig(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -143,8 +148,9 @@ void FramelessConfig::reload(const bool force)
|
||||||
g_framelessConfigData()->options.at(i) = (envVar || cfgFile);
|
g_framelessConfigData()->options.at(i) = (envVar || cfgFile);
|
||||||
}
|
}
|
||||||
g_framelessConfigData()->loaded = true;
|
g_framelessConfigData()->loaded = true;
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
QTimer::singleShot(0, this, [](){ warnInappropriateOptions(); });
|
QTimer::singleShot(0, this, [](){ warnInappropriateOptions(); });
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramelessConfig::set(const Option option, const bool on)
|
void FramelessConfig::set(const Option option, const bool on)
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021-2023 by wangwenx190 (Yuhang Zhao)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Generated automatically by CMake.
|
||||||
|
// WARNING! DO NOT EDIT THIS FILE MANUALLY!
|
||||||
|
// ALL CHANGES WILL BE LOST AFTER RE-CONFIGURING!
|
||||||
|
// Also please do not include this file directly,
|
||||||
|
// it's designed to be included by FramelessHelper's own headers.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||||
|
#define _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||||
|
|
||||||
|
#define FRAMELESSHELPER_FEATURE_static_build @FRAMELESSHELPER_FEATURE_static_build@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_widgets @FRAMELESSHELPER_FEATURE_widgets@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_quick @FRAMELESSHELPER_FEATURE_quick@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_debug_output @FRAMELESSHELPER_FEATURE_debug_output@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_bundle_resource @FRAMELESSHELPER_FEATURE_bundle_resource@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_private_qt @FRAMELESSHELPER_FEATURE_private_qt@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_window @FRAMELESSHELPER_FEATURE_window@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_titlebar @FRAMELESSHELPER_FEATURE_titlebar@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_translation @FRAMELESSHELPER_FEATURE_translation@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_mica_material @FRAMELESSHELPER_FEATURE_mica_material@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_border_painter @FRAMELESSHELPER_FEATURE_border_painter@
|
||||||
|
#define FRAMELESSHELPER_FEATURE_system_button @FRAMELESSHELPER_FEATURE_system_button@
|
||||||
|
|
||||||
|
#endif // _FRAMELESSHELPER_CONFIG_DEFINED_
|
|
@ -41,4 +41,11 @@
|
||||||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "@PROJECT_VERSION_COMMIT@";
|
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "@PROJECT_VERSION_COMMIT@";
|
||||||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "@PROJECT_COMPILE_DATETIME@";
|
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "@PROJECT_COMPILE_DATETIME@";
|
||||||
|
|
||||||
|
#define __FRAMELESSHELPER_VERSION_MAJOR__ @PROJECT_VERSION_MAJOR@
|
||||||
|
#define __FRAMELESSHELPER_VERSION_MINOR__ @PROJECT_VERSION_MINOR@
|
||||||
|
#define __FRAMELESSHELPER_VERSION_PATCH__ @PROJECT_VERSION_PATCH@
|
||||||
|
//#define __FRAMELESSHELPER_VERSION_TWEAK__ @PROJECT_VERSION_TWEAK@
|
||||||
|
#define __FRAMELESSHELPER_VERSION__ @PROJECT_VERSION_HEX@
|
||||||
|
#define __FRAMELESSHELPER__ @PROJECT_VERSION_HEX@
|
||||||
|
|
||||||
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
||||||
|
|
|
@ -34,18 +34,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperQt, "wangwenx190.framelesshelper.core.impl.qt")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperQt, "wangwenx190.framelesshelper.core.impl.qt")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessHelperQt)
|
# define INFO qCInfo(lcFramelessHelperQt)
|
||||||
# define DEBUG qCDebug(lcFramelessHelperQt)
|
# define DEBUG qCDebug(lcFramelessHelperQt)
|
||||||
# define WARNING qCWarning(lcFramelessHelperQt)
|
# define WARNING qCWarning(lcFramelessHelperQt)
|
||||||
# define CRITICAL qCCritical(lcFramelessHelperQt)
|
# define CRITICAL qCCritical(lcFramelessHelperQt)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -86,9 +85,9 @@ void FramelessHelperQt::addWindow(FramelessParamsConst params)
|
||||||
const auto shouldApplyFramelessFlag = []() -> bool {
|
const auto shouldApplyFramelessFlag = []() -> bool {
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
return false;
|
return false;
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
return !Utils::isCustomDecorationSupported();
|
return !Utils::isCustomDecorationSupported();
|
||||||
#else // Windows
|
#elif defined(Q_OS_WINDOWS)
|
||||||
return true;
|
return true;
|
||||||
#endif // Q_OS_MACOS
|
#endif // Q_OS_MACOS
|
||||||
}();
|
}();
|
||||||
|
@ -98,14 +97,14 @@ void FramelessHelperQt::addWindow(FramelessParamsConst params)
|
||||||
if (shouldApplyFramelessFlag) {
|
if (shouldApplyFramelessFlag) {
|
||||||
params->setWindowFlags(params->getWindowFlags() | Qt::FramelessWindowHint);
|
params->setWindowFlags(params->getWindowFlags() | Qt::FramelessWindowHint);
|
||||||
} else {
|
} else {
|
||||||
#ifdef Q_OS_LINUX
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
std::ignore = Utils::tryHideSystemTitleBar(windowId, true);
|
std::ignore = Utils::tryHideSystemTitleBar(windowId, true);
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
Utils::setSystemTitleBarVisible(windowId, false);
|
Utils::setSystemTitleBarVisible(windowId, false);
|
||||||
#endif // Q_OS_LINUX
|
#endif // Q_OS_LINUX
|
||||||
}
|
}
|
||||||
window->installEventFilter(data.eventFilter);
|
window->installEventFilter(data.eventFilter);
|
||||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
FramelessHelperEnableThemeAware();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramelessHelperQt::removeWindow(const WId windowId)
|
void FramelessHelperQt::removeWindow(const WId windowId)
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "framelesshelper_win.h"
|
#include "framelesshelper_win.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#include "framelessmanager_p.h"
|
#include "framelessmanager_p.h"
|
||||||
#include "framelessconfig_p.h"
|
#include "framelessconfig_p.h"
|
||||||
|
@ -42,18 +45,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperWin, "wangwenx190.framelesshelper.core.impl.win")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperWin, "wangwenx190.framelesshelper.core.impl.win")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessHelperWin)
|
# define INFO qCInfo(lcFramelessHelperWin)
|
||||||
# define DEBUG qCDebug(lcFramelessHelperWin)
|
# define DEBUG qCDebug(lcFramelessHelperWin)
|
||||||
# define WARNING qCWarning(lcFramelessHelperWin)
|
# define WARNING qCWarning(lcFramelessHelperWin)
|
||||||
# define CRITICAL qCCritical(lcFramelessHelperWin)
|
# define CRITICAL qCCritical(lcFramelessHelperWin)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -68,7 +70,7 @@ FRAMELESSHELPER_STRING_CONSTANT(GetClientRect)
|
||||||
#ifdef Q_PROCESSOR_X86_64
|
#ifdef Q_PROCESSOR_X86_64
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(GetWindowLongPtrW)
|
FRAMELESSHELPER_STRING_CONSTANT(GetWindowLongPtrW)
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(SetWindowLongPtrW)
|
FRAMELESSHELPER_STRING_CONSTANT(SetWindowLongPtrW)
|
||||||
#else // Q_PROCESSOR_X86_64
|
#else // !Q_PROCESSOR_X86_64
|
||||||
// WinUser.h defines G/SetClassLongPtr as G/SetClassLong due to the
|
// WinUser.h defines G/SetClassLongPtr as G/SetClassLong due to the
|
||||||
// "Ptr" suffixed APIs are not available on 32-bit platforms, so we
|
// "Ptr" suffixed APIs are not available on 32-bit platforms, so we
|
||||||
// have to add the following workaround. Undefine the macros and then
|
// have to add the following workaround. Undefine the macros and then
|
||||||
|
@ -90,7 +92,7 @@ FRAMELESSHELPER_STRING_CONSTANT(SetWindowPlacement)
|
||||||
|
|
||||||
enum class WindowPart : quint8
|
enum class WindowPart : quint8
|
||||||
{
|
{
|
||||||
NotInterested,
|
Outside,
|
||||||
ClientArea,
|
ClientArea,
|
||||||
ChromeButton,
|
ChromeButton,
|
||||||
ResizeBorder,
|
ResizeBorder,
|
||||||
|
@ -172,7 +174,7 @@ Q_GLOBAL_STATIC(FramelessWin32HelperInternal, g_framelessWin32HelperData)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return WindowPart::NotInterested;
|
return WindowPart::Outside;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] static inline constexpr bool isTaggedMessage(const WPARAM wParam)
|
[[nodiscard]] static inline constexpr bool isTaggedMessage(const WPARAM wParam)
|
||||||
|
@ -180,7 +182,7 @@ Q_GLOBAL_STATIC(FramelessWin32HelperInternal, g_framelessWin32HelperData)
|
||||||
return (wParam == kMessageTag);
|
return (wParam == kMessageTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] static inline bool listenForMouseLeave(const HWND hWnd, const bool nonClient)
|
[[nodiscard]] static inline bool requestForMouseLeaveMessage(const HWND hWnd, const bool nonClient)
|
||||||
{
|
{
|
||||||
Q_ASSERT(hWnd);
|
Q_ASSERT(hWnd);
|
||||||
if (!hWnd) {
|
if (!hWnd) {
|
||||||
|
@ -251,7 +253,7 @@ void FramelessHelperWin::addWindow(FramelessParamsConst params)
|
||||||
}
|
}
|
||||||
if (WindowsVersionHelper::isWin10RS1OrGreater()) {
|
if (WindowsVersionHelper::isWin10RS1OrGreater()) {
|
||||||
// Tell DWM we may need dark theme non-client area (title bar & frame border).
|
// Tell DWM we may need dark theme non-client area (title bar & frame border).
|
||||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
FramelessHelperEnableThemeAware();
|
||||||
if (WindowsVersionHelper::isWin10RS5OrGreater()) {
|
if (WindowsVersionHelper::isWin10RS5OrGreater()) {
|
||||||
const bool dark = (FramelessManager::instance()->systemTheme() == SystemTheme::Dark);
|
const bool dark = (FramelessManager::instance()->systemTheme() == SystemTheme::Dark);
|
||||||
const auto isWidget = [params]() -> bool {
|
const auto isWidget = [params]() -> bool {
|
||||||
|
@ -312,14 +314,16 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const UINT uMsg = msg->message;
|
const UINT uMsg = msg->message;
|
||||||
|
|
||||||
|
// We should skip these messages otherwise we will get crashes.
|
||||||
// WM_QUIT won't be posted to the WindowProc function.
|
// WM_QUIT won't be posted to the WindowProc function.
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
// undocumented messages
|
// Undocumented messages:
|
||||||
case WM_UNREGISTER_WINDOW_SERVICES:
|
|
||||||
case WM_UAHDESTROYWINDOW:
|
case WM_UAHDESTROYWINDOW:
|
||||||
|
case WM_UNREGISTER_WINDOW_SERVICES:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -353,8 +357,8 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
};
|
};
|
||||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 5, 1))
|
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 5, 1))
|
||||||
|
|
||||||
const auto emulateClientAreaMessage = [hWnd, uMsg, wParam, lParam](const std::optional<int> overrideMessage = std::nullopt) -> void {
|
const auto emulateClientAreaMessage = [hWnd, uMsg, wParam, lParam](const std::optional<int> &overrideMessage = std::nullopt) -> void {
|
||||||
auto myMsg = overrideMessage.value_or(uMsg);
|
const int myMsg = overrideMessage.value_or(uMsg);
|
||||||
const auto wparam = [myMsg, wParam]() -> WPARAM {
|
const auto wparam = [myMsg, wParam]() -> WPARAM {
|
||||||
if (myMsg == WM_NCMOUSELEAVE) {
|
if (myMsg == WM_NCMOUSELEAVE) {
|
||||||
return kMessageTag;
|
return kMessageTag;
|
||||||
|
@ -824,9 +828,9 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
// Even if the mouse is inside the chrome button area now, we should still allow the user
|
// Even if the mouse is inside the chrome button area now, we should still allow the user
|
||||||
// to be able to resize the window with the top or right window border, this is also the
|
// to be able to resize the window with the top or right window border, this is also the
|
||||||
// normal behavior of a native Win32 window.
|
// normal behavior of a native Win32 window.
|
||||||
static constexpr const int kTopBorderSize = 1;
|
static constexpr const int kBorderSize = 1;
|
||||||
const bool isTop = (nativeLocalPos.y <= kTopBorderSize);
|
const bool isTop = (nativeLocalPos.y <= kBorderSize);
|
||||||
const bool isRight = (nativeLocalPos.x >= (clientWidth - kTopBorderSize));
|
const bool isRight = (nativeLocalPos.x >= (clientWidth - kBorderSize));
|
||||||
if (isTop || isRight) {
|
if (isTop || isRight) {
|
||||||
if (isTop && isRight) {
|
if (isTop && isRight) {
|
||||||
*result = HTTOPRIGHT;
|
*result = HTTOPRIGHT;
|
||||||
|
@ -985,11 +989,10 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
case WM_MOUSEMOVE: {
|
case WM_MOUSEMOVE: {
|
||||||
const WindowPart previousWindowPart = getHittedWindowPart(data.hitTestResult.first.value_or(HTNOWHERE));
|
const WindowPart previousWindowPart = getHittedWindowPart(data.hitTestResult.first.value_or(HTNOWHERE));
|
||||||
const WindowPart currentWindowPart = getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE));
|
const WindowPart currentWindowPart = getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE));
|
||||||
if (previousWindowPart == WindowPart::ChromeButton && currentWindowPart == WindowPart::ClientArea) {
|
if ((previousWindowPart == WindowPart::ChromeButton) && (currentWindowPart == WindowPart::ClientArea)) {
|
||||||
std::ignore = listenForMouseLeave(hWnd, false);
|
std::ignore = requestForMouseLeaveMessage(hWnd, false);
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
}
|
|
||||||
case WM_NCMOUSEMOVE:
|
case WM_NCMOUSEMOVE:
|
||||||
case WM_NCLBUTTONDOWN:
|
case WM_NCLBUTTONDOWN:
|
||||||
case WM_NCLBUTTONUP:
|
case WM_NCLBUTTONUP:
|
||||||
|
@ -1010,30 +1013,25 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
#endif
|
#endif
|
||||||
case WM_NCMOUSEHOVER:
|
case WM_NCMOUSEHOVER:
|
||||||
case WM_NCMOUSELEAVE: {
|
case WM_NCMOUSELEAVE: {
|
||||||
// For future code readers:
|
|
||||||
// The following code is not workaround anything, it's just try to emulate the original
|
|
||||||
// behavior of a native Win32 window.
|
|
||||||
const WindowPart previousWindowPart = getHittedWindowPart(data.hitTestResult.first.value_or(HTNOWHERE));
|
const WindowPart previousWindowPart = getHittedWindowPart(data.hitTestResult.first.value_or(HTNOWHERE));
|
||||||
const WindowPart currentWindowPart = getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE));
|
const WindowPart currentWindowPart = getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE));
|
||||||
if (uMsg == WM_NCMOUSELEAVE) {
|
if (uMsg == WM_NCMOUSELEAVE) {
|
||||||
if (previousWindowPart == WindowPart::ChromeButton && currentWindowPart == WindowPart::NotInterested) {
|
if ((previousWindowPart == WindowPart::ChromeButton) && (currentWindowPart == WindowPart::Outside)) {
|
||||||
// If current window part is chrome button, it indicates that we must have clicked
|
// If current window part is chrome button, it indicates that we must have clicked
|
||||||
// the minimize button or maximize button, we also should send the client leave
|
// the minimize button or maximize button, we also should send the client leave
|
||||||
// message to Qt.
|
// message to Qt.
|
||||||
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentWindowPart == WindowPart::NotInterested) {
|
if (currentWindowPart == WindowPart::Outside) {
|
||||||
// The mouse is leaving window from non-client area, clear window part caches
|
// The mouse is leaving the window from the non-client area, clear window part cache.
|
||||||
auto &hitTestResult = muData.hitTestResult;
|
muData.hitTestResult = {};
|
||||||
hitTestResult.first.reset();
|
|
||||||
hitTestResult.second.reset();
|
|
||||||
|
|
||||||
// Notice: we're not going to clear window part caches when the mouse leaves window
|
// Notice: we're not going to clear window part cache when the mouse leaves window
|
||||||
// from client area, which means we will get previous window part as HTCLIENT if
|
// from client area, which means we will get previous window part as HTCLIENT if
|
||||||
// the mouse leaves window from client area and enters window from non-client area,
|
// the mouse leaves window from client area and enters window from non-client area,
|
||||||
// but it has no bad effect.
|
// but it has no bad effect.
|
||||||
|
|
||||||
std::ignore = data.params.resetQtGrabbedControl();
|
std::ignore = data.params.resetQtGrabbedControl();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1047,7 +1045,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
|| (currentWindowPart == WindowPart::FixedBorder))) {
|
|| (currentWindowPart == WindowPart::FixedBorder))) {
|
||||||
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to make sure we get the correct window part when a WM_NCMOUSELEAVE come,
|
// We need to make sure we get the correct window part when a WM_NCMOUSELEAVE come,
|
||||||
// so we reset current window part to null when we receive a WM_NCMOUSEMOVE.
|
// so we reset current window part to null when we receive a WM_NCMOUSEMOVE.
|
||||||
|
|
||||||
|
@ -1064,9 +1062,9 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
if (currentWindowPart == WindowPart::ChromeButton) {
|
if (currentWindowPart == WindowPart::ChromeButton) {
|
||||||
emulateClientAreaMessage();
|
emulateClientAreaMessage();
|
||||||
if (uMsg == WM_NCMOUSEMOVE) {
|
if (uMsg == WM_NCMOUSEMOVE) {
|
||||||
*result = ::DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
*result = ::DefWindowProcW(hWnd, WM_NCMOUSEMOVE, wParam, lParam);
|
||||||
} else {
|
} else {
|
||||||
*result = ((uMsg >= WM_NCXBUTTONDOWN) && (uMsg <= WM_NCXBUTTONDBLCLK)) ? TRUE : FALSE;
|
*result = (((uMsg >= WM_NCXBUTTONDOWN) && (uMsg <= WM_NCXBUTTONDBLCLK)) ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1155,7 +1153,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
if (filteredWParam == WA_INACTIVE) {
|
if (filteredWParam == WA_INACTIVE) {
|
||||||
if (getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE)) == WindowPart::ChromeButton) {
|
if (getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE)) == WindowPart::ChromeButton) {
|
||||||
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
||||||
|
|
||||||
// Clear window part cache
|
// Clear window part cache
|
||||||
auto &hitTestResult = muData.hitTestResult;
|
auto &hitTestResult = muData.hitTestResult;
|
||||||
hitTestResult.first.reset();
|
hitTestResult.first.reset();
|
||||||
|
@ -1167,7 +1165,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
case WM_INITMENU:{
|
case WM_INITMENU:{
|
||||||
if (getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE)) == WindowPart::ChromeButton) {
|
if (getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE)) == WindowPart::ChromeButton) {
|
||||||
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
||||||
|
|
||||||
// Clear window part cache
|
// Clear window part cache
|
||||||
auto &hitTestResult = muData.hitTestResult;
|
auto &hitTestResult = muData.hitTestResult;
|
||||||
hitTestResult.first.reset();
|
hitTestResult.first.reset();
|
||||||
|
@ -1179,7 +1177,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
if (wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED) {
|
if (wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED) {
|
||||||
if (getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE)) == WindowPart::ChromeButton) {
|
if (getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE)) == WindowPart::ChromeButton) {
|
||||||
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
||||||
|
|
||||||
// Clear window part cache
|
// Clear window part cache
|
||||||
auto &hitTestResult = muData.hitTestResult;
|
auto &hitTestResult = muData.hitTestResult;
|
||||||
hitTestResult.first.reset();
|
hitTestResult.first.reset();
|
||||||
|
@ -1349,3 +1347,5 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -96,31 +96,30 @@ QDebug operator<<(QDebug d, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::Dpi
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
#endif // QT_NO_DEBUG_STREAM
|
#endif // QT_NO_DEBUG_STREAM
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
// The "Q_INIT_RESOURCE()" macro can't be used within a namespace,
|
// The "Q_INIT_RESOURCE()" macro can't be used within a namespace,
|
||||||
// so we wrap it into a separate function outside of the namespace and
|
// so we wrap it into a separate function outside of the namespace and
|
||||||
// then call it instead inside the namespace, that's also the recommended
|
// then call it instead inside the namespace, that's also the recommended
|
||||||
// workaround provided by Qt's official documentation.
|
// workaround provided by Qt's official documentation.
|
||||||
void framelesshelpercore_initResource()
|
void FramelessHelperCoreInitResource()
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(framelesshelpercore);
|
Q_INIT_RESOURCE(framelesshelpercore);
|
||||||
}
|
}
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreGlobal, "wangwenx190.framelesshelper.core.global")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreGlobal, "wangwenx190.framelesshelper.core.global")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcCoreGlobal)
|
# define INFO qCInfo(lcCoreGlobal)
|
||||||
# define DEBUG qCDebug(lcCoreGlobal)
|
# define DEBUG qCDebug(lcCoreGlobal)
|
||||||
# define WARNING qCWarning(lcCoreGlobal)
|
# define WARNING qCWarning(lcCoreGlobal)
|
||||||
# define CRITICAL qCCritical(lcCoreGlobal)
|
# define CRITICAL qCCritical(lcCoreGlobal)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -129,22 +128,7 @@ using namespace Global;
|
||||||
static_assert(std::size(WindowsVersions) == (static_cast<int>(WindowsVersion::Latest) + 1));
|
static_assert(std::size(WindowsVersions) == (static_cast<int>(WindowsVersion::Latest) + 1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void registerInitializeHook(const InitializeHookCallback &cb)
|
void FramelessHelperCoreInitialize()
|
||||||
{
|
|
||||||
Q_UNUSED(cb);
|
|
||||||
WARNING << "registerInitializeHook: This function is deprecated and will be removed in a future version. Please consider using Qt's official Q_COREAPP_STARTUP_FUNCTION() macro instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
void registerUninitializeHook(const UninitializeHookCallback &cb)
|
|
||||||
{
|
|
||||||
Q_UNUSED(cb);
|
|
||||||
WARNING << "registerUninitializeHook: This function is deprecated and will be removed in a future version. Please consider using Qt's official qAddPostRoutine() function instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace FramelessHelper::Core
|
|
||||||
{
|
|
||||||
|
|
||||||
void initialize()
|
|
||||||
{
|
{
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (inited) {
|
if (inited) {
|
||||||
|
@ -152,9 +136,9 @@ void initialize()
|
||||||
}
|
}
|
||||||
inited = true;
|
inited = true;
|
||||||
|
|
||||||
outputLogo();
|
FramelessHelperPrintLogo();
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
// Qt's Wayland experience is not good, so we force the XCB backend here.
|
// Qt's Wayland experience is not good, so we force the XCB backend here.
|
||||||
// TODO: Remove this hack once Qt's Wayland implementation is good enough.
|
// TODO: Remove this hack once Qt's Wayland implementation is good enough.
|
||||||
// We are setting the preferred QPA backend, so we have to set it early
|
// We are setting the preferred QPA backend, so we have to set it early
|
||||||
|
@ -199,7 +183,7 @@ void initialize()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitialize()
|
void FramelessHelperCoreUninitialize()
|
||||||
{
|
{
|
||||||
static bool uninited = false;
|
static bool uninited = false;
|
||||||
if (uninited) {
|
if (uninited) {
|
||||||
|
@ -208,7 +192,7 @@ void uninitialize()
|
||||||
uninited = true;
|
uninited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionInfo version()
|
VersionInfo FramelessHelperVersion()
|
||||||
{
|
{
|
||||||
static const auto result = []() -> VersionInfo {
|
static const auto result = []() -> VersionInfo {
|
||||||
const auto _compiler = []() -> const char * { return COMPILER_STRING; }();
|
const auto _compiler = []() -> const char * { return COMPILER_STRING; }();
|
||||||
|
@ -220,7 +204,7 @@ VersionInfo version()
|
||||||
#endif
|
#endif
|
||||||
}();
|
}();
|
||||||
const auto _static = []() -> bool {
|
const auto _static = []() -> bool {
|
||||||
#ifdef FRAMELESSHELPER_CORE_STATIC
|
#if FRAMELESSHELPER_CONFIG(static_build)
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@ -239,7 +223,7 @@ VersionInfo version()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setApplicationOSThemeAware()
|
void FramelessHelperEnableThemeAware()
|
||||||
{
|
{
|
||||||
static bool set = false;
|
static bool set = false;
|
||||||
if (set) {
|
if (set) {
|
||||||
|
@ -257,7 +241,7 @@ void setApplicationOSThemeAware()
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0))) || \
|
#if ((defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0))) || \
|
||||||
(defined(Q_OS_MACOS) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))))
|
(defined(Q_OS_MACOS) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))))
|
||||||
// Linux: Qt 6.4 gained the ability to detect system theme change.
|
// Linux: Qt 6.4 gained the ability to detect system theme change.
|
||||||
// macOS: Qt 5.12.
|
// macOS: Qt 5.12.
|
||||||
|
@ -265,13 +249,13 @@ void setApplicationOSThemeAware()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void outputLogo()
|
void FramelessHelperPrintLogo()
|
||||||
{
|
{
|
||||||
static const bool noLogo = (qEnvironmentVariableIntValue("FRAMELESSHELPER_NO_LOGO") != 0);
|
static const bool noLogo = (qEnvironmentVariableIntValue("FRAMELESSHELPER_NO_LOGO") != 0);
|
||||||
if (noLogo) {
|
if (noLogo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const VersionInfo &ver = version();
|
const VersionInfo ver = FramelessHelperVersion();
|
||||||
QString message = {};
|
QString message = {};
|
||||||
QTextStream stream(&message, QIODevice::WriteOnly);
|
QTextStream stream(&message, QIODevice::WriteOnly);
|
||||||
stream << "FramelessHelper (" << (ver.isStatic ? "static" : "shared")
|
stream << "FramelessHelper (" << (ver.isStatic ? "static" : "shared")
|
||||||
|
@ -282,6 +266,4 @@ void outputLogo()
|
||||||
INFO.nospace().noquote() << message;
|
INFO.nospace().noquote() << message;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -44,18 +44,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessManager, "wangwenx190.framelesshelper.core.framelessmanager")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessManager, "wangwenx190.framelesshelper.core.framelessmanager")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessManager)
|
# define INFO qCInfo(lcFramelessManager)
|
||||||
# define DEBUG qCDebug(lcFramelessManager)
|
# define DEBUG qCDebug(lcFramelessManager)
|
||||||
# define WARNING qCWarning(lcFramelessManager)
|
# define WARNING qCWarning(lcFramelessManager)
|
||||||
# define CRITICAL qCCritical(lcFramelessManager)
|
# define CRITICAL qCCritical(lcFramelessManager)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -66,7 +65,7 @@ Q_GLOBAL_STATIC(FramelessManagerData, g_framelessManagerData)
|
||||||
|
|
||||||
static constexpr const int kEventDelayInterval = 1000;
|
static constexpr const int kEventDelayInterval = 1000;
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
[[nodiscard]] static inline QString iconFontFamilyName()
|
[[nodiscard]] static inline QString iconFontFamilyName()
|
||||||
{
|
{
|
||||||
static const auto result = []() -> QString {
|
static const auto result = []() -> QString {
|
||||||
|
@ -82,7 +81,7 @@ static constexpr const int kEventDelayInterval = 1000;
|
||||||
}();
|
}();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#endif
|
||||||
|
|
||||||
[[nodiscard]] static inline bool usePureQtImplementation()
|
[[nodiscard]] static inline bool usePureQtImplementation()
|
||||||
{
|
{
|
||||||
|
@ -128,7 +127,7 @@ const FramelessManagerPrivate *FramelessManagerPrivate::get(const FramelessManag
|
||||||
|
|
||||||
void FramelessManagerPrivate::initializeIconFont()
|
void FramelessManagerPrivate::initializeIconFont()
|
||||||
{
|
{
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (inited) {
|
if (inited) {
|
||||||
return;
|
return;
|
||||||
|
@ -147,9 +146,7 @@ void FramelessManagerPrivate::initializeIconFont()
|
||||||
|
|
||||||
QFont FramelessManagerPrivate::getIconFont()
|
QFont FramelessManagerPrivate::getIconFont()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
return {};
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
|
||||||
static const auto font = []() -> QFont {
|
static const auto font = []() -> QFont {
|
||||||
QFont f = {};
|
QFont f = {};
|
||||||
f.setFamily(iconFontFamilyName());
|
f.setFamily(iconFontFamilyName());
|
||||||
|
@ -161,7 +158,9 @@ QFont FramelessManagerPrivate::getIconFont()
|
||||||
return f;
|
return f;
|
||||||
}();
|
}();
|
||||||
return font;
|
return font;
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#else // !FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
|
return {};
|
||||||
|
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramelessManagerPrivate::notifySystemThemeHasChangedOrNot()
|
void FramelessManagerPrivate::notifySystemThemeHasChangedOrNot()
|
||||||
|
@ -281,7 +280,7 @@ void FramelessManagerPrivate::initialize()
|
||||||
// Set a global flag so that people can check whether FramelessHelper is being
|
// Set a global flag so that people can check whether FramelessHelper is being
|
||||||
// used without actually accessing the FramelessHelper interface.
|
// used without actually accessing the FramelessHelper interface.
|
||||||
static constexpr const char flag[] = "__FRAMELESSHELPER__";
|
static constexpr const char flag[] = "__FRAMELESSHELPER__";
|
||||||
const int ver = FramelessHelper::Core::version().version;
|
const int ver = FramelessHelperVersion().version;
|
||||||
qputenv(flag, QByteArray::number(ver));
|
qputenv(flag, QByteArray::number(ver));
|
||||||
qApp->setProperty(flag, ver);
|
qApp->setProperty(flag, ver);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "micamaterial.h"
|
#include "micamaterial.h"
|
||||||
#include "micamaterial_p.h"
|
#include "micamaterial_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "framelessconfig_p.h"
|
#include "framelessconfig_p.h"
|
||||||
|
@ -40,24 +43,23 @@
|
||||||
#include <QtGui/qpainter.h>
|
#include <QtGui/qpainter.h>
|
||||||
#include <QtGui/qscreen.h>
|
#include <QtGui/qscreen.h>
|
||||||
#include <QtGui/qguiapplication.h>
|
#include <QtGui/qguiapplication.h>
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# include <QtGui/private/qmemrotate_p.h>
|
# include <QtGui/private/qmemrotate_p.h>
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcMicaMaterial, "wangwenx190.framelesshelper.core.micamaterial")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcMicaMaterial, "wangwenx190.framelesshelper.core.micamaterial")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcMicaMaterial)
|
# define INFO qCInfo(lcMicaMaterial)
|
||||||
# define DEBUG qCDebug(lcMicaMaterial)
|
# define DEBUG qCDebug(lcMicaMaterial)
|
||||||
# define WARNING qCWarning(lcMicaMaterial)
|
# define WARNING qCWarning(lcMicaMaterial)
|
||||||
# define CRITICAL qCCritical(lcMicaMaterial)
|
# define CRITICAL qCCritical(lcMicaMaterial)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECLARE_SIZE_COMPARE_OPERATORS(QSize, QSize)
|
DECLARE_SIZE_COMPARE_OPERATORS(QSize, QSize)
|
||||||
|
@ -88,7 +90,7 @@ struct ImageData
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(ImageData, g_imageData)
|
Q_GLOBAL_STATIC(ImageData, g_imageData)
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
template<const int shift>
|
template<const int shift>
|
||||||
[[nodiscard]] static inline constexpr int qt_static_shift(const int value)
|
[[nodiscard]] static inline constexpr int qt_static_shift(const int value)
|
||||||
{
|
{
|
||||||
|
@ -429,7 +431,7 @@ static inline void expblur(QImage &img, qreal radius, const bool improvedQuality
|
||||||
expblur<12, 10, false>(blurImage, radius, quality, transposed);
|
expblur<12, 10, false>(blurImage, radius, quality, transposed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Transforms an \a alignment of Qt::AlignLeft or Qt::AlignRight
|
Transforms an \a alignment of Qt::AlignLeft or Qt::AlignRight
|
||||||
|
@ -485,6 +487,7 @@ static inline void expblur(QImage &img, qreal radius, const bool improvedQuality
|
||||||
class WallpaperThread : public QThread
|
class WallpaperThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(WallpaperThread)
|
Q_DISABLE_COPY_MOVE(WallpaperThread)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -576,11 +579,11 @@ protected:
|
||||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter.setRenderHint(QPainter::TextAntialiasing, false);
|
painter.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
painter.drawImage(desktopOriginPoint, buffer);
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
qt_blurImage(&painter, buffer, kDefaultBlurRadius, false, false);
|
qt_blurImage(&painter, buffer, kDefaultBlurRadius, false, false);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
painter.drawImage(desktopOriginPoint, buffer);
|
||||||
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
}
|
}
|
||||||
Q_EMIT imageUpdated();
|
Q_EMIT imageUpdated();
|
||||||
}
|
}
|
||||||
|
@ -653,7 +656,7 @@ void MicaMaterialPrivate::maybeGenerateBlurredWallpaper(const bool force)
|
||||||
|
|
||||||
void MicaMaterialPrivate::updateMaterialBrush()
|
void MicaMaterialPrivate::updateMaterialBrush()
|
||||||
{
|
{
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
framelesshelpercore_initResource();
|
framelesshelpercore_initResource();
|
||||||
static const QImage noiseTexture = QImage(FRAMELESSHELPER_STRING_LITERAL(":/org.wangwenx190.FramelessHelper/resources/images/noise.png"));
|
static const QImage noiseTexture = QImage(FRAMELESSHELPER_STRING_LITERAL(":/org.wangwenx190.FramelessHelper/resources/images/noise.png"));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||||
|
@ -670,7 +673,7 @@ void MicaMaterialPrivate::updateMaterialBrush()
|
||||||
const QRect rect = {QPoint(0, 0), micaTexture.size()};
|
const QRect rect = {QPoint(0, 0), micaTexture.size()};
|
||||||
painter.fillRect(rect, tintColor);
|
painter.fillRect(rect, tintColor);
|
||||||
painter.setOpacity(noiseOpacity);
|
painter.setOpacity(noiseOpacity);
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
painter.fillRect(rect, QBrush(noiseTexture));
|
painter.fillRect(rect, QBrush(noiseTexture));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||||
micaBrush = QBrush(micaTexture);
|
micaBrush = QBrush(micaTexture);
|
||||||
|
@ -964,3 +967,5 @@ void MicaMaterial::paint(QPainter *painter, const QRect &rect, const bool active
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#include "micamaterial.moc"
|
#include "micamaterial.moc"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
#include "framelesshelper_linux.h"
|
#include "framelesshelper_linux.h"
|
||||||
#include "sysapiloader_p.h"
|
#include "sysapiloader_p.h"
|
||||||
|
|
||||||
|
@ -509,3 +511,5 @@ QString gtkSettings(const gchar *property)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // __linux__
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if (defined(WIN32) || defined(_WIN32))
|
||||||
|
|
||||||
#include "sysapiloader_p.h"
|
#include "sysapiloader_p.h"
|
||||||
#include "winverhelper_p.h"
|
#include "winverhelper_p.h"
|
||||||
#include "framelesshelper_windows.h"
|
#include "framelesshelper_windows.h"
|
||||||
|
@ -499,3 +501,5 @@ _AdjustWindowRectExForDpi2(LPRECT lpRect, const DWORD dwStyle,
|
||||||
}
|
}
|
||||||
return pAdjustWindowRectExForDpi(lpRect, dwStyle, bMenu, dwExStyle, dpi);
|
return pAdjustWindowRectExForDpi(lpRect, dwStyle, bMenu, dwExStyle, dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "registrykey_p.h"
|
#include "registrykey_p.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
#include "framelesshelper_windows.h"
|
#include "framelesshelper_windows.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
@ -34,18 +37,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreRegistryKey, "wangwenx190.framelesshelper.core.registrykey")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreRegistryKey, "wangwenx190.framelesshelper.core.registrykey")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcCoreRegistryKey)
|
# define INFO qCInfo(lcCoreRegistryKey)
|
||||||
# define DEBUG qCDebug(lcCoreRegistryKey)
|
# define DEBUG qCDebug(lcCoreRegistryKey)
|
||||||
# define WARNING qCWarning(lcCoreRegistryKey)
|
# define WARNING qCWarning(lcCoreRegistryKey)
|
||||||
# define CRITICAL qCCritical(lcCoreRegistryKey)
|
# define CRITICAL qCCritical(lcCoreRegistryKey)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -153,3 +155,5 @@ QVariant RegistryKey::value(const QString &name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -57,29 +57,30 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysapiloader")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysapiloader")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcSysApiLoader)
|
# define INFO qCInfo(lcSysApiLoader)
|
||||||
# define DEBUG qCDebug(lcSysApiLoader)
|
# define DEBUG qCDebug(lcSysApiLoader)
|
||||||
# define WARNING qCWarning(lcSysApiLoader)
|
# define WARNING qCWarning(lcSysApiLoader)
|
||||||
# define CRITICAL qCCritical(lcSysApiLoader)
|
# define CRITICAL qCCritical(lcSysApiLoader)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using SysApiLoaderData = QHash<QString, QFunctionPointer>;
|
using SysApiLoaderData = QHash<QString, QFunctionPointer>;
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(SysApiLoaderData, g_sysApiLoaderData)
|
Q_GLOBAL_STATIC(SysApiLoaderData, g_sysApiLoaderData)
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[nodiscard]] static inline bool isDebug()
|
[[nodiscard]] static inline bool isDebug()
|
||||||
{
|
{
|
||||||
static const bool flag = qEnvironmentVariableIntValue("FRAMELESSHELPER_SYSAPILOADER_DEBUG");
|
static const bool flag = (qEnvironmentVariableIntValue("FRAMELESSHELPER_SYSAPILOADER_DEBUG") != 0);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SysApiLoader::SysApiLoader(QObject *parent) : QObject(parent)
|
SysApiLoader::SysApiLoader(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +99,7 @@ QString SysApiLoader::platformSharedLibrarySuffixName()
|
||||||
static const auto result = []() -> QString {
|
static const auto result = []() -> QString {
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
return FRAMELESSHELPER_STRING_LITERAL(".dll");
|
return FRAMELESSHELPER_STRING_LITERAL(".dll");
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
return FRAMELESSHELPER_STRING_LITERAL(".so");
|
return FRAMELESSHELPER_STRING_LITERAL(".so");
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
return FRAMELESSHELPER_STRING_LITERAL(".dylib");
|
return FRAMELESSHELPER_STRING_LITERAL(".dylib");
|
||||||
|
@ -187,16 +188,20 @@ bool SysApiLoader::isAvailable(const QString &library, const QString &function)
|
||||||
const QString key = generateUniqueKey(library, function);
|
const QString key = generateUniqueKey(library, function);
|
||||||
const auto it = g_sysApiLoaderData()->constFind(key);
|
const auto it = g_sysApiLoaderData()->constFind(key);
|
||||||
if (it != g_sysApiLoaderData()->constEnd()) {
|
if (it != g_sysApiLoaderData()->constEnd()) {
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
if (isDebug()) {
|
if (isDebug()) {
|
||||||
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return (it.value() != nullptr);
|
return (it.value() != nullptr);
|
||||||
} else {
|
} else {
|
||||||
const QFunctionPointer symbol = SysApiLoader::resolve(library, function);
|
const QFunctionPointer symbol = SysApiLoader::resolve(library, function);
|
||||||
g_sysApiLoaderData()->insert(key, symbol);
|
g_sysApiLoaderData()->insert(key, symbol);
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
if (isDebug()) {
|
if (isDebug()) {
|
||||||
DEBUG << Q_FUNC_INFO << "New function cache:" << key << (symbol ? "[VALID]" : "[NULL]");
|
DEBUG << Q_FUNC_INFO << "New function cache:" << key << (symbol ? "[VALID]" : "[NULL]");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
DEBUG << "Successfully loaded" << function << "from" << library;
|
DEBUG << "Successfully loaded" << function << "from" << library;
|
||||||
return true;
|
return true;
|
||||||
|
@ -217,14 +222,18 @@ QFunctionPointer SysApiLoader::get(const QString &library, const QString &functi
|
||||||
const QString key = generateUniqueKey(library, function);
|
const QString key = generateUniqueKey(library, function);
|
||||||
const auto it = g_sysApiLoaderData()->constFind(key);
|
const auto it = g_sysApiLoaderData()->constFind(key);
|
||||||
if (it != g_sysApiLoaderData()->constEnd()) {
|
if (it != g_sysApiLoaderData()->constEnd()) {
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
if (isDebug()) {
|
if (isDebug()) {
|
||||||
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return it.value();
|
return it.value();
|
||||||
} else {
|
} else {
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
if (isDebug()) {
|
if (isDebug()) {
|
||||||
DEBUG << Q_FUNC_INFO << "Function cache not found:" << key;
|
DEBUG << Q_FUNC_INFO << "Function cache not found:" << key;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,36 +36,35 @@
|
||||||
#include <QtGui/qpalette.h>
|
#include <QtGui/qpalette.h>
|
||||||
#include <QtGui/qsurface.h>
|
#include <QtGui/qsurface.h>
|
||||||
#include <QtGui/qsurfaceformat.h>
|
#include <QtGui/qsurfaceformat.h>
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# include <QtGui/private/qhighdpiscaling_p.h>
|
# include <QtGui/private/qhighdpiscaling_p.h>
|
||||||
# include <QtGui/private/qwindow_p.h>
|
# include <QtGui/private/qwindow_p.h>
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||||
# include <QtGui/qstylehints.h>
|
# include <QtGui/qstylehints.h>
|
||||||
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && !defined(FRAMELESSHELPER_CORE_NO_PRIVATE))
|
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||||
# include <QtGui/qpa/qplatformtheme.h>
|
# include <QtGui/qpa/qplatformtheme.h>
|
||||||
# include <QtGui/private/qguiapplication_p.h>
|
# include <QtGui/private/qguiapplication_p.h>
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
#endif // ((QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsCommon, "wangwenx190.framelesshelper.core.utils.common")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsCommon, "wangwenx190.framelesshelper.core.utils.common")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcUtilsCommon)
|
# define INFO qCInfo(lcUtilsCommon)
|
||||||
# define DEBUG qCDebug(lcUtilsCommon)
|
# define DEBUG qCDebug(lcUtilsCommon)
|
||||||
# define WARNING qCWarning(lcUtilsCommon)
|
# define WARNING qCWarning(lcUtilsCommon)
|
||||||
# define CRITICAL qCCritical(lcUtilsCommon)
|
# define CRITICAL qCCritical(lcUtilsCommon)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
struct FONT_ICON
|
struct FONT_ICON
|
||||||
{
|
{
|
||||||
quint32 SegoeUI = 0;
|
quint32 SegoeUI = 0;
|
||||||
|
@ -82,9 +81,9 @@ static constexpr const std::array<FONT_ICON, static_cast<int>(SystemButtonType::
|
||||||
FONT_ICON{ 0xE923, 0xE93D },
|
FONT_ICON{ 0xE923, 0xE93D },
|
||||||
FONT_ICON{ 0xE8BB, 0xE93B }
|
FONT_ICON{ 0xE8BB, 0xE93B }
|
||||||
};
|
};
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
[[nodiscard]] static inline QPoint getScaleOrigin(const QWindow *window)
|
[[nodiscard]] static inline QPoint getScaleOrigin(const QWindow *window)
|
||||||
{
|
{
|
||||||
Q_ASSERT(window);
|
Q_ASSERT(window);
|
||||||
|
@ -100,7 +99,7 @@ static constexpr const std::array<FONT_ICON, static_cast<int>(SystemButtonType::
|
||||||
}
|
}
|
||||||
return screen->geometry().topLeft();
|
return screen->geometry().topLeft();
|
||||||
}
|
}
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
|
||||||
Qt::CursorShape Utils::calculateCursorShape(const QWindow *window, const QPoint &pos)
|
Qt::CursorShape Utils::calculateCursorShape(const QWindow *window, const QPoint &pos)
|
||||||
{
|
{
|
||||||
|
@ -173,9 +172,7 @@ Qt::Edges Utils::calculateWindowEdges(const QWindow *window, const QPoint &pos)
|
||||||
|
|
||||||
QString Utils::getSystemButtonGlyph(const SystemButtonType button)
|
QString Utils::getSystemButtonGlyph(const SystemButtonType button)
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
return {};
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
|
||||||
const FONT_ICON &icon = g_fontIconsTable.at(static_cast<int>(button));
|
const FONT_ICON &icon = g_fontIconsTable.at(static_cast<int>(button));
|
||||||
# ifdef Q_OS_WINDOWS
|
# ifdef Q_OS_WINDOWS
|
||||||
// Windows 11: Segoe Fluent Icons (https://docs.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font)
|
// Windows 11: Segoe Fluent Icons (https://docs.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font)
|
||||||
|
@ -188,7 +185,9 @@ QString Utils::getSystemButtonGlyph(const SystemButtonType button)
|
||||||
// We always use our own icons on UNIX platforms because Microsoft doesn't allow distributing
|
// We always use our own icons on UNIX platforms because Microsoft doesn't allow distributing
|
||||||
// the Segoe icon font to other platforms than Windows.
|
// the Segoe icon font to other platforms than Windows.
|
||||||
return QChar(icon.Fallback);
|
return QChar(icon.Fallback);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#else // !FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
|
return {};
|
||||||
|
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
QWindow *Utils::findWindow(const WId windowId)
|
QWindow *Utils::findWindow(const WId windowId)
|
||||||
|
@ -294,15 +293,15 @@ bool Utils::shouldAppsUseDarkMode()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||||
return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark);
|
return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark);
|
||||||
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && !defined(FRAMELESSHELPER_CORE_NO_PRIVATE))
|
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||||
if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) {
|
if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) {
|
||||||
return (theme->appearance() == QPlatformTheme::Appearance::Dark);
|
return (theme->appearance() == QPlatformTheme::Appearance::Dark);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#else // ((QT_VERSION < QT_VERSION_CHECK(6, 2, 1)) || FRAMELESSHELPER_CORE_NO_PRIVATE)
|
#else // ((QT_VERSION < QT_VERSION_CHECK(6, 2, 1)) || !FRAMELESSHELPER_CONFIG(private_qt))
|
||||||
# ifdef Q_OS_WINDOWS
|
# ifdef Q_OS_WINDOWS
|
||||||
return shouldAppsUseDarkMode_windows();
|
return shouldAppsUseDarkMode_windows();
|
||||||
# elif defined(Q_OS_LINUX)
|
# elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
return shouldAppsUseDarkMode_linux();
|
return shouldAppsUseDarkMode_linux();
|
||||||
# elif defined(Q_OS_MACOS)
|
# elif defined(Q_OS_MACOS)
|
||||||
return shouldAppsUseDarkMode_macos();
|
return shouldAppsUseDarkMode_macos();
|
||||||
|
@ -319,7 +318,7 @@ qreal Utils::roundScaleFactor(const qreal factor)
|
||||||
if (factor < 1) {
|
if (factor < 1) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if (defined(FRAMELESSHELPER_CORE_NO_PRIVATE) || (QT_VERSION < QT_VERSION_CHECK(6, 2, 1)))
|
#if (!FRAMELESSHELPER_CONFIG(private_qt) || (QT_VERSION < QT_VERSION_CHECK(6, 2, 1)))
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
static const auto policy = QGuiApplication::highDpiScaleFactorRoundingPolicy();
|
static const auto policy = QGuiApplication::highDpiScaleFactorRoundingPolicy();
|
||||||
switch (policy) {
|
switch (policy) {
|
||||||
|
@ -343,9 +342,9 @@ qreal Utils::roundScaleFactor(const qreal factor)
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||||
return std::round(factor);
|
return std::round(factor);
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
#else // (!FRAMELESSHELPER_CORE_NO_PRIVATE && (QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)))
|
#else // (FRAMELESSHELPER_CONFIG(private_qt) && (QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)))
|
||||||
return QHighDpiScaling::roundScaleFactor(factor);
|
return QHighDpiScaling::roundScaleFactor(factor);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::toNativePixels(const QWindow *window, const int value)
|
int Utils::toNativePixels(const QWindow *window, const int value)
|
||||||
|
@ -354,11 +353,11 @@ int Utils::toNativePixels(const QWindow *window, const int value)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return std::round(qreal(value) * window->devicePixelRatio());
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::toNativePixels(value, window);
|
return QHighDpi::toNativePixels(value, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return std::round(qreal(value) * window->devicePixelRatio());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Utils::toNativePixels(const QWindow *window, const QPoint &point)
|
QPoint Utils::toNativePixels(const QWindow *window, const QPoint &point)
|
||||||
|
@ -367,12 +366,12 @@ QPoint Utils::toNativePixels(const QWindow *window, const QPoint &point)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return QHighDpi::toNativePixels(point, window);
|
||||||
|
#else
|
||||||
const QPoint origin = getScaleOrigin(window);
|
const QPoint origin = getScaleOrigin(window);
|
||||||
return QPointF(QPointF(point - origin) * window->devicePixelRatio()).toPoint() + origin;
|
return QPointF(QPointF(point - origin) * window->devicePixelRatio()).toPoint() + origin;
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif
|
||||||
return QHighDpi::toNativePixels(point, window);
|
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Utils::toNativePixels(const QWindow *window, const QSize &size)
|
QSize Utils::toNativePixels(const QWindow *window, const QSize &size)
|
||||||
|
@ -381,11 +380,11 @@ QSize Utils::toNativePixels(const QWindow *window, const QSize &size)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return QSizeF(QSizeF(size) * window->devicePixelRatio()).toSize();
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::toNativePixels(size, window);
|
return QHighDpi::toNativePixels(size, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return QSizeF(QSizeF(size) * window->devicePixelRatio()).toSize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect Utils::toNativePixels(const QWindow *window, const QRect &rect)
|
QRect Utils::toNativePixels(const QWindow *window, const QRect &rect)
|
||||||
|
@ -394,11 +393,11 @@ QRect Utils::toNativePixels(const QWindow *window, const QRect &rect)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return QRect(toNativePixels(window, rect.topLeft()), toNativePixels(window, rect.size()));
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::toNativePixels(rect, window);
|
return QHighDpi::toNativePixels(rect, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return QRect(toNativePixels(window, rect.topLeft()), toNativePixels(window, rect.size()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::fromNativePixels(const QWindow *window, const int value)
|
int Utils::fromNativePixels(const QWindow *window, const int value)
|
||||||
|
@ -407,11 +406,11 @@ int Utils::fromNativePixels(const QWindow *window, const int value)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return std::round(qreal(value) / window->devicePixelRatio());
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::fromNativePixels(value, window);
|
return QHighDpi::fromNativePixels(value, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return std::round(qreal(value) / window->devicePixelRatio());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Utils::fromNativePixels(const QWindow *window, const QPoint &point)
|
QPoint Utils::fromNativePixels(const QWindow *window, const QPoint &point)
|
||||||
|
@ -420,12 +419,12 @@ QPoint Utils::fromNativePixels(const QWindow *window, const QPoint &point)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return QHighDpi::fromNativePixels(point, window);
|
||||||
|
#else
|
||||||
const QPoint origin = getScaleOrigin(window);
|
const QPoint origin = getScaleOrigin(window);
|
||||||
return QPointF(QPointF(point - origin) / window->devicePixelRatio()).toPoint() + origin;
|
return QPointF(QPointF(point - origin) / window->devicePixelRatio()).toPoint() + origin;
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif
|
||||||
return QHighDpi::fromNativePixels(point, window);
|
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Utils::fromNativePixels(const QWindow *window, const QSize &size)
|
QSize Utils::fromNativePixels(const QWindow *window, const QSize &size)
|
||||||
|
@ -434,11 +433,11 @@ QSize Utils::fromNativePixels(const QWindow *window, const QSize &size)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return QSizeF(QSizeF(size) / window->devicePixelRatio()).toSize();
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::fromNativePixels(size, window);
|
return QHighDpi::fromNativePixels(size, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return QSizeF(QSizeF(size) / window->devicePixelRatio()).toSize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect Utils::fromNativePixels(const QWindow *window, const QRect &rect)
|
QRect Utils::fromNativePixels(const QWindow *window, const QRect &rect)
|
||||||
|
@ -447,11 +446,11 @@ QRect Utils::fromNativePixels(const QWindow *window, const QRect &rect)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return QRect(fromNativePixels(window, rect.topLeft()), fromNativePixels(window, rect.size()));
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::fromNativePixels(rect, window);
|
return QHighDpi::fromNativePixels(rect, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return QRect(fromNativePixels(window, rect.topLeft()), fromNativePixels(window, rect.size()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Utils::toNativeLocalPosition(const QWindow *window, const QPoint &point)
|
QPoint Utils::toNativeLocalPosition(const QWindow *window, const QPoint &point)
|
||||||
|
@ -460,11 +459,11 @@ QPoint Utils::toNativeLocalPosition(const QWindow *window, const QPoint &point)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return QPointF(QPointF(point) * window->devicePixelRatio()).toPoint();
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::toNativeLocalPosition(point, window);
|
return QHighDpi::toNativeLocalPosition(point, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return QPointF(QPointF(point) * window->devicePixelRatio()).toPoint();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Utils::toNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
QPoint Utils::toNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
||||||
|
@ -473,11 +472,11 @@ QPoint Utils::toNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#if (defined(FRAMELESSHELPER_CORE_NO_PRIVATE) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
#if (!FRAMELESSHELPER_CONFIG(private_qt) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
||||||
return toNativePixels(window, point);
|
return toNativePixels(window, point);
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE && QT_VERSION >= 6.0.0
|
#else
|
||||||
return QHighDpi::toNativeGlobalPosition(point, window);
|
return QHighDpi::toNativeGlobalPosition(point, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE || QT_VERSION < 6.0.0
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Utils::fromNativeLocalPosition(const QWindow *window, const QPoint &point)
|
QPoint Utils::fromNativeLocalPosition(const QWindow *window, const QPoint &point)
|
||||||
|
@ -486,11 +485,11 @@ QPoint Utils::fromNativeLocalPosition(const QWindow *window, const QPoint &point
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return QPointF(QPointF(point) / window->devicePixelRatio()).toPoint();
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return QHighDpi::fromNativeLocalPosition(point, window);
|
return QHighDpi::fromNativeLocalPosition(point, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return QPointF(QPointF(point) / window->devicePixelRatio()).toPoint();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Utils::fromNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
QPoint Utils::fromNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
||||||
|
@ -499,11 +498,11 @@ QPoint Utils::fromNativeGlobalPosition(const QWindow *window, const QPoint &poin
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#if (defined(FRAMELESSHELPER_CORE_NO_PRIVATE) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
#if (!FRAMELESSHELPER_CONFIG(private_qt) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
||||||
return fromNativePixels(window, point);
|
return fromNativePixels(window, point);
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE && QT_VERSION >= 6.0.0
|
#else
|
||||||
return QHighDpi::fromNativeGlobalPosition(point, window);
|
return QHighDpi::fromNativeGlobalPosition(point, window);
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE || QT_VERSION < 6.0.0
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::horizontalAdvance(const QFontMetrics &fm, const QString &str)
|
int Utils::horizontalAdvance(const QFontMetrics &fm, const QString &str)
|
||||||
|
@ -580,7 +579,7 @@ QColor Utils::getAccentColor()
|
||||||
#else // (QT_VERSION < QT_VERSION_CHECK(6, 6, 0))
|
#else // (QT_VERSION < QT_VERSION_CHECK(6, 6, 0))
|
||||||
# ifdef Q_OS_WINDOWS
|
# ifdef Q_OS_WINDOWS
|
||||||
return getAccentColor_windows();
|
return getAccentColor_windows();
|
||||||
# elif defined(Q_OS_LINUX)
|
# elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
return getAccentColor_linux();
|
return getAccentColor_linux();
|
||||||
# elif defined(Q_OS_MACOS)
|
# elif defined(Q_OS_MACOS)
|
||||||
return getAccentColor_macos();
|
return getAccentColor_macos();
|
||||||
|
@ -598,11 +597,11 @@ bool Utils::isWindowAccelerated(const QWindow *window)
|
||||||
}
|
}
|
||||||
switch (window->surfaceType()) {
|
switch (window->surfaceType()) {
|
||||||
case QSurface::RasterGLSurface:
|
case QSurface::RasterGLSurface:
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return true;
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
return qt_window_private(const_cast<QWindow *>(window))->compositing;
|
return qt_window_private(const_cast<QWindow *>(window))->compositing;
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
case QSurface::OpenGLSurface:
|
case QSurface::OpenGLSurface:
|
||||||
case QSurface::VulkanSurface:
|
case QSurface::VulkanSurface:
|
||||||
case QSurface::MetalSurface:
|
case QSurface::MetalSurface:
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
|
|
||||||
#include "framelessconfig_p.h"
|
#include "framelessconfig_p.h"
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#include "framelessmanager_p.h"
|
#include "framelessmanager_p.h"
|
||||||
|
@ -33,12 +36,12 @@
|
||||||
#include <QtGui/qscreen.h>
|
#include <QtGui/qscreen.h>
|
||||||
#include <QtGui/qpalette.h>
|
#include <QtGui/qpalette.h>
|
||||||
#include <QtGui/qguiapplication.h>
|
#include <QtGui/qguiapplication.h>
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# if __has_include(<QtX11Extras/qx11info_x11.h>)
|
# if __has_include(<QtX11Extras/qx11info_x11.h>)
|
||||||
# include <QtX11Extras/qx11info_x11.h>
|
# include <QtX11Extras/qx11info_x11.h>
|
||||||
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# endif // __has_include(<QtX11Extras/qx11info_x11.h>)
|
# endif // __has_include(<QtX11Extras/qx11info_x11.h>)
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# include <QtGui/qpa/qplatformnativeinterface.h>
|
# include <QtGui/qpa/qplatformnativeinterface.h>
|
||||||
# include <QtGui/qpa/qplatformwindow.h>
|
# include <QtGui/qpa/qplatformwindow.h>
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
@ -51,22 +54,21 @@
|
||||||
# include <QtGui/private/qtx11extras_p.h>
|
# include <QtGui/private/qtx11extras_p.h>
|
||||||
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcUtilsLinux)
|
# define INFO qCInfo(lcUtilsLinux)
|
||||||
# define DEBUG qCDebug(lcUtilsLinux)
|
# define DEBUG qCDebug(lcUtilsLinux)
|
||||||
# define WARNING qCWarning(lcUtilsLinux)
|
# define WARNING qCWarning(lcUtilsLinux)
|
||||||
# define CRITICAL qCCritical(lcUtilsLinux)
|
# define CRITICAL qCCritical(lcUtilsLinux)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -143,10 +145,7 @@ extern QString gtkSettings(const gchar *);
|
||||||
|
|
||||||
QScreen *Utils::x11_findScreenForVirtualDesktop(const int virtualDesktopNumber)
|
QScreen *Utils::x11_findScreenForVirtualDesktop(const int virtualDesktopNumber)
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
Q_UNUSED(virtualDesktopNumber);
|
|
||||||
return QGuiApplication::primaryScreen();
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (virtualDesktopNumber == -1) {
|
if (virtualDesktopNumber == -1) {
|
||||||
return QGuiApplication::primaryScreen();
|
return QGuiApplication::primaryScreen();
|
||||||
}
|
}
|
||||||
|
@ -167,7 +166,10 @@ QScreen *Utils::x11_findScreenForVirtualDesktop(const int virtualDesktopNumber)
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
Q_UNUSED(virtualDesktopNumber);
|
||||||
|
return QGuiApplication::primaryScreen();
|
||||||
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
}
|
}
|
||||||
|
|
||||||
x11_return_type Utils::x11_appRootWindow(const int screen)
|
x11_return_type Utils::x11_appRootWindow(const int screen)
|
||||||
|
@ -175,10 +177,7 @@ x11_return_type Utils::x11_appRootWindow(const int screen)
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::appRootWindow(screen);
|
return QX11Info::appRootWindow(screen);
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
Q_UNUSED(screen);
|
|
||||||
return 0;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +190,10 @@ x11_return_type Utils::x11_appRootWindow(const int screen)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(krootwindow, scr)));
|
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(krootwindow, scr)));
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
Q_UNUSED(screen);
|
||||||
|
return 0;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,9 +202,7 @@ int Utils::x11_appScreen()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::appScreen();
|
return QX11Info::appScreen();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return 0;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,9 @@ int Utils::x11_appScreen()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return reinterpret_cast<qintptr>(native->nativeResourceForIntegration(kx11screen));
|
return reinterpret_cast<qintptr>(native->nativeResourceForIntegration(kx11screen));
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return 0;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,9 +222,7 @@ x11_return_type Utils::x11_appTime()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::appTime();
|
return QX11Info::appTime();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return 0;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,9 @@ x11_return_type Utils::x11_appTime()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kapptime, screen)));
|
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kapptime, screen)));
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return 0;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,9 +246,7 @@ x11_return_type Utils::x11_appUserTime()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::appUserTime();
|
return QX11Info::appUserTime();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return 0;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,9 @@ x11_return_type Utils::x11_appUserTime()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kappusertime, screen)));
|
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kappusertime, screen)));
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return 0;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,9 +270,7 @@ x11_return_type Utils::x11_getTimestamp()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::getTimestamp();
|
return QX11Info::getTimestamp();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return 0;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,9 @@ x11_return_type Utils::x11_getTimestamp()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kgettimestamp, screen)));
|
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kgettimestamp, screen)));
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return 0;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,9 +294,7 @@ QByteArray Utils::x11_nextStartupId()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::nextStartupId();
|
return QX11Info::nextStartupId();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return {};
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,9 @@ QByteArray Utils::x11_nextStartupId()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return static_cast<char *>(native->nativeResourceForIntegration(kstartupid));
|
return static_cast<char *>(native->nativeResourceForIntegration(kstartupid));
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return {};
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,9 +314,7 @@ Display *Utils::x11_display()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::display();
|
return QX11Info::display();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return nullptr;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,9 @@ Display *Utils::x11_display()
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
return reinterpret_cast<Display *>(native->nativeResourceForIntegration(kdisplay));
|
return reinterpret_cast<Display *>(native->nativeResourceForIntegration(kdisplay));
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return nullptr;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,9 +343,7 @@ xcb_connection_t *Utils::x11_connection()
|
||||||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
return QX11Info::connection();
|
return QX11Info::connection();
|
||||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return nullptr;
|
|
||||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,9 @@ xcb_connection_t *Utils::x11_connection()
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
return reinterpret_cast<xcb_connection_t *>(native->nativeResourceForIntegration(kconnection));
|
return reinterpret_cast<xcb_connection_t *>(native->nativeResourceForIntegration(kconnection));
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
return nullptr;
|
||||||
|
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,3 +995,5 @@ bool Utils::setPlatformPropertiesForWindow(QWindow *window, const QVariantHash &
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_LINUX
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#include "framelessmanager_p.h"
|
#include "framelessmanager_p.h"
|
||||||
#include "framelessconfig_p.h"
|
#include "framelessconfig_p.h"
|
||||||
|
@ -67,18 +70,17 @@ FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsMac, "wangwenx190.framelesshelper.core.utils.mac")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsMac, "wangwenx190.framelesshelper.core.utils.mac")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcUtilsMac)
|
# define INFO qCInfo(lcUtilsMac)
|
||||||
# define DEBUG qCDebug(lcUtilsMac)
|
# define DEBUG qCDebug(lcUtilsMac)
|
||||||
# define WARNING qCWarning(lcUtilsMac)
|
# define WARNING qCWarning(lcUtilsMac)
|
||||||
# define CRITICAL qCCritical(lcUtilsMac)
|
# define CRITICAL qCCritical(lcUtilsMac)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -221,6 +223,7 @@ private:
|
||||||
class NSWindowProxy : public QObject
|
class NSWindowProxy : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
FRAMELESSHELPER_CLASS_INFO
|
||||||
Q_DISABLE_COPY_MOVE(NSWindowProxy)
|
Q_DISABLE_COPY_MOVE(NSWindowProxy)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -758,3 +761,5 @@ QColor Utils::getFrameBorderColor(const bool active)
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#include "utils_mac.moc"
|
#include "utils_mac.moc"
|
||||||
|
|
||||||
|
#endif // Q_OS_MACOS
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
#include "framelesshelper_windows.h"
|
#include "framelesshelper_windows.h"
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#include "framelessconfig_p.h"
|
#include "framelessconfig_p.h"
|
||||||
|
@ -39,7 +42,7 @@
|
||||||
#include <QtCore/qtextstream.h>
|
#include <QtCore/qtextstream.h>
|
||||||
#include <QtGui/qwindow.h>
|
#include <QtGui/qwindow.h>
|
||||||
#include <QtGui/qguiapplication.h>
|
#include <QtGui/qguiapplication.h>
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# include <QtCore/private/qsystemerror_p.h>
|
# include <QtCore/private/qsystemerror_p.h>
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtGui/private/qguiapplication_p.h>
|
# include <QtGui/private/qguiapplication_p.h>
|
||||||
|
@ -50,7 +53,7 @@
|
||||||
# else // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# else // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtGui/qpa/qplatformwindow_p.h>
|
# include <QtGui/qpa/qplatformwindow_p.h>
|
||||||
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
@ -59,18 +62,17 @@ Q_DECLARE_METATYPE(QMargins)
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsWin, "wangwenx190.framelesshelper.core.utils.win")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsWin, "wangwenx190.framelesshelper.core.utils.win")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcUtilsWin)
|
# define INFO qCInfo(lcUtilsWin)
|
||||||
# define DEBUG qCDebug(lcUtilsWin)
|
# define DEBUG qCDebug(lcUtilsWin)
|
||||||
# define WARNING qCWarning(lcUtilsWin)
|
# define WARNING qCWarning(lcUtilsWin)
|
||||||
# define CRITICAL qCCritical(lcUtilsWin)
|
# define CRITICAL qCCritical(lcUtilsWin)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -108,7 +110,7 @@ FRAMELESSHELPER_STRING_CONSTANT(SystemParametersInfoW)
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(SetClassLongPtrW)
|
FRAMELESSHELPER_STRING_CONSTANT(SetClassLongPtrW)
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(GetWindowLongPtrW)
|
FRAMELESSHELPER_STRING_CONSTANT(GetWindowLongPtrW)
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(SetWindowLongPtrW)
|
FRAMELESSHELPER_STRING_CONSTANT(SetWindowLongPtrW)
|
||||||
#else // Q_PROCESSOR_X86_64
|
#else // !Q_PROCESSOR_X86_64
|
||||||
// WinUser.h defines G/SetClassLongPtr as G/SetClassLong due to the
|
// WinUser.h defines G/SetClassLongPtr as G/SetClassLong due to the
|
||||||
// "Ptr" suffixed APIs are not available on 32-bit platforms, so we
|
// "Ptr" suffixed APIs are not available on 32-bit platforms, so we
|
||||||
// have to add the following workaround. Undefine the macros and then
|
// have to add the following workaround. Undefine the macros and then
|
||||||
|
@ -778,20 +780,20 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
||||||
if (code == ERROR_SUCCESS) {
|
if (code == ERROR_SUCCESS) {
|
||||||
return kSuccessMessageText;
|
return kSuccessMessageText;
|
||||||
}
|
}
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
const QString errorText = QSystemError::windowsString(code);
|
||||||
|
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
||||||
|
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
LPWSTR buf = nullptr;
|
LPWSTR buf = nullptr;
|
||||||
if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
nullptr, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&buf), 0, nullptr) == 0) {
|
nullptr, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&buf), 0, nullptr) == 0) {
|
||||||
return FRAMELESSHELPER_STRING_LITERAL("FormatMessageW() returned empty string.");
|
return FRAMELESSHELPER_STRING_LITERAL("FormatMessageW() returned empty string.");
|
||||||
}
|
}
|
||||||
const QString errorText = QString::fromWCharArray(buf).trimmed();
|
const QString errorText = QString::fromWCharArray(buf).trimmed();
|
||||||
::LocalFree(buf);
|
::LocalFree(buf);
|
||||||
buf = nullptr;
|
buf = nullptr;
|
||||||
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
const QString errorText = QSystemError::windowsString(code);
|
|
||||||
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] static inline QString getSystemErrorMessageImpl(const QString &function, const HRESULT hr)
|
[[nodiscard]] static inline QString getSystemErrorMessageImpl(const QString &function, const HRESULT hr)
|
||||||
|
@ -907,11 +909,13 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[nodiscard]] static inline bool isWin32MessageDebuggingEnabled()
|
[[nodiscard]] static inline bool isWin32MessageDebuggingEnabled()
|
||||||
{
|
{
|
||||||
static const bool result = (qEnvironmentVariableIntValue("FRAMELESSHELPER_ENABLE_WIN32_MESSAGE_DEBUGGING") != 0);
|
static const bool result = (qEnvironmentVariableIntValue("FRAMELESSHELPER_ENABLE_WIN32_MESSAGE_DEBUGGING") != 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
[[nodiscard]] static inline QByteArray qtNativeEventType()
|
[[nodiscard]] static inline QByteArray qtNativeEventType()
|
||||||
{
|
{
|
||||||
|
@ -965,6 +969,7 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
||||||
if (!hWnd) {
|
if (!hWnd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
if (isWin32MessageDebuggingEnabled()) {
|
if (isWin32MessageDebuggingEnabled()) {
|
||||||
MSG message;
|
MSG message;
|
||||||
SecureZeroMemory(&message, sizeof(message));
|
SecureZeroMemory(&message, sizeof(message));
|
||||||
|
@ -975,6 +980,7 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
||||||
// The time and pt members are not used.
|
// The time and pt members are not used.
|
||||||
Utils::printWin32Message(&message);
|
Utils::printWin32Message(&message);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
const auto windowId = reinterpret_cast<WId>(hWnd);
|
const auto windowId = reinterpret_cast<WId>(hWnd);
|
||||||
const auto it = g_win32UtilsData()->data.constFind(windowId);
|
const auto it = g_win32UtilsData()->data.constFind(windowId);
|
||||||
if (it == g_win32UtilsData()->data.constEnd()) {
|
if (it == g_win32UtilsData()->data.constEnd()) {
|
||||||
|
@ -1231,7 +1237,7 @@ bool Utils::updateInternalWindowFrameMargins(QWindow *window, const bool enable)
|
||||||
}();
|
}();
|
||||||
const QVariant marginsVar = QVariant::fromValue(margins);
|
const QVariant marginsVar = QVariant::fromValue(margins);
|
||||||
window->setProperty(kQtWindowCustomMarginsVar, marginsVar);
|
window->setProperty(kQtWindowCustomMarginsVar, marginsVar);
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (QPlatformWindow *platformWindow = window->handle()) {
|
if (QPlatformWindow *platformWindow = window->handle()) {
|
||||||
if (const auto ni = QGuiApplication::platformNativeInterface()) {
|
if (const auto ni = QGuiApplication::platformNativeInterface()) {
|
||||||
|
@ -1252,7 +1258,7 @@ bool Utils::updateInternalWindowFrameMargins(QWindow *window, const bool enable)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
return triggerFrameChange(windowId);
|
return triggerFrameChange(windowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2215,7 +2221,7 @@ bool Utils::shouldAppsUseDarkMode_windows()
|
||||||
if (!WindowsVersionHelper::isWin10RS1OrGreater() || isHighContrastModeEnabled()) {
|
if (!WindowsVersionHelper::isWin10RS1OrGreater() || isHighContrastModeEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (const auto app = qApp->nativeInterface<QNativeInterface::Private::QWindowsApplication>()) {
|
if (const auto app = qApp->nativeInterface<QNativeInterface::Private::QWindowsApplication>()) {
|
||||||
return app->isDarkMode();
|
return app->isDarkMode();
|
||||||
|
@ -2232,7 +2238,7 @@ bool Utils::shouldAppsUseDarkMode_windows()
|
||||||
// Qt gained the ability to detect the system dark mode setting only since 5.15.
|
// Qt gained the ability to detect the system dark mode setting only since 5.15.
|
||||||
// We should detect it ourself on versions below that.
|
// We should detect it ourself on versions below that.
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
// Starting from Windows 10 1903, "ShouldAppsUseDarkMode()" (exported by UXTHEME.DLL,
|
// Starting from Windows 10 1903, "ShouldAppsUseDarkMode()" (exported by UXTHEME.DLL,
|
||||||
// ordinal number 132) always return "TRUE" (actually, a random non-zero number at
|
// ordinal number 132) always return "TRUE" (actually, a random non-zero number at
|
||||||
// runtime), so we can't use it due to this unreliability. In this case, we just simply
|
// runtime), so we can't use it due to this unreliability. In this case, we just simply
|
||||||
|
@ -2598,10 +2604,7 @@ bool Utils::hideOriginalTitleBarElements(const WId windowId, const bool disable)
|
||||||
|
|
||||||
bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
Q_UNUSED(enable);
|
|
||||||
return true;
|
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
// We'll call QPA functions, so we have to ensure that the QGuiApplication
|
// We'll call QPA functions, so we have to ensure that the QGuiApplication
|
||||||
// instance has already been created and initialized, because the platform
|
// instance has already been created and initialized, because the platform
|
||||||
|
@ -2625,10 +2628,10 @@ bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
||||||
// There's no global dark theme for Qt Quick applications, so setting this
|
// There's no global dark theme for Qt Quick applications, so setting this
|
||||||
// flag has no effect for pure Qt Quick applications.
|
// flag has no effect for pure Qt Quick applications.
|
||||||
return {App::DarkModeWindowFrames | App::DarkModeStyle};
|
return {App::DarkModeWindowFrames | App::DarkModeStyle};
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 5, 0)) \
|
||||||
// Don't try to use the broken dark theme for Qt Widgets applications.
|
// Don't try to use the broken dark theme for Qt Widgets applications. \
|
||||||
// For Qt Quick applications this is also enough. There's no global dark
|
// For Qt Quick applications this is also enough. There's no global dark \
|
||||||
// theme for them anyway.
|
// theme for them anyway.
|
||||||
return {App::DarkModeWindowFrames};
|
return {App::DarkModeWindowFrames};
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||||
}());
|
}());
|
||||||
|
@ -2641,7 +2644,10 @@ bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
||||||
Q_UNUSED(enable);
|
Q_UNUSED(enable);
|
||||||
return true;
|
return true;
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
Q_UNUSED(enable);
|
||||||
|
return true;
|
||||||
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::registerThemeChangeNotification()
|
bool Utils::registerThemeChangeNotification()
|
||||||
|
@ -3071,6 +3077,12 @@ quint64 Utils::getKeyState()
|
||||||
if (get(VK_RBUTTON)) {
|
if (get(VK_RBUTTON)) {
|
||||||
result |= (buttonSwapped ? MK_LBUTTON : MK_RBUTTON);
|
result |= (buttonSwapped ? MK_LBUTTON : MK_RBUTTON);
|
||||||
}
|
}
|
||||||
|
if (get(VK_SHIFT)) {
|
||||||
|
result |= MK_SHIFT;
|
||||||
|
}
|
||||||
|
if (get(VK_CONTROL)) {
|
||||||
|
result |= MK_CONTROL;
|
||||||
|
}
|
||||||
if (get(VK_MBUTTON)) {
|
if (get(VK_MBUTTON)) {
|
||||||
result |= MK_MBUTTON;
|
result |= MK_MBUTTON;
|
||||||
}
|
}
|
||||||
|
@ -3192,7 +3204,7 @@ QMargins Utils::getWindowCustomFrameMargins(const QWindow *window)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (QPlatformWindow *platformWindow = window->handle()) {
|
if (QPlatformWindow *platformWindow = window->handle()) {
|
||||||
if (const auto ni = QGuiApplication::platformNativeInterface()) {
|
if (const auto ni = QGuiApplication::platformNativeInterface()) {
|
||||||
|
@ -3213,7 +3225,7 @@ QMargins Utils::getWindowCustomFrameMargins(const QWindow *window)
|
||||||
WARNING << "Failed to retrieve the platform window.";
|
WARNING << "Failed to retrieve the platform window.";
|
||||||
}
|
}
|
||||||
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
const QVariant marginsVar = window->property(kQtWindowCustomMarginsVar);
|
const QVariant marginsVar = window->property(kQtWindowCustomMarginsVar);
|
||||||
if (marginsVar.isValid() && !marginsVar.isNull()) {
|
if (marginsVar.isValid() && !marginsVar.isNull()) {
|
||||||
return qvariant_cast<QMargins>(marginsVar);
|
return qvariant_cast<QMargins>(marginsVar);
|
||||||
|
@ -3247,7 +3259,7 @@ void Utils::printWin32Message(void *msgPtr)
|
||||||
const LPARAM lParam = msg->lParam;
|
const LPARAM lParam = msg->lParam;
|
||||||
const QString messageCodeHex = FRAMELESSHELPER_STRING_LITERAL("0x") + QString::number(uMsg, 16).toUpper().rightJustified(4, u'0');
|
const QString messageCodeHex = FRAMELESSHELPER_STRING_LITERAL("0x") + QString::number(uMsg, 16).toUpper().rightJustified(4, u'0');
|
||||||
QString text = {};
|
QString text = {};
|
||||||
QTextStream stream(&text);
|
QTextStream stream(&text, QIODevice::WriteOnly);
|
||||||
stream << "Windows message received: window handle: " << hwnd2str(hWnd) << ", message: ";
|
stream << "Windows message received: window handle: " << hwnd2str(hWnd) << ", message: ";
|
||||||
if (uMsg >= WM_APP) {
|
if (uMsg >= WM_APP) {
|
||||||
const UINT diff = (uMsg - WM_APP);
|
const UINT diff = (uMsg - WM_APP);
|
||||||
|
@ -3312,3 +3324,5 @@ void Utils::printWin32Message(void *msgPtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "windowborderpainter.h"
|
#include "windowborderpainter.h"
|
||||||
#include "windowborderpainter_p.h"
|
#include "windowborderpainter_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "framelessmanager.h"
|
#include "framelessmanager.h"
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
|
@ -34,18 +37,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWindowBorderPainter, "wangwenx190.framelesshelper.core.windowborderpainter")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWindowBorderPainter, "wangwenx190.framelesshelper.core.windowborderpainter")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcWindowBorderPainter)
|
# define INFO qCInfo(lcWindowBorderPainter)
|
||||||
# define DEBUG qCDebug(lcWindowBorderPainter)
|
# define DEBUG qCDebug(lcWindowBorderPainter)
|
||||||
# define WARNING qCWarning(lcWindowBorderPainter)
|
# define WARNING qCWarning(lcWindowBorderPainter)
|
||||||
# define CRITICAL qCCritical(lcWindowBorderPainter)
|
# define CRITICAL qCCritical(lcWindowBorderPainter)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -116,9 +118,13 @@ QColor WindowBorderPainter::inactiveColor() const
|
||||||
|
|
||||||
int WindowBorderPainter::nativeThickness() const
|
int WindowBorderPainter::nativeThickness() const
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
// Qt will scale it to the appropriate value for us automatically,
|
// Qt will scale it to the appropriate value for us automatically,
|
||||||
// based on the current system DPI and scale factor rounding policy.
|
// based on the current system DPI and scale factor rounding policy.
|
||||||
return kDefaultWindowFrameBorderThickness;
|
return kDefaultWindowFrameBorderThickness;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowEdges WindowBorderPainter::nativeEdges() const
|
WindowEdges WindowBorderPainter::nativeEdges() const
|
||||||
|
@ -254,3 +260,5 @@ void WindowBorderPainter::setInactiveColor(const QColor &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "winverhelper_p.h"
|
#include "winverhelper_p.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
@ -148,3 +151,5 @@ IMPL(1122H2, 11_22H2)
|
||||||
#undef IMPL
|
#undef IMPL
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
|
@ -41,10 +41,6 @@ set(PUBLIC_HEADERS
|
||||||
${INCLUDE_PREFIX}/framelessquickmodule.h
|
${INCLUDE_PREFIX}/framelessquickmodule.h
|
||||||
${INCLUDE_PREFIX}/framelessquickhelper.h
|
${INCLUDE_PREFIX}/framelessquickhelper.h
|
||||||
${INCLUDE_PREFIX}/framelessquickutils.h
|
${INCLUDE_PREFIX}/framelessquickutils.h
|
||||||
${INCLUDE_PREFIX}/quickchromepalette.h
|
|
||||||
${INCLUDE_PREFIX}/quickmicamaterial.h
|
|
||||||
${INCLUDE_PREFIX}/quickimageitem.h
|
|
||||||
${INCLUDE_PREFIX}/quickwindowborder.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PUBLIC_HEADERS_ALIAS
|
set(PUBLIC_HEADERS_ALIAS
|
||||||
|
@ -52,40 +48,56 @@ set(PUBLIC_HEADERS_ALIAS
|
||||||
${INCLUDE_PREFIX}/FramelessQuickModule
|
${INCLUDE_PREFIX}/FramelessQuickModule
|
||||||
${INCLUDE_PREFIX}/FramelessQuickHelper
|
${INCLUDE_PREFIX}/FramelessQuickHelper
|
||||||
${INCLUDE_PREFIX}/FramelessQuickUtils
|
${INCLUDE_PREFIX}/FramelessQuickUtils
|
||||||
${INCLUDE_PREFIX}/QuickChromePalette
|
|
||||||
${INCLUDE_PREFIX}/QuickMicaMaterial
|
|
||||||
${INCLUDE_PREFIX}/QuickImageItem
|
|
||||||
${INCLUDE_PREFIX}/QuickWindowBorder
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PRIVATE_HEADERS
|
set(PRIVATE_HEADERS
|
||||||
${INCLUDE_PREFIX}/private/quickstandardsystembutton_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/quickstandardtitlebar_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelessquickhelper_p.h
|
${INCLUDE_PREFIX}/private/framelessquickhelper_p.h
|
||||||
${INCLUDE_PREFIX}/private/framelessquickwindow_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelessquickwindow_p_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelessquickapplicationwindow_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelessquickapplicationwindow_p_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/quickmicamaterial_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/quickimageitem_p.h
|
${INCLUDE_PREFIX}/private/quickimageitem_p.h
|
||||||
${INCLUDE_PREFIX}/private/quickwindowborder_p.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
quickstandardsystembutton.cpp
|
|
||||||
quickstandardtitlebar.cpp
|
|
||||||
framelessquickutils.cpp
|
framelessquickutils.cpp
|
||||||
framelessquickmodule.cpp
|
|
||||||
framelessquickwindow.cpp
|
|
||||||
framelessquickapplicationwindow.cpp
|
|
||||||
framelessquickhelper.cpp
|
framelessquickhelper.cpp
|
||||||
quickchromepalette.cpp
|
|
||||||
framelesshelperquick_global.cpp
|
framelesshelperquick_global.cpp
|
||||||
quickmicamaterial.cpp
|
|
||||||
quickimageitem.cpp
|
quickimageitem.cpp
|
||||||
quickwindowborder.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_SYSTEM_BUTTON)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickstandardsystembutton_p.h)
|
||||||
|
list(APPEND SOURCES quickstandardsystembutton.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/quickchromepalette.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/QuickChromePalette)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickstandardtitlebar_p.h)
|
||||||
|
list(APPEND SOURCES quickchromepalette.cpp quickstandardtitlebar.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_WINDOW)
|
||||||
|
list(APPEND PRIVATE_HEADERS
|
||||||
|
${INCLUDE_PREFIX}/private/framelessquickwindow_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/framelessquickwindow_p_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/framelessquickapplicationwindow_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/framelessquickapplicationwindow_p_p.h
|
||||||
|
)
|
||||||
|
list(APPEND SOURCES framelessquickwindow.cpp framelessquickapplicationwindow.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_MICA_MATERIAL)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/quickmicamaterial.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/QuickMicaMaterial)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickmicamaterial_p.h)
|
||||||
|
list(APPEND SOURCES quickmicamaterial.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_BORDER_PAINTER)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/quickwindowborder.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/QuickWindowBorder)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickwindowborder_p.h)
|
||||||
|
list(APPEND SOURCES quickwindowborder.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||||
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
||||||
if(NOT EXISTS "${__rc_path}")
|
if(NOT EXISTS "${__rc_path}")
|
||||||
|
@ -118,6 +130,7 @@ add_library(${PROJECT_NAME}::${SUB_MODULE_FULL_NAME} ALIAS ${SUB_MODULE_TARGET})
|
||||||
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
||||||
VERSION "${PROJECT_VERSION}"
|
VERSION "${PROJECT_VERSION}"
|
||||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||||
|
OUTPUT_NAME "${SUB_MODULE_TARGET}${FRAMELESSHELPER_64BIT_POSTFIX}"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(__export_targets ${SUB_MODULE_TARGET})
|
set(__export_targets ${SUB_MODULE_TARGET})
|
||||||
|
@ -138,8 +151,8 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
VERSION "1.0"
|
VERSION "1.0"
|
||||||
OUTPUT_DIRECTORY "${__import_base_dir}/org/wangwenx190/${PROJECT_NAME}"
|
OUTPUT_DIRECTORY "${__import_base_dir}/org/wangwenx190/${PROJECT_NAME}"
|
||||||
RESOURCE_PREFIX "/"
|
RESOURCE_PREFIX "/"
|
||||||
TYPEINFO "plugins.qmltypes" # This is the type info file name since at least Qt5, some tools won't recognize other names.
|
TYPEINFO "plugins.qmltypes" # This is the default type info file name since at least Qt5, some tools won't recognize other names.
|
||||||
#NO_RESOURCE_TARGET_PATH # Can't be used for non-executables.
|
#NO_RESOURCE_TARGET_PATH # Can't be used for non-executable targets.
|
||||||
OUTPUT_TARGETS __qml_targets
|
OUTPUT_TARGETS __qml_targets
|
||||||
IMPORTS
|
IMPORTS
|
||||||
QtQml/auto
|
QtQml/auto
|
||||||
|
@ -213,31 +226,6 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_QUICK_STATIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
|
||||||
FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_QUICK_NO_BUNDLE_RESOURCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_QUICK_NO_PRIVATE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
|
||||||
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
|
||||||
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_NAMESPACE=${FRAMELESSHELPER_NAMESPACE})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||||
FRAMELESSHELPER_QUICK_LIBRARY
|
FRAMELESSHELPER_QUICK_LIBRARY
|
||||||
)
|
)
|
||||||
|
@ -254,7 +242,7 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${SUB_MODULE_TARGET} PUBLIC
|
target_link_libraries(${SUB_MODULE_TARGET} PRIVATE
|
||||||
${PROJECT_NAME}::Core
|
${PROJECT_NAME}::Core
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,24 +23,65 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "framelesshelperquick_global.h"
|
#include "framelesshelperquick_global.h"
|
||||||
|
#include "framelessquickhelper.h"
|
||||||
|
#include "framelessquickutils.h"
|
||||||
|
#include "quickimageitem_p.h"
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
# include "quickchromepalette.h"
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
# include "quickmicamaterial.h"
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
# include "quickwindowborder.h"
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
|
# if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
# include "framelessquickwindow_p.h"
|
||||||
|
# endif
|
||||||
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
# if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
# include "framelessquickapplicationwindow_p.h"
|
||||||
|
# endif
|
||||||
|
# if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
# include "quickstandardsystembutton_p.h"
|
||||||
|
# endif
|
||||||
|
# if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
# include "quickstandardtitlebar_p.h"
|
||||||
|
# endif
|
||||||
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
#endif
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
|
||||||
#define REG_META_TYPE(Type) qRegisterMetaType<Type>(#Type)
|
#ifndef QUICK_URI_SHORT
|
||||||
|
# define QUICK_URI_SHORT FRAMELESSHELPER_QUICK_URI, FRAMELESSHELPER_QUICK_VERSION_MAJOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef QUICK_URI_FULL
|
||||||
|
# define QUICK_URI_FULL QUICK_URI_SHORT, FRAMELESSHELPER_QUICK_VERSION_MINOR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef QUICK_URI_EXPAND
|
||||||
|
# define QUICK_URI_EXPAND(name) QUICK_URI_FULL, name
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef REG_META_TYPE
|
||||||
|
# define REG_META_TYPE(Type) qRegisterMetaType<Type>(#Type)
|
||||||
|
#endif
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickGlobal, "wangwenx190.framelesshelper.quick.global")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickGlobal, "wangwenx190.framelesshelper.quick.global")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickGlobal)
|
# define INFO qCInfo(lcQuickGlobal)
|
||||||
# define DEBUG qCDebug(lcQuickGlobal)
|
# define DEBUG qCDebug(lcQuickGlobal)
|
||||||
# define WARNING qCWarning(lcQuickGlobal)
|
# define WARNING qCWarning(lcQuickGlobal)
|
||||||
# define CRITICAL qCCritical(lcQuickGlobal)
|
# define CRITICAL qCCritical(lcQuickGlobal)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QuickGlobal::QuickGlobal(QObject *parent) : QObject(parent)
|
QuickGlobal::QuickGlobal(QObject *parent) : QObject(parent)
|
||||||
|
@ -49,10 +90,7 @@ QuickGlobal::QuickGlobal(QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
QuickGlobal::~QuickGlobal() = default;
|
QuickGlobal::~QuickGlobal() = default;
|
||||||
|
|
||||||
namespace FramelessHelper::Quick
|
void FramelessHelperQuickInitialize()
|
||||||
{
|
|
||||||
|
|
||||||
void initialize()
|
|
||||||
{
|
{
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (inited) {
|
if (inited) {
|
||||||
|
@ -60,7 +98,7 @@ void initialize()
|
||||||
}
|
}
|
||||||
inited = true;
|
inited = true;
|
||||||
|
|
||||||
FramelessHelper::Core::initialize();
|
FramelessHelperCoreInitialize();
|
||||||
|
|
||||||
// Registering meta types only causes troubles in Qt6.
|
// Registering meta types only causes troubles in Qt6.
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
@ -72,7 +110,7 @@ void initialize()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitialize()
|
void FramelessHelperQuickUninitialize()
|
||||||
{
|
{
|
||||||
static bool uninited = false;
|
static bool uninited = false;
|
||||||
if (uninited) {
|
if (uninited) {
|
||||||
|
@ -82,9 +120,80 @@ void uninitialize()
|
||||||
|
|
||||||
// ### TODO: The Quick module-specific uninitialization.
|
// ### TODO: The Quick module-specific uninitialization.
|
||||||
|
|
||||||
FramelessHelper::Core::uninitialize();
|
FramelessHelperCoreUninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FramelessHelperQuickRegisterTypes(QQmlEngine *engine)
|
||||||
|
{
|
||||||
|
Q_ASSERT(engine);
|
||||||
|
if (!engine) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In most cases we don't need to register the QML types for multiple times.
|
||||||
|
static bool reg = false;
|
||||||
|
if (reg) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reg = true;
|
||||||
|
|
||||||
|
// @uri org.wangwenx190.FramelessHelper
|
||||||
|
qmlRegisterUncreatableType<QuickGlobal>(QUICK_URI_FULL, "FramelessHelperConstants",
|
||||||
|
FRAMELESSHELPER_STRING_LITERAL("The FramelessHelperConstants namespace is not creatable, you can only use it to access it's enums."));
|
||||||
|
|
||||||
|
qmlRegisterSingletonType<FramelessQuickUtils>(QUICK_URI_EXPAND("FramelessUtils"),
|
||||||
|
[](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
||||||
|
Q_UNUSED(engine);
|
||||||
|
Q_UNUSED(scriptEngine);
|
||||||
|
return new FramelessQuickUtils;
|
||||||
|
});
|
||||||
|
|
||||||
|
qmlRegisterType<FramelessQuickHelper>(QUICK_URI_EXPAND("FramelessHelper"));
|
||||||
|
qmlRegisterType<QuickImageItem>(QUICK_URI_EXPAND("ImageItem"));
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
qmlRegisterAnonymousType<QuickChromePalette>(QUICK_URI_SHORT);
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
qmlRegisterType<QuickMicaMaterial>(QUICK_URI_EXPAND("MicaMaterial"));
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
qmlRegisterType<QuickWindowBorder>(QUICK_URI_EXPAND("WindowBorder"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||||
|
qmlRegisterType<FramelessQuickWindow>(QUICK_URI_EXPAND("FramelessWindow"));
|
||||||
|
#else
|
||||||
|
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessWindow"),
|
||||||
|
FRAMELESSHELPER_STRING_LITERAL("FramelessWindow is not available."));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ((QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||||
|
# if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
qmlRegisterType<FramelessQuickApplicationWindow>(QUICK_URI_EXPAND("FramelessApplicationWindow"));
|
||||||
|
# endif
|
||||||
|
# if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
qmlRegisterType<QuickStandardSystemButton>(QUICK_URI_EXPAND("StandardSystemButton"));
|
||||||
|
# endif
|
||||||
|
# if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
qmlRegisterType<QuickStandardTitleBar>(QUICK_URI_EXPAND("StandardTitleBar"));
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessApplicationWindow"),
|
||||||
|
FRAMELESSHELPER_STRING_LITERAL("FramelessApplicationWindow is not available."));
|
||||||
|
# endif
|
||||||
|
# if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardSystemButton"),
|
||||||
|
FRAMELESSHELPER_STRING_LITERAL("StandardSystemButton is not available."));
|
||||||
|
# endif
|
||||||
|
# if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardTitleBar"),
|
||||||
|
FRAMELESSHELPER_STRING_LITERAL("StandardTitleBar is not available."));
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qmlRegisterModule(QUICK_URI_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -22,12 +22,15 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include "framelessquickapplicationwindow_p.h"
|
#include "framelessquickapplicationwindow_p.h"
|
||||||
#include "framelessquickapplicationwindow_p_p.h"
|
#include "framelessquickapplicationwindow_p_p.h"
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
#include "framelessquickhelper.h"
|
#include "framelessquickhelper.h"
|
||||||
#include "quickwindowborder.h"
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
# include "quickwindowborder.h"
|
||||||
|
#endif
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
# include <FramelessHelper/Core/framelesshelper_windows.h>
|
# include <FramelessHelper/Core/framelesshelper_windows.h>
|
||||||
#endif // Q_OS_WINDOWS
|
#endif // Q_OS_WINDOWS
|
||||||
|
@ -36,18 +39,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickApplicationWindow, "wangwenx190.framelesshelper.quick.framelessquickapplicationwindow")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickApplicationWindow, "wangwenx190.framelesshelper.quick.framelessquickapplicationwindow")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessQuickApplicationWindow)
|
# define INFO qCInfo(lcFramelessQuickApplicationWindow)
|
||||||
# define DEBUG qCDebug(lcFramelessQuickApplicationWindow)
|
# define DEBUG qCDebug(lcFramelessQuickApplicationWindow)
|
||||||
# define WARNING qCWarning(lcFramelessQuickApplicationWindow)
|
# define WARNING qCWarning(lcFramelessQuickApplicationWindow)
|
||||||
# define CRITICAL qCCritical(lcFramelessQuickApplicationWindow)
|
# define CRITICAL qCCritical(lcFramelessQuickApplicationWindow)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -86,12 +88,14 @@ FramelessQuickApplicationWindow::FramelessQuickApplicationWindow(QWindow *parent
|
||||||
{
|
{
|
||||||
QQuickItem * const rootItem = contentItem();
|
QQuickItem * const rootItem = contentItem();
|
||||||
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_D(FramelessQuickApplicationWindow);
|
Q_D(FramelessQuickApplicationWindow);
|
||||||
d->windowBorder = new QuickWindowBorder;
|
d->windowBorder = new QuickWindowBorder;
|
||||||
d->windowBorder->setParent(rootItem);
|
d->windowBorder->setParent(rootItem);
|
||||||
d->windowBorder->setParentItem(rootItem);
|
d->windowBorder->setParentItem(rootItem);
|
||||||
d->windowBorder->setZ(999); // Make sure it always stays on the top.
|
d->windowBorder->setZ(999); // Make sure it always stays on the top.
|
||||||
QQuickItemPrivate::get(d->windowBorder)->anchors()->setFill(rootItem);
|
QQuickItemPrivate::get(d->windowBorder)->anchors()->setFill(rootItem);
|
||||||
|
#endif
|
||||||
connect(this, &FramelessQuickApplicationWindow::visibilityChanged, this, [this](){
|
connect(this, &FramelessQuickApplicationWindow::visibilityChanged, this, [this](){
|
||||||
Q_EMIT hiddenChanged();
|
Q_EMIT hiddenChanged();
|
||||||
Q_EMIT normalChanged();
|
Q_EMIT normalChanged();
|
||||||
|
@ -179,4 +183,4 @@ void FramelessQuickApplicationWindow::componentComplete()
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -24,8 +24,12 @@
|
||||||
|
|
||||||
#include "framelessquickhelper.h"
|
#include "framelessquickhelper.h"
|
||||||
#include "framelessquickhelper_p.h"
|
#include "framelessquickhelper_p.h"
|
||||||
#include "quickmicamaterial.h"
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
#include "quickwindowborder.h"
|
# include "quickmicamaterial.h"
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
# include "quickwindowborder.h"
|
||||||
|
#endif
|
||||||
#include <FramelessHelper/Core/framelessmanager.h>
|
#include <FramelessHelper/Core/framelessmanager.h>
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
|
@ -38,14 +42,14 @@
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
#include <QtGui/qcursor.h>
|
#include <QtGui/qcursor.h>
|
||||||
#include <QtGui/qguiapplication.h>
|
#include <QtGui/qguiapplication.h>
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtGui/qpa/qplatformwindow.h> // For QWINDOWSIZE_MAX
|
# include <QtGui/qpa/qplatformwindow.h> // For QWINDOWSIZE_MAX
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtGui/private/qwindow_p.h> // For QWINDOWSIZE_MAX
|
# include <QtGui/private/qwindow_p.h> // For QWINDOWSIZE_MAX
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtQuick/private/qquickitem_p.h>
|
# include <QtQuick/private/qquickitem_p.h>
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
||||||
#ifndef QWINDOWSIZE_MAX
|
#ifndef QWINDOWSIZE_MAX
|
||||||
# define QWINDOWSIZE_MAX ((1 << 24) - 1)
|
# define QWINDOWSIZE_MAX ((1 << 24) - 1)
|
||||||
|
@ -53,18 +57,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickHelper, "wangwenx190.framelesshelper.quick.framelessquickhelper")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickHelper, "wangwenx190.framelesshelper.quick.framelessquickhelper")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessQuickHelper)
|
# define INFO qCInfo(lcFramelessQuickHelper)
|
||||||
# define DEBUG qCDebug(lcFramelessQuickHelper)
|
# define DEBUG qCDebug(lcFramelessQuickHelper)
|
||||||
# define WARNING qCWarning(lcFramelessQuickHelper)
|
# define WARNING qCWarning(lcFramelessQuickHelper)
|
||||||
# define CRITICAL qCCritical(lcFramelessQuickHelper)
|
# define CRITICAL qCCritical(lcFramelessQuickHelper)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -265,6 +268,7 @@ QVariant FramelessQuickHelperPrivate::getProperty(const char *name, const QVaria
|
||||||
return ((value.isValid() && !value.isNull()) ? value : defaultValue);
|
return ((value.isValid() && !value.isNull()) ? value : defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
QuickMicaMaterial *FramelessQuickHelperPrivate::findOrCreateMicaMaterial() const
|
QuickMicaMaterial *FramelessQuickHelperPrivate::findOrCreateMicaMaterial() const
|
||||||
{
|
{
|
||||||
Q_Q(const FramelessQuickHelper);
|
Q_Q(const FramelessQuickHelper);
|
||||||
|
@ -283,12 +287,14 @@ QuickMicaMaterial *FramelessQuickHelperPrivate::findOrCreateMicaMaterial() const
|
||||||
item->setParent(rootItem);
|
item->setParent(rootItem);
|
||||||
item->setParentItem(rootItem);
|
item->setParentItem(rootItem);
|
||||||
item->setZ(-999); // Make sure it always stays on the bottom.
|
item->setZ(-999); // Make sure it always stays on the bottom.
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
QQuickItemPrivate::get(item)->anchors()->setFill(rootItem);
|
QQuickItemPrivate::get(item)->anchors()->setFill(rootItem);
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
QuickWindowBorder *FramelessQuickHelperPrivate::findOrCreateWindowBorder() const
|
QuickWindowBorder *FramelessQuickHelperPrivate::findOrCreateWindowBorder() const
|
||||||
{
|
{
|
||||||
Q_Q(const FramelessQuickHelper);
|
Q_Q(const FramelessQuickHelper);
|
||||||
|
@ -307,11 +313,12 @@ QuickWindowBorder *FramelessQuickHelperPrivate::findOrCreateWindowBorder() const
|
||||||
item->setParent(rootItem);
|
item->setParent(rootItem);
|
||||||
item->setParentItem(rootItem);
|
item->setParentItem(rootItem);
|
||||||
item->setZ(999); // Make sure it always stays on the top.
|
item->setZ(999); // Make sure it always stays on the top.
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
QQuickItemPrivate::get(item)->anchors()->setFill(rootItem);
|
QQuickItemPrivate::get(item)->anchors()->setFill(rootItem);
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
FramelessQuickHelper *FramelessQuickHelperPrivate::findOrCreateFramelessHelper(QObject *object)
|
FramelessQuickHelper *FramelessQuickHelperPrivate::findOrCreateFramelessHelper(QObject *object)
|
||||||
{
|
{
|
||||||
|
@ -634,17 +641,21 @@ FramelessQuickHelper *FramelessQuickHelper::qmlAttachedProperties(QObject *paren
|
||||||
return get(parentObject);
|
return get(parentObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
QuickMicaMaterial *FramelessQuickHelper::micaMaterial() const
|
QuickMicaMaterial *FramelessQuickHelper::micaMaterial() const
|
||||||
{
|
{
|
||||||
Q_D(const FramelessQuickHelper);
|
Q_D(const FramelessQuickHelper);
|
||||||
return d->findOrCreateMicaMaterial();
|
return d->findOrCreateMicaMaterial();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
QuickWindowBorder *FramelessQuickHelper::windowBorder() const
|
QuickWindowBorder *FramelessQuickHelper::windowBorder() const
|
||||||
{
|
{
|
||||||
Q_D(const FramelessQuickHelper);
|
Q_D(const FramelessQuickHelper);
|
||||||
return d->findOrCreateWindowBorder();
|
return d->findOrCreateWindowBorder();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void FramelessQuickHelper::setHitTestVisible(QQuickItem *item, const bool visible)
|
void FramelessQuickHelper::setHitTestVisible(QQuickItem *item, const bool visible)
|
||||||
{
|
{
|
||||||
|
@ -790,7 +801,7 @@ void FramelessQuickHelper::showSystemMenu(const QPoint &pos)
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
Q_D(FramelessQuickHelper);
|
Q_D(FramelessQuickHelper);
|
||||||
std::ignore = Utils::showSystemMenu(windowId, nativePos, false, &d->getWindowData()->params);
|
std::ignore = Utils::showSystemMenu(windowId, nativePos, false, &d->getWindowData()->params);
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
Utils::openSystemMenu(windowId, nativePos);
|
Utils::openSystemMenu(windowId, nativePos);
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(windowId);
|
Q_UNUSED(windowId);
|
||||||
|
@ -932,7 +943,9 @@ void FramelessQuickHelper::setBlurBehindWindowEnabled(const bool value)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
d->blurBehindWindowEnabled = value;
|
d->blurBehindWindowEnabled = value;
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
micaMaterial()->setVisible(d->blurBehindWindowEnabled);
|
micaMaterial()->setVisible(d->blurBehindWindowEnabled);
|
||||||
|
#endif
|
||||||
d->emitSignalForAllInstances("blurBehindWindowEnabledChanged");
|
d->emitSignalForAllInstances("blurBehindWindowEnabledChanged");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
/*
|
|
||||||
* MIT License
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021-2023 by wangwenx190 (Yuhang Zhao)
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "framelessquickmodule.h"
|
|
||||||
#include "framelessquickhelper.h"
|
|
||||||
#include "framelessquickutils.h"
|
|
||||||
#include "quickchromepalette.h"
|
|
||||||
#include "quickmicamaterial.h"
|
|
||||||
#include "quickimageitem.h"
|
|
||||||
#include "quickwindowborder.h"
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
# include "framelessquickwindow_p.h"
|
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
# include "framelessquickapplicationwindow_p.h"
|
|
||||||
# include "quickstandardsystembutton_p.h"
|
|
||||||
# include "quickstandardtitlebar_p.h"
|
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
#include <QtCore/qloggingcategory.h>
|
|
||||||
|
|
||||||
#ifndef QUICK_URI_SHORT
|
|
||||||
# define QUICK_URI_SHORT FRAMELESSHELPER_QUICK_URI, FRAMELESSHELPER_QUICK_VERSION_MAJOR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef QUICK_URI_FULL
|
|
||||||
# define QUICK_URI_FULL QUICK_URI_SHORT, FRAMELESSHELPER_QUICK_VERSION_MINOR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef QUICK_URI_EXPAND
|
|
||||||
# define QUICK_URI_EXPAND(name) QUICK_URI_FULL, name
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickModule, "wangwenx190.framelesshelper.quick.quickmodule")
|
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickModule)
|
|
||||||
# define DEBUG qCDebug(lcQuickModule)
|
|
||||||
# define WARNING qCWarning(lcQuickModule)
|
|
||||||
# define CRITICAL qCCritical(lcQuickModule)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void FramelessHelper::Quick::registerTypes(QQmlEngine *engine)
|
|
||||||
{
|
|
||||||
Q_ASSERT(engine);
|
|
||||||
if (!engine) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In most cases we don't need to register the QML types for multiple times.
|
|
||||||
static bool reg = false;
|
|
||||||
if (reg) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reg = true;
|
|
||||||
|
|
||||||
// @uri org.wangwenx190.FramelessHelper
|
|
||||||
qmlRegisterUncreatableType<QuickGlobal>(QUICK_URI_FULL, "FramelessHelperConstants",
|
|
||||||
FRAMELESSHELPER_STRING_LITERAL("The FramelessHelperConstants namespace is not creatable, you can only use it to access it's enums."));
|
|
||||||
|
|
||||||
qmlRegisterSingletonType<FramelessQuickUtils>(QUICK_URI_EXPAND("FramelessUtils"),
|
|
||||||
[](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
|
||||||
Q_UNUSED(engine);
|
|
||||||
Q_UNUSED(scriptEngine);
|
|
||||||
return new FramelessQuickUtils;
|
|
||||||
});
|
|
||||||
|
|
||||||
qmlRegisterAnonymousType<QuickChromePalette>(QUICK_URI_SHORT);
|
|
||||||
|
|
||||||
qmlRegisterType<FramelessQuickHelper>(QUICK_URI_EXPAND("FramelessHelper"));
|
|
||||||
qmlRegisterType<QuickMicaMaterial>(QUICK_URI_EXPAND("MicaMaterial"));
|
|
||||||
qmlRegisterType<QuickImageItem>(QUICK_URI_EXPAND("ImageItem"));
|
|
||||||
qmlRegisterType<QuickWindowBorder>(QUICK_URI_EXPAND("WindowBorder"));
|
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessWindow"),
|
|
||||||
FRAMELESSHELPER_STRING_LITERAL("FramelessWindow is not available."));
|
|
||||||
#else // !FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
qmlRegisterType<FramelessQuickWindow>(QUICK_URI_EXPAND("FramelessWindow"));
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#if ((QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) && !defined(FRAMELESSHELPER_QUICK_NO_PRIVATE))
|
|
||||||
qmlRegisterType<FramelessQuickApplicationWindow>(QUICK_URI_EXPAND("FramelessApplicationWindow"));
|
|
||||||
qmlRegisterType<QuickStandardSystemButton>(QUICK_URI_EXPAND("StandardSystemButton"));
|
|
||||||
qmlRegisterType<QuickStandardTitleBar>(QUICK_URI_EXPAND("StandardTitleBar"));
|
|
||||||
#else // ((QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) || FRAMELESSHELPER_QUICK_NO_PRIVATE)
|
|
||||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessApplicationWindow"),
|
|
||||||
FRAMELESSHELPER_STRING_LITERAL("FramelessApplicationWindow is not available."));
|
|
||||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardSystemButton"),
|
|
||||||
FRAMELESSHELPER_STRING_LITERAL("StandardSystemButton is not available."));
|
|
||||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardTitleBar"),
|
|
||||||
FRAMELESSHELPER_STRING_LITERAL("StandardTitleBar is not available."));
|
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
|
||||||
qmlRegisterModule(QUICK_URI_FULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
|
|
@ -32,18 +32,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickUtils, "wangwenx190.framelesshelper.quick.framelessquickutils")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickUtils, "wangwenx190.framelesshelper.quick.framelessquickutils")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessQuickUtils)
|
# define INFO qCInfo(lcFramelessQuickUtils)
|
||||||
# define DEBUG qCDebug(lcFramelessQuickUtils)
|
# define DEBUG qCDebug(lcFramelessQuickUtils)
|
||||||
# define WARNING qCWarning(lcFramelessQuickUtils)
|
# define WARNING qCWarning(lcFramelessQuickUtils)
|
||||||
# define CRITICAL qCCritical(lcFramelessQuickUtils)
|
# define CRITICAL qCCritical(lcFramelessQuickUtils)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
|
|
@ -22,12 +22,15 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include "framelessquickwindow_p.h"
|
#include "framelessquickwindow_p.h"
|
||||||
#include "framelessquickwindow_p_p.h"
|
#include "framelessquickwindow_p_p.h"
|
||||||
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||||
|
|
||||||
#include "framelessquickhelper.h"
|
#include "framelessquickhelper.h"
|
||||||
#include "quickwindowborder.h"
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
# include "quickwindowborder.h"
|
||||||
|
#endif
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
# include <FramelessHelper/Core/framelesshelper_windows.h>
|
# include <FramelessHelper/Core/framelesshelper_windows.h>
|
||||||
#endif // Q_OS_WINDOWS
|
#endif // Q_OS_WINDOWS
|
||||||
|
@ -36,18 +39,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickWindow, "wangwenx190.framelesshelper.quick.framelessquickwindow")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickWindow, "wangwenx190.framelesshelper.quick.framelessquickwindow")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessQuickWindow)
|
# define INFO qCInfo(lcFramelessQuickWindow)
|
||||||
# define DEBUG qCDebug(lcFramelessQuickWindow)
|
# define DEBUG qCDebug(lcFramelessQuickWindow)
|
||||||
# define WARNING qCWarning(lcFramelessQuickWindow)
|
# define WARNING qCWarning(lcFramelessQuickWindow)
|
||||||
# define CRITICAL qCCritical(lcFramelessQuickWindow)
|
# define CRITICAL qCCritical(lcFramelessQuickWindow)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -86,12 +88,14 @@ FramelessQuickWindow::FramelessQuickWindow(QWindow *parent)
|
||||||
{
|
{
|
||||||
QQuickItem * const rootItem = contentItem();
|
QQuickItem * const rootItem = contentItem();
|
||||||
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
Q_D(FramelessQuickWindow);
|
Q_D(FramelessQuickWindow);
|
||||||
d->windowBorder = new QuickWindowBorder;
|
d->windowBorder = new QuickWindowBorder;
|
||||||
d->windowBorder->setParent(rootItem);
|
d->windowBorder->setParent(rootItem);
|
||||||
d->windowBorder->setParentItem(rootItem);
|
d->windowBorder->setParentItem(rootItem);
|
||||||
d->windowBorder->setZ(999); // Make sure it always stays on the top.
|
d->windowBorder->setZ(999); // Make sure it always stays on the top.
|
||||||
QQuickItemPrivate::get(d->windowBorder)->anchors()->setFill(rootItem);
|
QQuickItemPrivate::get(d->windowBorder)->anchors()->setFill(rootItem);
|
||||||
|
#endif
|
||||||
connect(this, &FramelessQuickWindow::visibilityChanged, this, [this](){
|
connect(this, &FramelessQuickWindow::visibilityChanged, this, [this](){
|
||||||
Q_EMIT hiddenChanged();
|
Q_EMIT hiddenChanged();
|
||||||
Q_EMIT normalChanged();
|
Q_EMIT normalChanged();
|
||||||
|
@ -179,4 +183,4 @@ void FramelessQuickWindow::componentComplete()
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -23,22 +23,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "quickchromepalette.h"
|
#include "quickchromepalette.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickChromePalette, "wangwenx190.framelesshelper.quick.quickchromepalette")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickChromePalette, "wangwenx190.framelesshelper.quick.quickchromepalette")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickChromePalette)
|
# define INFO qCInfo(lcQuickChromePalette)
|
||||||
# define DEBUG qCDebug(lcQuickChromePalette)
|
# define DEBUG qCDebug(lcQuickChromePalette)
|
||||||
# define WARNING qCWarning(lcQuickChromePalette)
|
# define WARNING qCWarning(lcQuickChromePalette)
|
||||||
# define CRITICAL qCCritical(lcQuickChromePalette)
|
# define CRITICAL qCCritical(lcQuickChromePalette)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QuickChromePalette::QuickChromePalette(QObject *parent) : ChromePalette(parent)
|
QuickChromePalette::QuickChromePalette(QObject *parent) : ChromePalette(parent)
|
||||||
|
@ -56,3 +58,5 @@ void QuickChromePalette::componentComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "quickimageitem.h"
|
|
||||||
#include "quickimageitem_p.h"
|
#include "quickimageitem_p.h"
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
#include <QtGui/qpainter.h>
|
#include <QtGui/qpainter.h>
|
||||||
|
@ -32,18 +31,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickImageItem, "wangwenx190.framelesshelper.quick.quickimageitem")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickImageItem, "wangwenx190.framelesshelper.quick.quickimageitem")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickImageItem)
|
# define INFO qCInfo(lcQuickImageItem)
|
||||||
# define DEBUG qCDebug(lcQuickImageItem)
|
# define DEBUG qCDebug(lcQuickImageItem)
|
||||||
# define WARNING qCWarning(lcQuickImageItem)
|
# define WARNING qCWarning(lcQuickImageItem)
|
||||||
# define CRITICAL qCCritical(lcQuickImageItem)
|
# define CRITICAL qCCritical(lcQuickImageItem)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -53,112 +51,7 @@ FRAMELESSHELPER_STRING_CONSTANT2(FileSystemPrefix, ":")
|
||||||
FRAMELESSHELPER_STRING_CONSTANT2(UrlPrefix, ":///")
|
FRAMELESSHELPER_STRING_CONSTANT2(UrlPrefix, ":///")
|
||||||
FRAMELESSHELPER_STRING_CONSTANT2(FilePathPrefix, ":/")
|
FRAMELESSHELPER_STRING_CONSTANT2(FilePathPrefix, ":/")
|
||||||
|
|
||||||
QuickImageItemPrivate::QuickImageItemPrivate(QuickImageItem *q) : QObject(q)
|
QuickImageItem::QuickImageItem(QQuickItem *parent) : QQuickPaintedItem(parent)
|
||||||
{
|
|
||||||
Q_ASSERT(q);
|
|
||||||
if (!q) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
q_ptr = q;
|
|
||||||
}
|
|
||||||
|
|
||||||
QuickImageItemPrivate::~QuickImageItemPrivate() = default;
|
|
||||||
|
|
||||||
QuickImageItemPrivate *QuickImageItemPrivate::get(QuickImageItem *q)
|
|
||||||
{
|
|
||||||
Q_ASSERT(q);
|
|
||||||
if (!q) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return q->d_func();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QuickImageItemPrivate *QuickImageItemPrivate::get(const QuickImageItem *q)
|
|
||||||
{
|
|
||||||
Q_ASSERT(q);
|
|
||||||
if (!q) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return q->d_func();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromUrl(const QUrl &value, QPainter *painter) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(value.isValid());
|
|
||||||
Q_ASSERT(painter);
|
|
||||||
if (!value.isValid() || !painter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fromString((value.isLocalFile() ? value.toLocalFile() : value.toString()), painter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(!value.isEmpty());
|
|
||||||
Q_ASSERT(painter);
|
|
||||||
if (value.isEmpty() || !painter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return fromPixmap(QPixmap([&value]() -> QString {
|
|
||||||
// For most Qt classes, the "qrc:///" prefix won't be recognized as a valid
|
|
||||||
// file system path, unless it accepts a QUrl object. For QString constructors
|
|
||||||
// we can only use ":/" to represent the file system path.
|
|
||||||
QString path = value;
|
|
||||||
if (path.startsWith(kQrcPrefix, Qt::CaseInsensitive)) {
|
|
||||||
path.replace(kQrcPrefix, kFileSystemPrefix, Qt::CaseInsensitive);
|
|
||||||
}
|
|
||||||
if (path.startsWith(kUrlPrefix, Qt::CaseInsensitive)) {
|
|
||||||
path.replace(kUrlPrefix, kFilePathPrefix, Qt::CaseInsensitive);
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}()), painter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromImage(const QImage &value, QPainter *painter) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(!value.isNull());
|
|
||||||
Q_ASSERT(painter);
|
|
||||||
if (value.isNull() || !painter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fromPixmap(QPixmap::fromImage(value), painter);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromPixmap(const QPixmap &value, QPainter *painter) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(!value.isNull());
|
|
||||||
Q_ASSERT(painter);
|
|
||||||
if (value.isNull() || !painter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const QRectF paintRect = paintArea();
|
|
||||||
const QSize paintSize = paintRect.size().toSize();
|
|
||||||
painter->drawPixmap(paintRect.topLeft(), (value.size() == paintSize ? value : value.scaled(paintSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromIcon(const QIcon &value, QPainter *painter) const
|
|
||||||
{
|
|
||||||
Q_ASSERT(!value.isNull());
|
|
||||||
Q_ASSERT(painter);
|
|
||||||
if (value.isNull() || !painter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fromPixmap(value.pixmap(paintArea().size().toSize()), painter);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QuickImageItemPrivate::paintArea() const
|
|
||||||
{
|
|
||||||
Q_Q(const QuickImageItem);
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
|
||||||
const QSizeF size = q->size();
|
|
||||||
#else
|
|
||||||
const QSizeF size = {q->width(), q->height()};
|
|
||||||
#endif
|
|
||||||
return {QPointF(0, 0), size};
|
|
||||||
}
|
|
||||||
|
|
||||||
QuickImageItem::QuickImageItem(QQuickItem *parent)
|
|
||||||
: QQuickPaintedItem(parent), d_ptr(new QuickImageItemPrivate(this))
|
|
||||||
{
|
{
|
||||||
setAntialiasing(true);
|
setAntialiasing(true);
|
||||||
setSmooth(true);
|
setSmooth(true);
|
||||||
|
@ -174,31 +67,30 @@ void QuickImageItem::paint(QPainter *painter)
|
||||||
if (!painter) {
|
if (!painter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Q_D(QuickImageItem);
|
if (!m_source.isValid() || m_source.isNull()) {
|
||||||
if (!d->source.isValid() || d->source.isNull()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHints(QPainter::Antialiasing |
|
painter->setRenderHints(QPainter::Antialiasing |
|
||||||
QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
|
QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
|
||||||
switch (d->source.userType()) {
|
switch (m_source.userType()) {
|
||||||
case QMetaType::QUrl:
|
case QMetaType::QUrl:
|
||||||
d->fromUrl(d->source.toUrl(), painter);
|
fromUrl(m_source.toUrl(), painter);
|
||||||
break;
|
break;
|
||||||
case QMetaType::QString:
|
case QMetaType::QString:
|
||||||
d->fromString(d->source.toString(), painter);
|
fromString(m_source.toString(), painter);
|
||||||
break;
|
break;
|
||||||
case QMetaType::QImage:
|
case QMetaType::QImage:
|
||||||
d->fromImage(qvariant_cast<QImage>(d->source), painter);
|
fromImage(qvariant_cast<QImage>(m_source), painter);
|
||||||
break;
|
break;
|
||||||
case QMetaType::QPixmap:
|
case QMetaType::QPixmap:
|
||||||
d->fromPixmap(qvariant_cast<QPixmap>(d->source), painter);
|
fromPixmap(qvariant_cast<QPixmap>(m_source), painter);
|
||||||
break;
|
break;
|
||||||
case QMetaType::QIcon:
|
case QMetaType::QIcon:
|
||||||
d->fromIcon(qvariant_cast<QIcon>(d->source), painter);
|
fromIcon(qvariant_cast<QIcon>(m_source), painter);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARNING << "Unsupported type:" << d->source.typeName();
|
WARNING << "Unsupported type:" << m_source.typeName();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@ -206,8 +98,7 @@ void QuickImageItem::paint(QPainter *painter)
|
||||||
|
|
||||||
QVariant QuickImageItem::source() const
|
QVariant QuickImageItem::source() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickImageItem);
|
return m_source;
|
||||||
return d->source;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItem::setSource(const QVariant &value)
|
void QuickImageItem::setSource(const QVariant &value)
|
||||||
|
@ -217,15 +108,88 @@ void QuickImageItem::setSource(const QVariant &value)
|
||||||
if (!value.isValid() || value.isNull()) {
|
if (!value.isValid() || value.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Q_D(QuickImageItem);
|
if (m_source == value) {
|
||||||
if (d->source == value) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
d->source = value;
|
m_source = value;
|
||||||
update();
|
update();
|
||||||
Q_EMIT sourceChanged();
|
Q_EMIT sourceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuickImageItem::fromUrl(const QUrl &value, QPainter *painter) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(value.isValid());
|
||||||
|
Q_ASSERT(painter);
|
||||||
|
if (!value.isValid() || !painter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fromString((value.isLocalFile() ? value.toLocalFile() : value.toString()), painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickImageItem::fromString(const QString &value, QPainter *painter) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(!value.isEmpty());
|
||||||
|
Q_ASSERT(painter);
|
||||||
|
if (value.isEmpty() || !painter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return fromPixmap(QPixmap([&value]() -> QString {
|
||||||
|
// For most Qt classes, the "qrc:///" prefix won't be recognized as a valid
|
||||||
|
// file system path, unless it accepts a QUrl object. For QString constructors
|
||||||
|
// we can only use ":/" to represent the file system path.
|
||||||
|
QString path = value;
|
||||||
|
if (path.startsWith(kQrcPrefix, Qt::CaseInsensitive)) {
|
||||||
|
path.replace(kQrcPrefix, kFileSystemPrefix, Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
if (path.startsWith(kUrlPrefix, Qt::CaseInsensitive)) {
|
||||||
|
path.replace(kUrlPrefix, kFilePathPrefix, Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}()), painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickImageItem::fromImage(const QImage &value, QPainter *painter) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(!value.isNull());
|
||||||
|
Q_ASSERT(painter);
|
||||||
|
if (value.isNull() || !painter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fromPixmap(QPixmap::fromImage(value), painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickImageItem::fromPixmap(const QPixmap &value, QPainter *painter) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(!value.isNull());
|
||||||
|
Q_ASSERT(painter);
|
||||||
|
if (value.isNull() || !painter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const QRectF paintRect = paintArea();
|
||||||
|
const QSize paintSize = paintRect.size().toSize();
|
||||||
|
painter->drawPixmap(paintRect.topLeft(), (value.size() == paintSize ? value : value.scaled(paintSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickImageItem::fromIcon(const QIcon &value, QPainter *painter) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(!value.isNull());
|
||||||
|
Q_ASSERT(painter);
|
||||||
|
if (value.isNull() || !painter) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fromPixmap(value.pixmap(paintArea().size().toSize()), painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF QuickImageItem::paintArea() const
|
||||||
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
|
const QSizeF s = size();
|
||||||
|
#else
|
||||||
|
const QSizeF s = {width(), height()};
|
||||||
|
#endif
|
||||||
|
return {QPointF(0, 0), s};
|
||||||
|
}
|
||||||
|
|
||||||
void QuickImageItem::classBegin()
|
void QuickImageItem::classBegin()
|
||||||
{
|
{
|
||||||
QQuickPaintedItem::classBegin();
|
QQuickPaintedItem::classBegin();
|
||||||
|
|
|
@ -24,28 +24,30 @@
|
||||||
|
|
||||||
#include "quickmicamaterial.h"
|
#include "quickmicamaterial.h"
|
||||||
#include "quickmicamaterial_p.h"
|
#include "quickmicamaterial_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
|
||||||
#include <FramelessHelper/Core/micamaterial.h>
|
#include <FramelessHelper/Core/micamaterial.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
#include <QtQuick/qquickwindow.h>
|
#include <QtQuick/qquickwindow.h>
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# include <QtQuick/private/qquickitem_p.h>
|
# include <QtQuick/private/qquickitem_p.h>
|
||||||
# include <QtQuick/private/qquickanchors_p.h>
|
# include <QtQuick/private/qquickanchors_p.h>
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickMicaMaterial, "wangwenx190.framelesshelper.quick.quickmicamaterial")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickMicaMaterial, "wangwenx190.framelesshelper.quick.quickmicamaterial")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickMicaMaterial)
|
# define INFO qCInfo(lcQuickMicaMaterial)
|
||||||
# define DEBUG qCDebug(lcQuickMicaMaterial)
|
# define DEBUG qCDebug(lcQuickMicaMaterial)
|
||||||
# define WARNING qCWarning(lcQuickMicaMaterial)
|
# define WARNING qCWarning(lcQuickMicaMaterial)
|
||||||
# define CRITICAL qCCritical(lcQuickMicaMaterial)
|
# define CRITICAL qCCritical(lcQuickMicaMaterial)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -121,7 +123,7 @@ void QuickMicaMaterialPrivate::rebindWindow()
|
||||||
QQuickItem * const rootItem = window->contentItem();
|
QQuickItem * const rootItem = window->contentItem();
|
||||||
q->setParent(rootItem);
|
q->setParent(rootItem);
|
||||||
q->setParentItem(rootItem);
|
q->setParentItem(rootItem);
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
QQuickItemPrivate::get(q)->anchors()->setFill(rootItem);
|
QQuickItemPrivate::get(q)->anchors()->setFill(rootItem);
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||||
q->setZ(-999); // Make sure we always stays on the bottom most place.
|
q->setZ(-999); // Make sure we always stays on the bottom most place.
|
||||||
|
@ -255,3 +257,5 @@ void QuickMicaMaterial::componentComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include "quickstandardsystembutton_p.h"
|
#include "quickstandardsystembutton_p.h"
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(system_button) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
#include <FramelessHelper/Core/private/framelessmanager_p.h>
|
#include <FramelessHelper/Core/private/framelessmanager_p.h>
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
@ -38,18 +38,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardSystemButton, "wangwenx190.framelesshelper.quick.quickstandardsystembutton")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardSystemButton, "wangwenx190.framelesshelper.quick.quickstandardsystembutton")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickStandardSystemButton)
|
# define INFO qCInfo(lcQuickStandardSystemButton)
|
||||||
# define DEBUG qCDebug(lcQuickStandardSystemButton)
|
# define DEBUG qCDebug(lcQuickStandardSystemButton)
|
||||||
# define WARNING qCWarning(lcQuickStandardSystemButton)
|
# define WARNING qCWarning(lcQuickStandardSystemButton)
|
||||||
# define CRITICAL qCCritical(lcQuickStandardSystemButton)
|
# define CRITICAL qCCritical(lcQuickStandardSystemButton)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -101,7 +100,7 @@ QColor QuickStandardSystemButton::inactiveForegroundColor() const
|
||||||
return m_inactiveForegroundColor;
|
return m_inactiveForegroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QuickStandardSystemButton::iconSize() const
|
qreal QuickStandardSystemButton::glyphSize() const
|
||||||
{
|
{
|
||||||
if (!m_contentItem) {
|
if (!m_contentItem) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -217,19 +216,19 @@ void QuickStandardSystemButton::setInactiveForegroundColor(const QColor &value)
|
||||||
Q_EMIT inactiveForegroundColorChanged();
|
Q_EMIT inactiveForegroundColorChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickStandardSystemButton::setIconSize(const qreal value)
|
void QuickStandardSystemButton::setGlyphSize(const qreal value)
|
||||||
{
|
{
|
||||||
Q_ASSERT(value > 0);
|
Q_ASSERT(value > 0);
|
||||||
if (qFuzzyIsNull(value) || (value < 0)) {
|
if (qFuzzyIsNull(value) || (value < 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (qFuzzyCompare(iconSize(), value)) {
|
if (qFuzzyCompare(glyphSize(), value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QFont font = m_contentItem->font();
|
QFont font = m_contentItem->font();
|
||||||
font.setPointSizeF(value);
|
font.setPointSizeF(value);
|
||||||
m_contentItem->setFont(font);
|
m_contentItem->setFont(font);
|
||||||
Q_EMIT iconSizeChanged();
|
Q_EMIT glyphSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickStandardSystemButton::updateColor()
|
void QuickStandardSystemButton::updateColor()
|
||||||
|
@ -302,6 +301,5 @@ void QuickStandardSystemButton::componentComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -22,14 +22,19 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
|
||||||
|
|
||||||
#include "quickstandardtitlebar_p.h"
|
#include "quickstandardtitlebar_p.h"
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
#include "quickimageitem.h"
|
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(titlebar) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||||
|
|
||||||
|
#include "quickimageitem_p.h"
|
||||||
#include "framelessquickhelper.h"
|
#include "framelessquickhelper.h"
|
||||||
#include "quickstandardsystembutton_p.h"
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
#include "framelessquickwindow_p.h"
|
# include "quickstandardsystembutton_p.h"
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
# include "framelessquickwindow_p.h"
|
||||||
|
# include "framelessquickapplicationwindow_p.h"
|
||||||
|
#endif
|
||||||
#include <QtCore/qtimer.h>
|
#include <QtCore/qtimer.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
#include <QtGui/qevent.h>
|
#include <QtGui/qevent.h>
|
||||||
|
@ -41,18 +46,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardTitleBar, "wangwenx190.framelesshelper.quick.quickstandardtitlebar")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardTitleBar, "wangwenx190.framelesshelper.quick.quickstandardtitlebar")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickStandardTitleBar)
|
# define INFO qCInfo(lcQuickStandardTitleBar)
|
||||||
# define DEBUG qCDebug(lcQuickStandardTitleBar)
|
# define DEBUG qCDebug(lcQuickStandardTitleBar)
|
||||||
# define WARNING qCWarning(lcQuickStandardTitleBar)
|
# define WARNING qCWarning(lcQuickStandardTitleBar)
|
||||||
# define CRITICAL qCCritical(lcQuickStandardTitleBar)
|
# define CRITICAL qCCritical(lcQuickStandardTitleBar)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -120,7 +124,7 @@ QQuickLabel *QuickStandardTitleBar::titleLabel() const
|
||||||
return m_windowTitleLabel;
|
return m_windowTitleLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
QuickStandardSystemButton *QuickStandardTitleBar::minimizeButton() const
|
QuickStandardSystemButton *QuickStandardTitleBar::minimizeButton() const
|
||||||
{
|
{
|
||||||
return m_minimizeButton;
|
return m_minimizeButton;
|
||||||
|
@ -135,7 +139,7 @@ QuickStandardSystemButton *QuickStandardTitleBar::closeButton() const
|
||||||
{
|
{
|
||||||
return m_closeButton;
|
return m_closeButton;
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
|
|
||||||
bool QuickStandardTitleBar::isExtended() const
|
bool QuickStandardTitleBar::isExtended() const
|
||||||
{
|
{
|
||||||
|
@ -240,7 +244,7 @@ void QuickStandardTitleBar::setWindowIcon(const QVariant &value)
|
||||||
|
|
||||||
void QuickStandardTitleBar::updateMaximizeButton()
|
void QuickStandardTitleBar::updateMaximizeButton()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
const QQuickWindow * const w = window();
|
const QQuickWindow * const w = window();
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
|
@ -248,7 +252,7 @@ void QuickStandardTitleBar::updateMaximizeButton()
|
||||||
const bool max = (w->visibility() == QQuickWindow::Maximized);
|
const bool max = (w->visibility() == QQuickWindow::Maximized);
|
||||||
m_maximizeButton->setButtonType(max ? QuickGlobal::SystemButtonType::Restore : QuickGlobal::SystemButtonType::Maximize);
|
m_maximizeButton->setButtonType(max ? QuickGlobal::SystemButtonType::Restore : QuickGlobal::SystemButtonType::Maximize);
|
||||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_maximizeButton))->setText(max ? tr("Restore") : tr("Maximize"));
|
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_maximizeButton))->setText(max ? tr("Restore") : tr("Maximize"));
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickStandardTitleBar::updateTitleLabelText()
|
void QuickStandardTitleBar::updateTitleLabelText()
|
||||||
|
@ -279,7 +283,7 @@ void QuickStandardTitleBar::updateTitleBarColor()
|
||||||
|
|
||||||
void QuickStandardTitleBar::updateChromeButtonColor()
|
void QuickStandardTitleBar::updateChromeButtonColor()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
const QQuickWindow * const w = window();
|
const QQuickWindow * const w = window();
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
|
@ -307,7 +311,7 @@ void QuickStandardTitleBar::updateChromeButtonColor()
|
||||||
m_closeButton->setHoverColor(m_chromePalette->closeButtonHoverColor());
|
m_closeButton->setHoverColor(m_chromePalette->closeButtonHoverColor());
|
||||||
m_closeButton->setPressColor(m_chromePalette->closeButtonPressColor());
|
m_closeButton->setPressColor(m_chromePalette->closeButtonPressColor());
|
||||||
m_closeButton->updateColor();
|
m_closeButton->updateColor();
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickStandardTitleBar::clickMinimizeButton()
|
void QuickStandardTitleBar::clickMinimizeButton()
|
||||||
|
@ -316,9 +320,14 @@ void QuickStandardTitleBar::clickMinimizeButton()
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
if (const auto _w = qobject_cast<FramelessQuickWindow *>(w)) {
|
if (const auto _w = qobject_cast<FramelessQuickWindow *>(w)) {
|
||||||
_w->showMinimized2();
|
_w->showMinimized2();
|
||||||
} else {
|
} else if (const auto _w2 = qobject_cast<FramelessQuickApplicationWindow *>(w)) {
|
||||||
|
_w2->showMinimized2();
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
w->setVisibility(QQuickWindow::Minimized);
|
w->setVisibility(QQuickWindow::Minimized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +360,7 @@ void QuickStandardTitleBar::clickCloseButton()
|
||||||
|
|
||||||
void QuickStandardTitleBar::retranslateUi()
|
void QuickStandardTitleBar::retranslateUi()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_minimizeButton))->setText(tr("Minimize"));
|
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_minimizeButton))->setText(tr("Minimize"));
|
||||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_maximizeButton))->setText([this]() -> QString {
|
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_maximizeButton))->setText([this]() -> QString {
|
||||||
if (const QQuickWindow * const w = window()) {
|
if (const QQuickWindow * const w = window()) {
|
||||||
|
@ -362,7 +371,7 @@ void QuickStandardTitleBar::retranslateUi()
|
||||||
return tr("Maximize");
|
return tr("Maximize");
|
||||||
}());
|
}());
|
||||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_closeButton))->setText(tr("Close"));
|
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_closeButton))->setText(tr("Close"));
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickStandardTitleBar::updateWindowIcon()
|
void QuickStandardTitleBar::updateWindowIcon()
|
||||||
|
@ -516,7 +525,7 @@ void QuickStandardTitleBar::initialize()
|
||||||
connect(m_windowIcon, &QuickImageItem::widthChanged, this, &QuickStandardTitleBar::windowIconSizeChanged);
|
connect(m_windowIcon, &QuickImageItem::widthChanged, this, &QuickStandardTitleBar::windowIconSizeChanged);
|
||||||
connect(m_windowIcon, &QuickImageItem::heightChanged, this, &QuickStandardTitleBar::windowIconSizeChanged);
|
connect(m_windowIcon, &QuickImageItem::heightChanged, this, &QuickStandardTitleBar::windowIconSizeChanged);
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
m_systemButtonsRow = new QQuickRow(this);
|
m_systemButtonsRow = new QQuickRow(this);
|
||||||
QQuickAnchors * const rowAnchors = QQuickItemPrivate::get(m_systemButtonsRow)->anchors();
|
QQuickAnchors * const rowAnchors = QQuickItemPrivate::get(m_systemButtonsRow)->anchors();
|
||||||
rowAnchors->setTop(thisPriv->top());
|
rowAnchors->setTop(thisPriv->top());
|
||||||
|
@ -527,7 +536,7 @@ void QuickStandardTitleBar::initialize()
|
||||||
connect(m_maximizeButton, &QuickStandardSystemButton::clicked, this, &QuickStandardTitleBar::clickMaximizeButton);
|
connect(m_maximizeButton, &QuickStandardSystemButton::clicked, this, &QuickStandardTitleBar::clickMaximizeButton);
|
||||||
m_closeButton = new QuickStandardSystemButton(QuickGlobal::SystemButtonType::Close, m_systemButtonsRow);
|
m_closeButton = new QuickStandardSystemButton(QuickGlobal::SystemButtonType::Close, m_systemButtonsRow);
|
||||||
connect(m_closeButton, &QuickStandardSystemButton::clicked, this, &QuickStandardTitleBar::clickCloseButton);
|
connect(m_closeButton, &QuickStandardSystemButton::clicked, this, &QuickStandardTitleBar::clickCloseButton);
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
|
|
||||||
setWindowIconSize(kDefaultWindowIconSize);
|
setWindowIconSize(kDefaultWindowIconSize);
|
||||||
setWindowIconVisible(false);
|
setWindowIconVisible(false);
|
||||||
|
@ -619,6 +628,5 @@ void QuickStandardTitleBar::componentComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
|
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
|
@ -24,27 +24,29 @@
|
||||||
|
|
||||||
#include "quickwindowborder.h"
|
#include "quickwindowborder.h"
|
||||||
#include "quickwindowborder_p.h"
|
#include "quickwindowborder_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
|
||||||
#include <FramelessHelper/Core/windowborderpainter.h>
|
#include <FramelessHelper/Core/windowborderpainter.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
#include <QtQuick/qquickwindow.h>
|
#include <QtQuick/qquickwindow.h>
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
# include <QtQuick/private/qquickitem_p.h>
|
# include <QtQuick/private/qquickitem_p.h>
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickWindowBorder, "wangwenx190.framelesshelper.quick.quickwindowborder")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickWindowBorder, "wangwenx190.framelesshelper.quick.quickwindowborder")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcQuickWindowBorder)
|
# define INFO qCInfo(lcQuickWindowBorder)
|
||||||
# define DEBUG qCDebug(lcQuickWindowBorder)
|
# define DEBUG qCDebug(lcQuickWindowBorder)
|
||||||
# define WARNING qCWarning(lcQuickWindowBorder)
|
# define WARNING qCWarning(lcQuickWindowBorder)
|
||||||
# define CRITICAL qCCritical(lcQuickWindowBorder)
|
# define CRITICAL qCCritical(lcQuickWindowBorder)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -159,9 +161,9 @@ void QuickWindowBorderPrivate::rebindWindow()
|
||||||
QQuickItem * const rootItem = window->contentItem();
|
QQuickItem * const rootItem = window->contentItem();
|
||||||
q->setParent(rootItem);
|
q->setParent(rootItem);
|
||||||
q->setParentItem(rootItem);
|
q->setParentItem(rootItem);
|
||||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||||
QQuickItemPrivate::get(q)->anchors()->setFill(rootItem);
|
QQuickItemPrivate::get(q)->anchors()->setFill(rootItem);
|
||||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
#endif
|
||||||
q->setZ(999); // Make sure we always stays on the top most place.
|
q->setZ(999); // Make sure we always stays on the top most place.
|
||||||
if (activeChangeConnection) {
|
if (activeChangeConnection) {
|
||||||
disconnect(activeChangeConnection);
|
disconnect(activeChangeConnection);
|
||||||
|
@ -202,59 +204,54 @@ void QuickWindowBorder::paint(QPainter *painter)
|
||||||
qreal QuickWindowBorder::thickness() const
|
qreal QuickWindowBorder::thickness() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? 0 : d->borderPainter->thickness());
|
return d->borderPainter->thickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickGlobal::WindowEdges QuickWindowBorder::edges() const
|
QuickGlobal::WindowEdges QuickWindowBorder::edges() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? QuickGlobal::WindowEdges()
|
return edgesToQuickEdges(d->borderPainter->edges());
|
||||||
: edgesToQuickEdges(d->borderPainter->edges()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QuickWindowBorder::activeColor() const
|
QColor QuickWindowBorder::activeColor() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->activeColor());
|
return d->borderPainter->activeColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QuickWindowBorder::inactiveColor() const
|
QColor QuickWindowBorder::inactiveColor() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->inactiveColor());
|
return d->borderPainter->inactiveColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QuickWindowBorder::nativeThickness() const
|
qreal QuickWindowBorder::nativeThickness() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? 0 : d->borderPainter->nativeThickness());
|
return d->borderPainter->nativeThickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickGlobal::WindowEdges QuickWindowBorder::nativeEdges() const
|
QuickGlobal::WindowEdges QuickWindowBorder::nativeEdges() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? QuickGlobal::WindowEdges()
|
return edgesToQuickEdges(d->borderPainter->nativeEdges());
|
||||||
: edgesToQuickEdges(d->borderPainter->nativeEdges()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QuickWindowBorder::nativeActiveColor() const
|
QColor QuickWindowBorder::nativeActiveColor() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->nativeActiveColor());
|
return d->borderPainter->nativeActiveColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QuickWindowBorder::nativeInactiveColor() const
|
QColor QuickWindowBorder::nativeInactiveColor() const
|
||||||
{
|
{
|
||||||
Q_D(const QuickWindowBorder);
|
Q_D(const QuickWindowBorder);
|
||||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->nativeInactiveColor());
|
return d->borderPainter->nativeInactiveColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickWindowBorder::setThickness(const qreal value)
|
void QuickWindowBorder::setThickness(const qreal value)
|
||||||
{
|
{
|
||||||
Q_D(QuickWindowBorder);
|
Q_D(QuickWindowBorder);
|
||||||
if (!d->borderPainter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (qFuzzyCompare(thickness(), value)) {
|
if (qFuzzyCompare(thickness(), value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -264,9 +261,6 @@ void QuickWindowBorder::setThickness(const qreal value)
|
||||||
void QuickWindowBorder::setEdges(const QuickGlobal::WindowEdges value)
|
void QuickWindowBorder::setEdges(const QuickGlobal::WindowEdges value)
|
||||||
{
|
{
|
||||||
Q_D(QuickWindowBorder);
|
Q_D(QuickWindowBorder);
|
||||||
if (!d->borderPainter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (edges() == value) {
|
if (edges() == value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -276,9 +270,6 @@ void QuickWindowBorder::setEdges(const QuickGlobal::WindowEdges value)
|
||||||
void QuickWindowBorder::setActiveColor(const QColor &value)
|
void QuickWindowBorder::setActiveColor(const QColor &value)
|
||||||
{
|
{
|
||||||
Q_D(QuickWindowBorder);
|
Q_D(QuickWindowBorder);
|
||||||
if (!d->borderPainter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (activeColor() == value) {
|
if (activeColor() == value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -288,9 +279,6 @@ void QuickWindowBorder::setActiveColor(const QColor &value)
|
||||||
void QuickWindowBorder::setInactiveColor(const QColor &value)
|
void QuickWindowBorder::setInactiveColor(const QColor &value)
|
||||||
{
|
{
|
||||||
Q_D(QuickWindowBorder);
|
Q_D(QuickWindowBorder);
|
||||||
if (!d->borderPainter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (inactiveColor() == value) {
|
if (inactiveColor() == value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -317,3 +305,5 @@ void QuickWindowBorder::componentComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -35,45 +35,62 @@ set(INCLUDE_PREFIX ../../include/${SUB_MODULE_PATH})
|
||||||
|
|
||||||
set(PUBLIC_HEADERS
|
set(PUBLIC_HEADERS
|
||||||
${INCLUDE_PREFIX}/framelesshelperwidgets_global.h
|
${INCLUDE_PREFIX}/framelesshelperwidgets_global.h
|
||||||
${INCLUDE_PREFIX}/framelesswidget.h
|
|
||||||
${INCLUDE_PREFIX}/framelessmainwindow.h
|
|
||||||
${INCLUDE_PREFIX}/standardsystembutton.h
|
|
||||||
${INCLUDE_PREFIX}/framelesswidgetshelper.h
|
${INCLUDE_PREFIX}/framelesswidgetshelper.h
|
||||||
${INCLUDE_PREFIX}/standardtitlebar.h
|
|
||||||
${INCLUDE_PREFIX}/framelessdialog.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PUBLIC_HEADERS_ALIAS
|
set(PUBLIC_HEADERS_ALIAS
|
||||||
${INCLUDE_PREFIX}/Global
|
${INCLUDE_PREFIX}/Global
|
||||||
${INCLUDE_PREFIX}/FramelessWidget
|
|
||||||
${INCLUDE_PREFIX}/FramelessMainWindow
|
|
||||||
${INCLUDE_PREFIX}/StandardSystemButton
|
|
||||||
${INCLUDE_PREFIX}/FramelessWidgetsHelper
|
${INCLUDE_PREFIX}/FramelessWidgetsHelper
|
||||||
${INCLUDE_PREFIX}/StandardTitleBar
|
|
||||||
${INCLUDE_PREFIX}/FramelessDialog
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PRIVATE_HEADERS
|
set(PRIVATE_HEADERS
|
||||||
${INCLUDE_PREFIX}/private/framelesswidgetshelper_p.h
|
${INCLUDE_PREFIX}/private/framelesswidgetshelper_p.h
|
||||||
${INCLUDE_PREFIX}/private/standardsystembutton_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/standardtitlebar_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelesswidget_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/framelessmainwindow_p.h
|
|
||||||
${INCLUDE_PREFIX}/private/widgetssharedhelper_p.h
|
${INCLUDE_PREFIX}/private/widgetssharedhelper_p.h
|
||||||
${INCLUDE_PREFIX}/private/framelessdialog_p.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
framelessmainwindow.cpp
|
|
||||||
framelesswidgetshelper.cpp
|
framelesswidgetshelper.cpp
|
||||||
framelesswidget.cpp
|
|
||||||
standardsystembutton.cpp
|
|
||||||
standardtitlebar.cpp
|
|
||||||
widgetssharedhelper.cpp
|
widgetssharedhelper.cpp
|
||||||
framelesshelperwidgets_global.cpp
|
framelesshelperwidgets_global.cpp
|
||||||
framelessdialog.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_SYSTEM_BUTTON)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/standardsystembutton.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/StandardSystemButton)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/standardsystembutton_p.h)
|
||||||
|
list(APPEND SOURCES standardsystembutton.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||||
|
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/standardtitlebar.h)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/StandardTitleBar)
|
||||||
|
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/standardtitlebar_p.h)
|
||||||
|
list(APPEND SOURCES standardtitlebar.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FRAMELESSHELPER_NO_WINDOW)
|
||||||
|
list(APPEND PUBLIC_HEADERS
|
||||||
|
${INCLUDE_PREFIX}/framelessdialog.h
|
||||||
|
${INCLUDE_PREFIX}/framelesswidget.h
|
||||||
|
${INCLUDE_PREFIX}/framelessmainwindow.h
|
||||||
|
)
|
||||||
|
list(APPEND PUBLIC_HEADERS_ALIAS
|
||||||
|
${INCLUDE_PREFIX}/FramelessDialog
|
||||||
|
${INCLUDE_PREFIX}/FramelessWidget
|
||||||
|
${INCLUDE_PREFIX}/FramelessMainWindow
|
||||||
|
)
|
||||||
|
list(APPEND PRIVATE_HEADERS
|
||||||
|
${INCLUDE_PREFIX}/private/framelessdialog_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/framelesswidget_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/framelessmainwindow_p.h
|
||||||
|
)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
framelessdialog.cpp
|
||||||
|
framelesswidget.cpp
|
||||||
|
framelessmainwindow.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||||
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
||||||
if(NOT EXISTS "${__rc_path}")
|
if(NOT EXISTS "${__rc_path}")
|
||||||
|
@ -106,33 +123,9 @@ add_library(${PROJECT_NAME}::${SUB_MODULE_FULL_NAME} ALIAS ${SUB_MODULE_TARGET})
|
||||||
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
||||||
VERSION "${PROJECT_VERSION}"
|
VERSION "${PROJECT_VERSION}"
|
||||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||||
|
OUTPUT_NAME "${SUB_MODULE_TARGET}${FRAMELESSHELPER_64BIT_POSTFIX}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_WIDGETS_STATIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
|
||||||
FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_WIDGETS_NO_BUNDLE_RESOURCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_WIDGETS_NO_PRIVATE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
|
||||||
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
|
||||||
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_NAMESPACE=${FRAMELESSHELPER_NAMESPACE})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||||
FRAMELESSHELPER_WIDGETS_LIBRARY
|
FRAMELESSHELPER_WIDGETS_LIBRARY
|
||||||
)
|
)
|
||||||
|
@ -141,7 +134,7 @@ target_link_libraries(${SUB_MODULE_TARGET} PRIVATE
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets
|
Qt${QT_VERSION_MAJOR}::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${SUB_MODULE_TARGET} PUBLIC
|
target_link_libraries(${SUB_MODULE_TARGET} PRIVATE
|
||||||
${PROJECT_NAME}::Core
|
${PROJECT_NAME}::Core
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -24,24 +24,26 @@
|
||||||
|
|
||||||
#include "framelessdialog.h"
|
#include "framelessdialog.h"
|
||||||
#include "framelessdialog_p.h"
|
#include "framelessdialog_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
#include "framelesswidgetshelper.h"
|
#include "framelesswidgetshelper.h"
|
||||||
#include "widgetssharedhelper_p.h"
|
#include "widgetssharedhelper_p.h"
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessDialog, "wangwenx190.framelesshelper.widgets.framelessdialog")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessDialog, "wangwenx190.framelesshelper.widgets.framelessdialog")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessDialog)
|
# define INFO qCInfo(lcFramelessDialog)
|
||||||
# define DEBUG qCDebug(lcFramelessDialog)
|
# define DEBUG qCDebug(lcFramelessDialog)
|
||||||
# define WARNING qCWarning(lcFramelessDialog)
|
# define WARNING qCWarning(lcFramelessDialog)
|
||||||
# define CRITICAL qCCritical(lcFramelessDialog)
|
# define CRITICAL qCCritical(lcFramelessDialog)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -87,3 +89,5 @@ FramelessDialog::FramelessDialog(QWidget *parent)
|
||||||
FramelessDialog::~FramelessDialog() = default;
|
FramelessDialog::~FramelessDialog() = default;
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,24 +27,20 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWidgetsGlobal, "wangwenx190.framelesshelper.widgets.global")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWidgetsGlobal, "wangwenx190.framelesshelper.widgets.global")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcWidgetsGlobal)
|
# define INFO qCInfo(lcWidgetsGlobal)
|
||||||
# define DEBUG qCDebug(lcWidgetsGlobal)
|
# define DEBUG qCDebug(lcWidgetsGlobal)
|
||||||
# define WARNING qCWarning(lcWidgetsGlobal)
|
# define WARNING qCWarning(lcWidgetsGlobal)
|
||||||
# define CRITICAL qCCritical(lcWidgetsGlobal)
|
# define CRITICAL qCCritical(lcWidgetsGlobal)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace FramelessHelper::Widgets
|
void FramelessHelperWidgetsInitialize()
|
||||||
{
|
|
||||||
|
|
||||||
void initialize()
|
|
||||||
{
|
{
|
||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (inited) {
|
if (inited) {
|
||||||
|
@ -52,10 +48,10 @@ void initialize()
|
||||||
}
|
}
|
||||||
inited = true;
|
inited = true;
|
||||||
|
|
||||||
FramelessHelper::Core::initialize();
|
FramelessHelperCoreInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitialize()
|
void FramelessHelperWidgetsUninitialize()
|
||||||
{
|
{
|
||||||
static bool uninited = false;
|
static bool uninited = false;
|
||||||
if (uninited) {
|
if (uninited) {
|
||||||
|
@ -65,9 +61,7 @@ void uninitialize()
|
||||||
|
|
||||||
// ### TODO: The Widgets module-specific uninitialization.
|
// ### TODO: The Widgets module-specific uninitialization.
|
||||||
|
|
||||||
FramelessHelper::Core::uninitialize();
|
FramelessHelperCoreUninitialize();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "framelessmainwindow.h"
|
#include "framelessmainwindow.h"
|
||||||
#include "framelessmainwindow_p.h"
|
#include "framelessmainwindow_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
#include "framelesswidgetshelper.h"
|
#include "framelesswidgetshelper.h"
|
||||||
#include "widgetssharedhelper_p.h"
|
#include "widgetssharedhelper_p.h"
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
|
@ -31,18 +34,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessMainWindow, "wangwenx190.framelesshelper.widgets.framelessmainwindow")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessMainWindow, "wangwenx190.framelesshelper.widgets.framelessmainwindow")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessMainWindow)
|
# define INFO qCInfo(lcFramelessMainWindow)
|
||||||
# define DEBUG qCDebug(lcFramelessMainWindow)
|
# define DEBUG qCDebug(lcFramelessMainWindow)
|
||||||
# define WARNING qCWarning(lcFramelessMainWindow)
|
# define WARNING qCWarning(lcFramelessMainWindow)
|
||||||
# define CRITICAL qCCritical(lcFramelessMainWindow)
|
# define CRITICAL qCCritical(lcFramelessMainWindow)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -118,3 +120,5 @@ void FramelessMainWindow::toggleFullScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "framelesswidget.h"
|
#include "framelesswidget.h"
|
||||||
#include "framelesswidget_p.h"
|
#include "framelesswidget_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
|
|
||||||
#include "framelesswidgetshelper.h"
|
#include "framelesswidgetshelper.h"
|
||||||
#include "widgetssharedhelper_p.h"
|
#include "widgetssharedhelper_p.h"
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
|
@ -31,18 +34,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidget, "wangwenx190.framelesshelper.widgets.framelesswidget")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidget, "wangwenx190.framelesshelper.widgets.framelesswidget")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessWidget)
|
# define INFO qCInfo(lcFramelessWidget)
|
||||||
# define DEBUG qCDebug(lcFramelessWidget)
|
# define DEBUG qCDebug(lcFramelessWidget)
|
||||||
# define WARNING qCWarning(lcFramelessWidget)
|
# define WARNING qCWarning(lcFramelessWidget)
|
||||||
# define CRITICAL qCCritical(lcFramelessWidget)
|
# define CRITICAL qCCritical(lcFramelessWidget)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -118,3 +120,5 @@ void FramelessWidget::toggleFullScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -24,12 +24,14 @@
|
||||||
|
|
||||||
#include "framelesswidgetshelper.h"
|
#include "framelesswidgetshelper.h"
|
||||||
#include "framelesswidgetshelper_p.h"
|
#include "framelesswidgetshelper_p.h"
|
||||||
#include "framelesswidget.h"
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
#include "framelesswidget_p.h"
|
# include "framelesswidget.h"
|
||||||
#include "framelessmainwindow.h"
|
# include "framelesswidget_p.h"
|
||||||
#include "framelessmainwindow_p.h"
|
# include "framelessmainwindow.h"
|
||||||
#include "framelessdialog.h"
|
# include "framelessmainwindow_p.h"
|
||||||
#include "framelessdialog_p.h"
|
# include "framelessdialog.h"
|
||||||
|
# include "framelessdialog_p.h"
|
||||||
|
#endif
|
||||||
#include "widgetssharedhelper_p.h"
|
#include "widgetssharedhelper_p.h"
|
||||||
#include <FramelessHelper/Core/framelessmanager.h>
|
#include <FramelessHelper/Core/framelessmanager.h>
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
|
@ -54,18 +56,17 @@ extern Q_WIDGETS_EXPORT QWidget *qt_button_down;
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidgetsHelper, "wangwenx190.framelesshelper.widgets.framelesswidgetshelper")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidgetsHelper, "wangwenx190.framelesshelper.widgets.framelesswidgetshelper")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcFramelessWidgetsHelper)
|
# define INFO qCInfo(lcFramelessWidgetsHelper)
|
||||||
# define DEBUG qCDebug(lcFramelessWidgetsHelper)
|
# define DEBUG qCDebug(lcFramelessWidgetsHelper)
|
||||||
# define WARNING qCWarning(lcFramelessWidgetsHelper)
|
# define WARNING qCWarning(lcFramelessWidgetsHelper)
|
||||||
# define CRITICAL qCCritical(lcFramelessWidgetsHelper)
|
# define CRITICAL qCCritical(lcFramelessWidgetsHelper)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -241,6 +242,7 @@ QVariant FramelessWidgetsHelperPrivate::getProperty(const char *name, const QVar
|
||||||
return ((value.isValid() && !value.isNull()) ? value : defaultValue);
|
return ((value.isValid() && !value.isNull()) ? value : defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
MicaMaterial *FramelessWidgetsHelperPrivate::getMicaMaterialIfAny() const
|
MicaMaterial *FramelessWidgetsHelperPrivate::getMicaMaterialIfAny() const
|
||||||
{
|
{
|
||||||
if (!window) {
|
if (!window) {
|
||||||
|
@ -251,7 +253,9 @@ MicaMaterial *FramelessWidgetsHelperPrivate::getMicaMaterialIfAny() const
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
WindowBorderPainter *FramelessWidgetsHelperPrivate::getWindowBorderIfAny() const
|
WindowBorderPainter *FramelessWidgetsHelperPrivate::getWindowBorderIfAny() const
|
||||||
{
|
{
|
||||||
if (!window) {
|
if (!window) {
|
||||||
|
@ -262,6 +266,7 @@ WindowBorderPainter *FramelessWidgetsHelperPrivate::getWindowBorderIfAny() const
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWidget *window)
|
WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWidget *window)
|
||||||
{
|
{
|
||||||
|
@ -269,6 +274,7 @@ WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWi
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
#if FRAMELESSHELPER_CONFIG(window)
|
||||||
if (const auto widget = qobject_cast<FramelessWidget *>(window)) {
|
if (const auto widget = qobject_cast<FramelessWidget *>(window)) {
|
||||||
if (const auto widgetPriv = FramelessWidgetPrivate::get(widget)) {
|
if (const auto widgetPriv = FramelessWidgetPrivate::get(widget)) {
|
||||||
return widgetPriv->sharedHelper;
|
return widgetPriv->sharedHelper;
|
||||||
|
@ -284,6 +290,7 @@ WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWi
|
||||||
return dialogPriv->sharedHelper;
|
return dialogPriv->sharedHelper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
QWidget * const topLevelWindow = window->window();
|
QWidget * const topLevelWindow = window->window();
|
||||||
WidgetsSharedHelper *helper = topLevelWindow->findChild<WidgetsSharedHelper *>();
|
WidgetsSharedHelper *helper = topLevelWindow->findChild<WidgetsSharedHelper *>();
|
||||||
if (!helper) {
|
if (!helper) {
|
||||||
|
@ -413,13 +420,16 @@ void FramelessWidgetsHelperPrivate::attach()
|
||||||
params.forceChildrenRepaint = [this](const int delay) -> void { repaintAllChildren(delay); };
|
params.forceChildrenRepaint = [this](const int delay) -> void { repaintAllChildren(delay); };
|
||||||
params.resetQtGrabbedControl = []() -> bool {
|
params.resetQtGrabbedControl = []() -> bool {
|
||||||
if (qt_button_down) {
|
if (qt_button_down) {
|
||||||
QMouseEvent e(QEvent::MouseButtonRelease,
|
static constexpr const auto invalidPos = QPoint{ -99999, -99999 };
|
||||||
{-999, -999},
|
const auto event = std::make_unique<QMouseEvent>(
|
||||||
Qt::LeftButton,
|
QEvent::MouseButtonRelease,
|
||||||
Qt::NoButton,
|
invalidPos,
|
||||||
QApplication::keyboardModifiers()
|
invalidPos,
|
||||||
);
|
invalidPos,
|
||||||
QApplication::sendEvent(qt_button_down, &e);
|
Qt::LeftButton,
|
||||||
|
QGuiApplication::mouseButtons() ^ Qt::LeftButton,
|
||||||
|
QGuiApplication::keyboardModifiers());
|
||||||
|
QApplication::sendEvent(qt_button_down, event.get());
|
||||||
qt_button_down = nullptr;
|
qt_button_down = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -683,7 +693,7 @@ void FramelessWidgetsHelper::showSystemMenu(const QPoint &pos)
|
||||||
const QPoint nativePos = Utils::toNativeGlobalPosition(d->window->windowHandle(), pos);
|
const QPoint nativePos = Utils::toNativeGlobalPosition(d->window->windowHandle(), pos);
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
std::ignore = Utils::showSystemMenu(windowId, nativePos, false, &d->getWindowData()->params);
|
std::ignore = Utils::showSystemMenu(windowId, nativePos, false, &d->getWindowData()->params);
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
Utils::openSystemMenu(windowId, nativePos);
|
Utils::openSystemMenu(windowId, nativePos);
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(windowId);
|
Q_UNUSED(windowId);
|
||||||
|
@ -768,17 +778,21 @@ QWidget *FramelessWidgetsHelper::window() const
|
||||||
return d->window;
|
return d->window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
MicaMaterial *FramelessWidgetsHelper::micaMaterial() const
|
MicaMaterial *FramelessWidgetsHelper::micaMaterial() const
|
||||||
{
|
{
|
||||||
Q_D(const FramelessWidgetsHelper);
|
Q_D(const FramelessWidgetsHelper);
|
||||||
return d->getMicaMaterialIfAny();
|
return d->getMicaMaterialIfAny();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
WindowBorderPainter *FramelessWidgetsHelper::windowBorder() const
|
WindowBorderPainter *FramelessWidgetsHelper::windowBorder() const
|
||||||
{
|
{
|
||||||
Q_D(const FramelessWidgetsHelper);
|
Q_D(const FramelessWidgetsHelper);
|
||||||
return d->getWindowBorderIfAny();
|
return d->getWindowBorderIfAny();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool FramelessWidgetsHelper::isWindowFixedSize() const
|
bool FramelessWidgetsHelper::isWindowFixedSize() const
|
||||||
{
|
{
|
||||||
|
@ -844,7 +858,9 @@ void FramelessWidgetsHelper::setBlurBehindWindowEnabled(const bool enable)
|
||||||
} else {
|
} else {
|
||||||
if (WidgetsSharedHelper * const helper = d->findOrCreateSharedHelper(d->window)) {
|
if (WidgetsSharedHelper * const helper = d->findOrCreateSharedHelper(d->window)) {
|
||||||
d->blurBehindWindowEnabled = enable;
|
d->blurBehindWindowEnabled = enable;
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
helper->setMicaEnabled(d->blurBehindWindowEnabled);
|
helper->setMicaEnabled(d->blurBehindWindowEnabled);
|
||||||
|
#endif
|
||||||
d->emitSignalForAllInstances("blurBehindWindowEnabledChanged");
|
d->emitSignalForAllInstances("blurBehindWindowEnabledChanged");
|
||||||
} else {
|
} else {
|
||||||
DEBUG << "Blur behind window is not supported on current platform.";
|
DEBUG << "Blur behind window is not supported on current platform.";
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
#include "standardsystembutton.h"
|
#include "standardsystembutton.h"
|
||||||
#include "standardsystembutton_p.h"
|
#include "standardsystembutton_p.h"
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
#include <FramelessHelper/Core/private/framelessmanager_p.h>
|
#include <FramelessHelper/Core/private/framelessmanager_p.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
@ -33,18 +36,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardSystemButton, "wangwenx190.framelesshelper.widgets.standardsystembutton")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardSystemButton, "wangwenx190.framelesshelper.widgets.standardsystembutton")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcStandardSystemButton)
|
# define INFO qCInfo(lcStandardSystemButton)
|
||||||
# define DEBUG qCDebug(lcStandardSystemButton)
|
# define DEBUG qCDebug(lcStandardSystemButton)
|
||||||
# define WARNING qCWarning(lcStandardSystemButton)
|
# define WARNING qCWarning(lcStandardSystemButton)
|
||||||
# define CRITICAL qCCritical(lcStandardSystemButton)
|
# define CRITICAL qCCritical(lcStandardSystemButton)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -344,3 +346,5 @@ void StandardSystemButton::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -24,7 +24,12 @@
|
||||||
|
|
||||||
#include "standardtitlebar.h"
|
#include "standardtitlebar.h"
|
||||||
#include "standardtitlebar_p.h"
|
#include "standardtitlebar_p.h"
|
||||||
#include "standardsystembutton.h"
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||||
|
# include "standardsystembutton.h"
|
||||||
|
#endif
|
||||||
#include "framelesswidgetshelper.h"
|
#include "framelesswidgetshelper.h"
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
#include <QtCore/qcoreevent.h>
|
#include <QtCore/qcoreevent.h>
|
||||||
|
@ -37,18 +42,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardTitleBar, "wangwenx190.framelesshelper.widgets.standardtitlebar")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardTitleBar, "wangwenx190.framelesshelper.widgets.standardtitlebar")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcStandardTitleBar)
|
# define INFO qCInfo(lcStandardTitleBar)
|
||||||
# define DEBUG qCDebug(lcStandardTitleBar)
|
# define DEBUG qCDebug(lcStandardTitleBar)
|
||||||
# define WARNING qCWarning(lcStandardTitleBar)
|
# define WARNING qCWarning(lcStandardTitleBar)
|
||||||
# define CRITICAL qCCritical(lcStandardTitleBar)
|
# define CRITICAL qCCritical(lcStandardTitleBar)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -231,11 +235,11 @@ bool StandardTitleBarPrivate::isInTitleBarIconArea(const QPoint &pos) const
|
||||||
|
|
||||||
void StandardTitleBarPrivate::updateMaximizeButton()
|
void StandardTitleBarPrivate::updateMaximizeButton()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
const bool max = window->isMaximized();
|
const bool max = window->isMaximized();
|
||||||
maximizeButton->setButtonType(max ? SystemButtonType::Restore : SystemButtonType::Maximize);
|
maximizeButton->setButtonType(max ? SystemButtonType::Restore : SystemButtonType::Maximize);
|
||||||
maximizeButton->setToolTip(max ? tr("Restore") : tr("Maximize"));
|
maximizeButton->setToolTip(max ? tr("Restore") : tr("Maximize"));
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void StandardTitleBarPrivate::updateTitleBarColor()
|
void StandardTitleBarPrivate::updateTitleBarColor()
|
||||||
|
@ -246,7 +250,7 @@ void StandardTitleBarPrivate::updateTitleBarColor()
|
||||||
|
|
||||||
void StandardTitleBarPrivate::updateChromeButtonColor()
|
void StandardTitleBarPrivate::updateChromeButtonColor()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
const bool active = window->isActiveWindow();
|
const bool active = window->isActiveWindow();
|
||||||
const QColor activeForeground = chromePalette->titleBarActiveForegroundColor();
|
const QColor activeForeground = chromePalette->titleBarActiveForegroundColor();
|
||||||
const QColor inactiveForeground = chromePalette->titleBarInactiveForegroundColor();
|
const QColor inactiveForeground = chromePalette->titleBarInactiveForegroundColor();
|
||||||
|
@ -271,16 +275,16 @@ void StandardTitleBarPrivate::updateChromeButtonColor()
|
||||||
closeButton->setHoverColor(chromePalette->closeButtonHoverColor());
|
closeButton->setHoverColor(chromePalette->closeButtonHoverColor());
|
||||||
closeButton->setPressColor(chromePalette->closeButtonPressColor());
|
closeButton->setPressColor(chromePalette->closeButtonPressColor());
|
||||||
closeButton->setActive(active);
|
closeButton->setActive(active);
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void StandardTitleBarPrivate::retranslateUi()
|
void StandardTitleBarPrivate::retranslateUi()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
minimizeButton->setToolTip(tr("Minimize"));
|
minimizeButton->setToolTip(tr("Minimize"));
|
||||||
maximizeButton->setToolTip(window->isMaximized() ? tr("Restore") : tr("Maximize"));
|
maximizeButton->setToolTip(window->isMaximized() ? tr("Restore") : tr("Maximize"));
|
||||||
closeButton->setToolTip(tr("Close"));
|
closeButton->setToolTip(tr("Close"));
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StandardTitleBarPrivate::eventFilter(QObject *object, QEvent *event)
|
bool StandardTitleBarPrivate::eventFilter(QObject *object, QEvent *event)
|
||||||
|
@ -335,7 +339,7 @@ void StandardTitleBarPrivate::initialize()
|
||||||
const auto titleBarLayout = new QHBoxLayout(q);
|
const auto titleBarLayout = new QHBoxLayout(q);
|
||||||
titleBarLayout->setSpacing(0);
|
titleBarLayout->setSpacing(0);
|
||||||
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
#else // !Q_OS_MACOS
|
#elif FRAMELESSHELPER_CONFIG(system_button)
|
||||||
minimizeButton = new StandardSystemButton(SystemButtonType::Minimize, q);
|
minimizeButton = new StandardSystemButton(SystemButtonType::Minimize, q);
|
||||||
connect(minimizeButton, &StandardSystemButton::clicked, window, &QWidget::showMinimized);
|
connect(minimizeButton, &StandardSystemButton::clicked, window, &QWidget::showMinimized);
|
||||||
maximizeButton = new StandardSystemButton(SystemButtonType::Maximize, q);
|
maximizeButton = new StandardSystemButton(SystemButtonType::Maximize, q);
|
||||||
|
@ -374,7 +378,7 @@ void StandardTitleBarPrivate::initialize()
|
||||||
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
titleBarLayout->addStretch();
|
titleBarLayout->addStretch();
|
||||||
titleBarLayout->addLayout(systemButtonsOuterLayout);
|
titleBarLayout->addLayout(systemButtonsOuterLayout);
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
updateTitleBarColor();
|
updateTitleBarColor();
|
||||||
updateChromeButtonColor();
|
updateChromeButtonColor();
|
||||||
|
@ -395,7 +399,7 @@ StandardTitleBar::StandardTitleBar(QWidget *parent)
|
||||||
|
|
||||||
StandardTitleBar::~StandardTitleBar() = default;
|
StandardTitleBar::~StandardTitleBar() = default;
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||||
StandardSystemButton *StandardTitleBar::minimizeButton() const
|
StandardSystemButton *StandardTitleBar::minimizeButton() const
|
||||||
{
|
{
|
||||||
Q_D(const StandardTitleBar);
|
Q_D(const StandardTitleBar);
|
||||||
|
@ -413,7 +417,7 @@ StandardSystemButton *StandardTitleBar::closeButton() const
|
||||||
Q_D(const StandardTitleBar);
|
Q_D(const StandardTitleBar);
|
||||||
return d->closeButton;
|
return d->closeButton;
|
||||||
}
|
}
|
||||||
#endif // Q_OS_MACOS
|
#endif
|
||||||
|
|
||||||
void StandardTitleBar::mouseReleaseEvent(QMouseEvent *event)
|
void StandardTitleBar::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -627,3 +631,5 @@ void StandardTitleBar::setTitleFont(const QFont &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -23,11 +23,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "widgetssharedhelper_p.h"
|
#include "widgetssharedhelper_p.h"
|
||||||
#include <FramelessHelper/Core/micamaterial.h>
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
# include <FramelessHelper/Core/micamaterial.h>
|
||||||
|
# include <FramelessHelper/Core/private/micamaterial_p.h>
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
|
# include <FramelessHelper/Core/windowborderpainter.h>
|
||||||
|
#endif
|
||||||
#include <FramelessHelper/Core/utils.h>
|
#include <FramelessHelper/Core/utils.h>
|
||||||
#include <FramelessHelper/Core/windowborderpainter.h>
|
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
#include <FramelessHelper/Core/private/micamaterial_p.h>
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
# include <FramelessHelper/Core/private/winverhelper_p.h>
|
# include <FramelessHelper/Core/private/winverhelper_p.h>
|
||||||
#endif // Q_OS_WINDOWS
|
#endif // Q_OS_WINDOWS
|
||||||
|
@ -39,18 +43,17 @@
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWidgetsSharedHelper, "wangwenx190.framelesshelper.widgets.widgetssharedhelper")
|
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWidgetsSharedHelper, "wangwenx190.framelesshelper.widgets.widgetssharedhelper")
|
||||||
|
|
||||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
|
||||||
# define INFO QT_NO_QDEBUG_MACRO()
|
|
||||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
|
||||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
|
||||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
|
||||||
#else
|
|
||||||
# define INFO qCInfo(lcWidgetsSharedHelper)
|
# define INFO qCInfo(lcWidgetsSharedHelper)
|
||||||
# define DEBUG qCDebug(lcWidgetsSharedHelper)
|
# define DEBUG qCDebug(lcWidgetsSharedHelper)
|
||||||
# define WARNING qCWarning(lcWidgetsSharedHelper)
|
# define WARNING qCWarning(lcWidgetsSharedHelper)
|
||||||
# define CRITICAL qCCritical(lcWidgetsSharedHelper)
|
# define CRITICAL qCCritical(lcWidgetsSharedHelper)
|
||||||
|
#else
|
||||||
|
# define INFO QT_NO_QDEBUG_MACRO()
|
||||||
|
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||||
|
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||||
|
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Global;
|
using namespace Global;
|
||||||
|
@ -71,6 +74,7 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_targetWidget = widget;
|
m_targetWidget = widget;
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
m_borderPainter = new WindowBorderPainter(this);
|
m_borderPainter = new WindowBorderPainter(this);
|
||||||
if (m_borderRepaintConnection) {
|
if (m_borderRepaintConnection) {
|
||||||
disconnect(m_borderRepaintConnection);
|
disconnect(m_borderRepaintConnection);
|
||||||
|
@ -82,6 +86,8 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
||||||
m_targetWidget->update();
|
m_targetWidget->update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
m_micaMaterial = new MicaMaterial(this);
|
m_micaMaterial = new MicaMaterial(this);
|
||||||
if (m_micaRedrawConnection) {
|
if (m_micaRedrawConnection) {
|
||||||
disconnect(m_micaRedrawConnection);
|
disconnect(m_micaRedrawConnection);
|
||||||
|
@ -93,6 +99,7 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
||||||
m_targetWidget->update();
|
m_targetWidget->update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
m_targetWidget->installEventFilter(this);
|
m_targetWidget->installEventFilter(this);
|
||||||
updateContentsMargins();
|
updateContentsMargins();
|
||||||
m_targetWidget->update();
|
m_targetWidget->update();
|
||||||
|
@ -110,6 +117,7 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
||||||
&QWindow::screenChanged, this, &WidgetsSharedHelper::handleScreenChanged);
|
&QWindow::screenChanged, this, &WidgetsSharedHelper::handleScreenChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
bool WidgetsSharedHelper::isMicaEnabled() const
|
bool WidgetsSharedHelper::isMicaEnabled() const
|
||||||
{
|
{
|
||||||
return m_micaEnabled;
|
return m_micaEnabled;
|
||||||
|
@ -131,11 +139,14 @@ MicaMaterial *WidgetsSharedHelper::rawMicaMaterial() const
|
||||||
{
|
{
|
||||||
return m_micaMaterial;
|
return m_micaMaterial;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
WindowBorderPainter *WidgetsSharedHelper::rawWindowBorder() const
|
WindowBorderPainter *WidgetsSharedHelper::rawWindowBorder() const
|
||||||
{
|
{
|
||||||
return m_borderPainter;
|
return m_borderPainter;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -162,8 +173,12 @@ bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
||||||
m_targetWidget->update();
|
m_targetWidget->update();
|
||||||
break;
|
break;
|
||||||
case QEvent::Paint: {
|
case QEvent::Paint: {
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
repaintMica();
|
repaintMica();
|
||||||
|
#endif
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
repaintBorder();
|
repaintBorder();
|
||||||
|
#endif
|
||||||
} break;
|
} break;
|
||||||
case QEvent::WindowStateChange:
|
case QEvent::WindowStateChange:
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
|
@ -173,7 +188,11 @@ bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
||||||
break;
|
break;
|
||||||
case QEvent::Move:
|
case QEvent::Move:
|
||||||
case QEvent::Resize:
|
case QEvent::Resize:
|
||||||
m_targetWidget->update();
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
if (m_micaEnabled) {
|
||||||
|
m_targetWidget->update();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -181,24 +200,28 @@ bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
||||||
return QObject::eventFilter(object, event);
|
return QObject::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
void WidgetsSharedHelper::repaintMica()
|
void WidgetsSharedHelper::repaintMica()
|
||||||
{
|
{
|
||||||
if (!m_micaEnabled || !m_micaMaterial) {
|
if (!m_micaEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QPainter painter(m_targetWidget);
|
QPainter painter(m_targetWidget);
|
||||||
const QRect rect = { m_targetWidget->mapToGlobal(QPoint(0, 0)), m_targetWidget->size() };
|
const QRect rect = { m_targetWidget->mapToGlobal(QPoint(0, 0)), m_targetWidget->size() };
|
||||||
m_micaMaterial->paint(&painter, rect, m_targetWidget->isActiveWindow());
|
m_micaMaterial->paint(&painter, rect, m_targetWidget->isActiveWindow());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||||
void WidgetsSharedHelper::repaintBorder()
|
void WidgetsSharedHelper::repaintBorder()
|
||||||
{
|
{
|
||||||
if ((Utils::windowStatesToWindowState(m_targetWidget->windowState()) != Qt::WindowNoState) || !m_borderPainter) {
|
if (Utils::windowStatesToWindowState(m_targetWidget->windowState()) != Qt::WindowNoState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QPainter painter(m_targetWidget);
|
QPainter painter(m_targetWidget);
|
||||||
m_borderPainter->paint(&painter, m_targetWidget->size(), m_targetWidget->isActiveWindow());
|
m_borderPainter->paint(&painter, m_targetWidget->size(), m_targetWidget->isActiveWindow());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void WidgetsSharedHelper::emitCustomWindowStateSignals()
|
void WidgetsSharedHelper::emitCustomWindowStateSignals()
|
||||||
{
|
{
|
||||||
|
@ -244,9 +267,11 @@ void WidgetsSharedHelper::handleScreenChanged(QScreen *screen)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_screenDpr = currentDpr;
|
m_screenDpr = currentDpr;
|
||||||
if (m_micaEnabled && m_micaMaterial) {
|
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||||
|
if (m_micaEnabled) {
|
||||||
MicaMaterialPrivate::get(m_micaMaterial)->maybeGenerateBlurredWallpaper(true);
|
MicaMaterialPrivate::get(m_micaMaterial)->maybeGenerateBlurredWallpaper(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue