Skip to content

Commit

Permalink
更新frameless库,解决closeEvent边框显现的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
czyt1988 committed Nov 22, 2023
1 parent d626fe3 commit bcb4d96
Show file tree
Hide file tree
Showing 63 changed files with 380 additions and 308 deletions.
14 changes: 14 additions & 0 deletions src/SARibbonBar/3rdparty/framelesshelper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,20 @@ add_project_config(KEY "system_button" CONDITION NOT FRAMELESSHELPER_NO_SYSTEM_B
add_project_config(KEY "native_impl" CONDITION FRAMELESSHELPER_NATIVE_IMPL)
generate_project_config(PATH "${FRAMELESSHELPER_CONFIG_FILE}")

function(setup_custom_moc_macros)
cmake_parse_arguments(arg "" "" "TARGETS" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(AUTHOR_WARNING "setup_custom_moc_macros: Unrecognized arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
foreach(__target ${arg_TARGETS})
if(NOT TARGET ${__target})
message(AUTHOR_WARNING "${__target} is not a valid CMake target!")
continue()
endif()
set_property(TARGET ${__target} APPEND PROPERTY AUTOMOC_MACRO_NAMES "FRAMELESSHELPER_QT_CLASS;FRAMELESSHELPER_PUBLIC_QT_CLASS;FRAMELESSHELPER_PRIVATE_QT_CLASS")
endforeach()
endfunction()

if(FRAMELESSHELPER_BUILD_WIDGETS OR FRAMELESSHELPER_BUILD_QUICK)
add_subdirectory(src)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class ChromePalettePrivate;
class FRAMELESSHELPER_CORE_API ChromePalette : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(ChromePalette)

Q_PROPERTY(QColor titleBarActiveBackgroundColor READ titleBarActiveBackgroundColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessHelperQtPrivate;
class FRAMELESSHELPER_CORE_API FramelessHelperQt : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessHelperQt)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ QT_END_NAMESPACE
#ifndef FRAMELESSHELPER_QT_CLASS
# define FRAMELESSHELPER_QT_CLASS(Class) \
private: \
Q_OBJECT \
FRAMELESSHELPER_CLASS_INFO \
FRAMELESSHELPER_CLASS(Class)
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessManagerPrivate;
class FRAMELESSHELPER_CORE_API FramelessManager : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessManager)
Q_PROPERTY(Global::SystemTheme systemTheme READ systemTheme WRITE setOverrideTheme NOTIFY systemThemeChanged FINAL)
Q_PROPERTY(QColor systemAccentColor READ systemAccentColor NOTIFY systemThemeChanged FINAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class MicaMaterialPrivate;
class FRAMELESSHELPER_CORE_API MicaMaterial : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(MicaMaterial)

Q_PROPERTY(QColor tintColor READ tintColor WRITE setTintColor NOTIFY tintColorChanged FINAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class ChromePalette;
class FRAMELESSHELPER_CORE_API ChromePalettePrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(ChromePalette)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_CORE_API FramelessConfig : public QObject
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(FramelessConfig)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ using FramelessDataPtr = std::shared_ptr<FramelessData>;
class FramelessManager;
class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(FramelessManager)

public:
Expand Down Expand Up @@ -74,4 +73,19 @@ class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
QTimer wallpaperTimer{};
};

class InternalEventFilter : public QObject
{
FRAMELESSHELPER_QT_CLASS(InternalEventFilter)

public:
explicit InternalEventFilter(const QObject *window, QObject *parent = nullptr);
~InternalEventFilter() override;

protected:
Q_NODISCARD bool eventFilter(QObject *object, QEvent *event) override;

private:
const QObject *m_window = nullptr;
};

FRAMELESSHELPER_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,29 @@

#include <FramelessHelper/Core/framelesshelpercore_global.h>
#include <QtGui/qbrush.h>
#ifdef FRAMELESSHELPER_HAS_THREAD
# undef FRAMELESSHELPER_HAS_THREAD
#endif
#if QT_CONFIG(thread)
# define FRAMELESSHELPER_HAS_THREAD 1
# include <QtCore/qthread.h>
#else // !QT_CONFIG(thread)
# define FRAMELESSHELPER_HAS_THREAD 0
#endif // QT_CONFIG(thread)

#if FRAMELESSHELPER_CONFIG(mica_material)

FRAMELESSHELPER_BEGIN_NAMESPACE

#if FRAMELESSHELPER_HAS_THREAD
using FramelessHelperThreadClass = QThread;
#else
using FramelessHelperThreadClass = QObject;
#endif

class MicaMaterial;
class FRAMELESSHELPER_CORE_API MicaMaterialPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(MicaMaterial)

public:
Expand Down Expand Up @@ -64,6 +78,26 @@ class FRAMELESSHELPER_CORE_API MicaMaterialPrivate : public QObject
QSize wallpaperSize = {};
};

class WallpaperThread : public FramelessHelperThreadClass
{
FRAMELESSHELPER_QT_CLASS(WallpaperThread)

public:
explicit WallpaperThread(QObject *parent = nullptr);
~WallpaperThread() override;

Q_SIGNALS:
void imageUpdated();

#if FRAMELESSHELPER_HAS_THREAD
protected:
void run() override;
#else
public:
void start();
#endif
};

FRAMELESSHELPER_END_NAMESPACE

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_CORE_API RegistryKey : public QObject
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(RegistryKey)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_CORE_API SysApiLoader : public QObject
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(SysApiLoader)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class WindowBorderPainter;
class FRAMELESSHELPER_CORE_API WindowBorderPainterPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(WindowBorderPainter)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ namespace Utils
[[nodiscard]] FRAMELESSHELPER_CORE_API quint32 defaultScreenDpi();
[[nodiscard]] FRAMELESSHELPER_CORE_API bool isWindowAccelerated(const QWindow *window);
[[nodiscard]] FRAMELESSHELPER_CORE_API bool isWindowTransparent(const QWindow *window);
[[nodiscard]] FRAMELESSHELPER_CORE_API QColor calculateForegroundColor(const QColor &backgroundColor);

#ifdef Q_OS_WINDOWS
[[nodiscard]] FRAMELESSHELPER_CORE_API bool isWindowsVersionOrGreater(const Global::WindowsVersion version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class WindowBorderPainterPrivate;
class FRAMELESSHELPER_CORE_API WindowBorderPainter : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(WindowBorderPainter)

Q_PROPERTY(int thickness READ thickness WRITE setThickness NOTIFY thicknessChanged FINAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ FRAMELESSHELPER_QUICK_API void FramelessHelperQuickRegisterTypes(QQmlEngine *);

class FRAMELESSHELPER_QUICK_API QuickGlobal : public QObject
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(QuickGlobal)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(FramelessHelperConstants)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class QuickWindowBorder;
class FramelessQuickHelperPrivate;
class FRAMELESSHELPER_QUICK_API FramelessQuickHelper : public QQuickItem
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessQuickHelper)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(FramelessHelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQmlParserStatus
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(FramelessQuickUtils)
Q_INTERFACES(QQmlParserStatus)
#ifdef QML_NAMED_ELEMENT
Expand All @@ -56,6 +55,7 @@ class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQm
Q_PROPERTY(QSizeF defaultSystemButtonIconSize READ defaultSystemButtonIconSize CONSTANT FINAL)
Q_PROPERTY(QColor defaultSystemButtonBackgroundColor READ defaultSystemButtonBackgroundColor CONSTANT FINAL)
Q_PROPERTY(QColor defaultSystemCloseButtonBackgroundColor READ defaultSystemCloseButtonBackgroundColor CONSTANT FINAL)
Q_PROPERTY(bool blurBehindWindowSupported READ blurBehindWindowSupported CONSTANT FINAL)

public:
explicit FramelessQuickUtils(QObject *parent = nullptr);
Expand All @@ -74,6 +74,7 @@ class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQm
Q_NODISCARD QSizeF defaultSystemButtonIconSize() const;
Q_NODISCARD QColor defaultSystemButtonBackgroundColor() const;
Q_NODISCARD QColor defaultSystemCloseButtonBackgroundColor() const;
Q_NODISCARD bool blurBehindWindowSupported() const;

Q_NODISCARD Q_SLOT QColor getSystemButtonBackgroundColor(
const QuickGlobal::SystemButtonType button, const QuickGlobal::ButtonState state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessQuickApplicationWindowPrivate;
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindow : public QQuickApplicationWindow
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessQuickApplicationWindow)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(FramelessApplicationWindow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class QuickWindowBorder;
class FramelessQuickApplicationWindow;
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindowPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(FramelessQuickApplicationWindow)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class QuickWindowBorder;
class FramelessQuickHelper;
class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(FramelessQuickHelper)

public:
Expand Down Expand Up @@ -87,7 +86,6 @@ class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
bool qpaReady = false;
quint32 qpaWaitTime = 0;
QTimer repaintTimer{};
bool repaintedOnce = false;
};

FRAMELESSHELPER_END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessQuickWindowPrivate;
class FRAMELESSHELPER_QUICK_API FramelessQuickWindow : public QQuickWindowQmlImpl
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessQuickWindow)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(FramelessWindow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class QuickWindowBorder;
class FramelessQuickWindow;
class FRAMELESSHELPER_QUICK_API FramelessQuickWindowPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(FramelessQuickWindow)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_QUICK_API QuickImageItem : public QQuickPaintedItem
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(QuickImageItem)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(ImageItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class MicaMaterial;
class QuickMicaMaterial;
class FRAMELESSHELPER_QUICK_API QuickMicaMaterialPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(QuickMicaMaterial)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_QUICK_API QuickStandardSystemButton : public QQuickButton
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(QuickStandardSystemButton)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(StandardSystemButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class QuickImageItem;

class FRAMELESSHELPER_QUICK_API QuickStandardTitleBar : public QQuickRectangle
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(QuickStandardTitleBar)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(StandardTitleBar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class WindowBorderPainter;
class QuickWindowBorder;
class FRAMELESSHELPER_QUICK_API QuickWindowBorderPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(QuickWindowBorder)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE

class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette, public QQmlParserStatus
{
Q_OBJECT
FRAMELESSHELPER_QT_CLASS(QuickChromePalette)
Q_INTERFACES(QQmlParserStatus)
#ifdef QML_ANONYMOUS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class QuickMicaMaterialPrivate;
class FRAMELESSHELPER_QUICK_API QuickMicaMaterial : public QQuickPaintedItem
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(QuickMicaMaterial)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(MicaMaterial)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class QuickWindowBorderPrivate;
class FRAMELESSHELPER_QUICK_API QuickWindowBorder : public QQuickPaintedItem
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(QuickWindowBorder)
#ifdef QML_NAMED_ELEMENT
QML_NAMED_ELEMENT(WindowBorder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessDialogPrivate;
class FRAMELESSHELPER_WIDGETS_API FramelessDialog : public QDialog
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessDialog)

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessMainWindowPrivate;
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindow : public QMainWindow
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessMainWindow)
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
Q_PROPERTY(bool normal READ isNormal NOTIFY normalChanged FINAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
class FramelessWidgetPrivate;
class FRAMELESSHELPER_WIDGETS_API FramelessWidget : public QWidget
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessWidget)
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
Q_PROPERTY(bool normal READ isNormal NOTIFY normalChanged FINAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class WindowBorderPainter;
class FramelessWidgetsHelperPrivate;
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelper : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PUBLIC_QT_CLASS(FramelessWidgetsHelper)
Q_PROPERTY(QWidget* titleBarWidget READ titleBarWidget WRITE setTitleBarWidget NOTIFY titleBarWidgetChanged FINAL)
Q_PROPERTY(bool windowFixedSize READ isWindowFixedSize WRITE setWindowFixedSize NOTIFY windowFixedSizeChanged FINAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class WidgetsSharedHelper;
class FramelessDialog;
class FRAMELESSHELPER_WIDGETS_API FramelessDialogPrivate : public QObject
{
Q_OBJECT
FRAMELESSHELPER_PRIVATE_QT_CLASS(FramelessDialog)

public:
Expand Down
Loading

0 comments on commit bcb4d96

Please sign in to comment.