forked from github_mirror/framelesshelper
add limited qmake support
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
abf4b29dca
commit
7a35b09a74
|
@ -26,6 +26,18 @@
|
|||
|
||||
IDI_ICON1 ICON "example.ico"
|
||||
|
||||
#if 0
|
||||
#if (defined(WIDGET_USE_QMAKE) || defined(QUICK_USE_QMAKE))
|
||||
#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID
|
||||
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
|
||||
#endif
|
||||
#ifndef RT_MANIFEST
|
||||
#define RT_MANIFEST 24
|
||||
#endif
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "example.manifest"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
|
|
|
@ -39,6 +39,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
QApplication application(argc, argv);
|
||||
|
||||
// Must be called after QGuiApplication has been constructed, we are using
|
||||
// some private functions from QPA which won't be available until there's
|
||||
// a QGuiApplication instance.
|
||||
FramelessHelper::Core::setApplicationOSThemeAware(true, false);
|
||||
|
||||
FramelessConfig::instance()->set(Global::Option::WindowUseRoundCorners);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
|
||||
|
|
|
@ -76,6 +76,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
QApplication application(argc, argv);
|
||||
|
||||
// Must be called after QGuiApplication has been constructed, we are using
|
||||
// some private functions from QPA which won't be available until there's
|
||||
// a QGuiApplication instance.
|
||||
FramelessHelper::Core::setApplicationOSThemeAware(true, false);
|
||||
|
||||
FramelessConfig::instance()->set(Global::Option::WindowUseRoundCorners);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
|
||||
|
|
|
@ -57,8 +57,10 @@ if(${QT_VERSION} VERSION_GREATER_EQUAL 6.2)
|
|||
# There's some hope to get it supported in Qt 6.5.
|
||||
)
|
||||
qt_add_resources(Quick resources
|
||||
PREFIX "/Demo"
|
||||
FILES "images/microsoft.svg"
|
||||
PREFIX
|
||||
"/Demo"
|
||||
FILES
|
||||
"images/microsoft.svg"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -51,6 +51,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
QGuiApplication application(argc, argv);
|
||||
|
||||
// Must be called after QGuiApplication has been constructed, we are using
|
||||
// some private functions from QPA which won't be available until there's
|
||||
// a QGuiApplication instance.
|
||||
FramelessHelper::Core::setApplicationOSThemeAware(true, true);
|
||||
|
||||
FramelessConfig::instance()->set(Global::Option::WindowUseRoundCorners);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
|
||||
|
@ -75,11 +80,11 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
#if !QMLTC_ENABLED
|
||||
#if (!QMLTC_ENABLED && !defined(QUICK_USE_QMAKE))
|
||||
engine.addImportPath(FRAMELESSHELPER_STRING_LITERAL("../imports"));
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0)) && !QMLTC_ENABLED
|
||||
#if (((QT_VERSION < QT_VERSION_CHECK(6, 2, 0)) || defined(QUICK_USE_QMAKE)) && !QMLTC_ENABLED)
|
||||
// Don't forget to register our own custom QML types!
|
||||
FramelessHelper::Quick::registerTypes(&engine);
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
TEMPLATE = app
|
||||
TARGET = Quick
|
||||
QT += qml quick quickcontrols2
|
||||
CONFIG -= embed_manifest_exe
|
||||
DEFINES += QUICK_USE_QMAKE
|
||||
HEADERS += settings.h
|
||||
SOURCES += settings.cpp main.cpp
|
||||
RESOURCES += resources.qrc
|
||||
win32: RC_FILE = ../example.rc
|
||||
include(../../qmake/core.pri)
|
||||
include(../../qmake/quick.pri)
|
|
@ -39,6 +39,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
QApplication application(argc, argv);
|
||||
|
||||
// Must be called after QGuiApplication has been constructed, we are using
|
||||
// some private functions from QPA which won't be available until there's
|
||||
// a QGuiApplication instance.
|
||||
FramelessHelper::Core::setApplicationOSThemeAware(true, false);
|
||||
|
||||
FramelessConfig::instance()->set(Global::Option::WindowUseRoundCorners);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
TEMPLATE = app
|
||||
TARGET = Widget
|
||||
QT += widgets
|
||||
CONFIG -= embed_manifest_exe
|
||||
HEADERS += widget.h
|
||||
SOURCES += widget.cpp main.cpp
|
||||
win32: RC_FILE = ../example.rc
|
||||
include(../../qmake/core.pri)
|
||||
include(../../qmake/widgets.pri)
|
|
@ -566,6 +566,7 @@ FRAMELESSHELPER_CORE_API void uninitialize();
|
|||
[[nodiscard]] FRAMELESSHELPER_CORE_API Global::VersionInfo version();
|
||||
FRAMELESSHELPER_CORE_API void registerInitializeHook(const Global::InitializeHookCallback &cb);
|
||||
FRAMELESSHELPER_CORE_API void registerUninitializeHook(const Global::UninitializeHookCallback &cb);
|
||||
FRAMELESSHELPER_CORE_API void setApplicationOSThemeAware(const bool enable, const bool pureQuick);
|
||||
} // namespace FramelessHelper::Core
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -25,14 +25,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelpercore_global.h"
|
||||
#include "chromepalette.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <optional>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class ChromePalette;
|
||||
|
||||
class FRAMELESSHELPER_CORE_API ChromePalettePrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -25,14 +25,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelpercore_global.h"
|
||||
#include "micamaterial.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtGui/qbrush.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class MicaMaterial;
|
||||
|
||||
class FRAMELESSHELPER_CORE_API MicaMaterialPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "framelesshelpercore_global.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QWinRegistryKey;
|
||||
|
@ -49,6 +51,15 @@ public:
|
|||
Q_NODISCARD bool isValid() const;
|
||||
|
||||
Q_NODISCARD QVariant value(const QString &name) const;
|
||||
template<typename T>
|
||||
Q_NODISCARD std::optional<T> value(const QString &name) const
|
||||
{
|
||||
const QVariant var = value(name);
|
||||
if (var.isValid()) {
|
||||
return qvariant_cast<T>(var);
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
private:
|
||||
Global::RegistryRootKey m_rootKey = Global::RegistryRootKey::CurrentUser;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperquick_global.h"
|
||||
#include "framelessquickhelper.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
|
@ -35,7 +36,6 @@ QT_END_NAMESPACE
|
|||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
struct QuickHelperData;
|
||||
class FramelessQuickHelper;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "framelesshelperquick_global.h"
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include "framelessquickwindow_p.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
#include <QtQuick/private/qquickanchors_p_p.h>
|
||||
|
@ -36,8 +37,6 @@ QT_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessQuickWindow;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API FramelessQuickWindowPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -25,14 +25,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperquick_global.h"
|
||||
#include "quickimageitem.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickImageItem;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickImageItemPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperquick_global.h"
|
||||
#include "quickmicamaterial.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickMicaMaterial;
|
||||
class WallpaperImageNode;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickMicaMaterialPrivate : public QObject
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "framelesshelperquick_global.h"
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include "quickchromepalette.h"
|
||||
#include "quickstandardsystembutton_p.h"
|
||||
#include <QtQuick/private/qquickrectangle_p.h>
|
||||
#include <QtQuickTemplates2/private/qquicklabel_p.h>
|
||||
|
||||
|
@ -36,7 +37,6 @@ QT_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickStandardSystemButton;
|
||||
class QuickImageItem;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickStandardTitleBar : public QQuickRectangle
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "framelesshelperwidgets_global.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
#include "framelessmainwindow.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessMainWindow;
|
||||
class WidgetsSharedHelper;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindowPrivate : public QObject
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
#include "framelesswidget.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessWidget;
|
||||
class WidgetsSharedHelper;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetPrivate : public QObject
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
#include "framelesswidgetshelper.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
struct WidgetsHelperData;
|
||||
class FramelessWidgetsHelper;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelperPrivate : public QObject
|
||||
{
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
#include "standardsystembutton.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QEnterEvent;
|
||||
|
@ -35,8 +36,6 @@ QT_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class StandardSystemButton;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API StandardSystemButtonPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
#include "standardtitlebar.h"
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
|
@ -34,7 +35,6 @@ QT_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class StandardTitleBar;
|
||||
class StandardSystemButton;
|
||||
class ChromePalette;
|
||||
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "framelesshelperwidgets_global.h"
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include "standardsystembutton.h"
|
||||
#include <chromepalette.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
@ -34,7 +35,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
Q_DECLARE_LOGGING_CATEGORY(lcStandardTitleBar)
|
||||
|
||||
class StandardTitleBarPrivate;
|
||||
class StandardSystemButton;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API StandardTitleBar : public QWidget
|
||||
{
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
QT += core core-private gui gui-private
|
||||
|
||||
CORE_PUB_INC_DIR = $$PWD/../include/FramelessHelper/Core
|
||||
CORE_PRIV_INC_DIR = $$CORE_PUB_INC_DIR/private
|
||||
CORE_EXTRA_INC_DIR = $$PWD/inc/core
|
||||
CORE_SRC_DIR = $$PWD/../src/core
|
||||
|
||||
DEFINES += \
|
||||
FRAMELESSHELPER_CORE_STATIC
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_PUB_INC_DIR \
|
||||
$$CORE_PRIV_INC_DIR \
|
||||
$$CORE_EXTRA_INC_DIR
|
||||
|
||||
DEPENDPATH += \
|
||||
$$CORE_PUB_INC_DIR \
|
||||
$$CORE_PRIV_INC_DIR \
|
||||
$$CORE_EXTRA_INC_DIR
|
||||
|
||||
HEADERS += \
|
||||
$$CORE_EXTRA_INC_DIR/framelesshelper.version \
|
||||
$$CORE_PUB_INC_DIR/chromepalette.h \
|
||||
$$CORE_PUB_INC_DIR/framelesshelper_qt.h \
|
||||
$$CORE_PUB_INC_DIR/framelesshelpercore_global.h \
|
||||
$$CORE_PUB_INC_DIR/framelessmanager.h \
|
||||
$$CORE_PUB_INC_DIR/micamaterial.h \
|
||||
$$CORE_PUB_INC_DIR/utils.h \
|
||||
$$CORE_PRIV_INC_DIR/chromepalette_p.h \
|
||||
$$CORE_PRIV_INC_DIR/framelessconfig_p.h \
|
||||
$$CORE_PRIV_INC_DIR/framelessmanager_p.h \
|
||||
$$CORE_PRIV_INC_DIR/micamaterial_p.h \
|
||||
$$CORE_PRIV_INC_DIR/registrykey_p.h \
|
||||
$$CORE_PRIV_INC_DIR/sysapiloader_p.h
|
||||
|
||||
SOURCES += \
|
||||
$$CORE_SRC_DIR/chromepalette.cpp \
|
||||
$$CORE_SRC_DIR/framelessconfig.cpp \
|
||||
$$CORE_SRC_DIR/framelesshelper_qt.cpp \
|
||||
$$CORE_SRC_DIR/framelessmanager.cpp \
|
||||
$$CORE_SRC_DIR/framelesshelpercore_global.cpp \
|
||||
$$CORE_SRC_DIR/micamaterial.cpp \
|
||||
$$CORE_SRC_DIR/registrykey.cpp \
|
||||
$$CORE_SRC_DIR/sysapiloader.cpp \
|
||||
$$CORE_SRC_DIR/utils.cpp
|
||||
|
||||
RESOURCES += \
|
||||
$$CORE_SRC_DIR/framelesshelpercore.qrc
|
||||
|
||||
win32 {
|
||||
HEADERS += \
|
||||
$$CORE_PUB_INC_DIR/framelesshelper_win.h \
|
||||
$$CORE_PUB_INC_DIR/framelesshelper_windows.h
|
||||
SOURCES += \
|
||||
$$CORE_SRC_DIR/framelesshelper_win.cpp \
|
||||
$$CORE_SRC_DIR/utils_win.cpp
|
||||
LIBS += -luser32 -lgdi32
|
||||
}
|
||||
|
||||
unix:!macx {
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += gtk+-3.0
|
||||
DEFINES += GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6
|
||||
SOURCES += $$CORE_SRC_DIR/utils_linux.cpp
|
||||
#LIBS += -lxcb # TODO
|
||||
}
|
||||
|
||||
macx {
|
||||
SOURCES += $$CORE_SRC_DIR/utils_mac.mm
|
||||
#LIBS += "-framework AppKit" "-framework Cocoa" "-framework Foundation" # TODO
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (C) 2022 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 QMake.
|
||||
// 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.
|
||||
|
||||
#ifndef _FRAMELESSHELPER_VERSION_DEFINED_
|
||||
#define _FRAMELESSHELPER_VERSION_DEFINED_
|
||||
|
||||
#pragma once
|
||||
|
||||
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_MAJOR = 2;
|
||||
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_MINOR = 2;
|
||||
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_PATCH = 0;
|
||||
[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_TWEAK = 0;
|
||||
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_VERSION_STR[] = "2.2.0.0\0";
|
||||
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "UNKNOWN\0";
|
||||
[[maybe_unused]] static constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "UNKNOWN\0";
|
||||
|
||||
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
|
@ -0,0 +1,47 @@
|
|||
QT += \
|
||||
quick quick-private \
|
||||
quicktemplates2 quicktemplates2-private \
|
||||
quickcontrols2 quickcontrols2-private
|
||||
|
||||
QUICK_PUB_INC_DIR = $$PWD/../include/FramelessHelper/Quick
|
||||
QUICK_PRIV_INC_DIR = $$QUICK_PUB_INC_DIR/private
|
||||
QUICK_SRC_DIR = $$PWD/../src/quick
|
||||
|
||||
DEFINES += \
|
||||
FRAMELESSHELPER_QUICK_STATIC
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$QUICK_PUB_INC_DIR \
|
||||
$$QUICK_PRIV_INC_DIR
|
||||
|
||||
DEPENDPATH += \
|
||||
$$QUICK_PUB_INC_DIR \
|
||||
$$QUICK_PRIV_INC_DIR
|
||||
|
||||
HEADERS += \
|
||||
$$QUICK_PUB_INC_DIR/framelesshelperquick_global.h \
|
||||
$$QUICK_PUB_INC_DIR/framelessquickmodule.h \
|
||||
$$QUICK_PUB_INC_DIR/framelessquickhelper.h \
|
||||
$$QUICK_PUB_INC_DIR/framelessquickutils.h \
|
||||
$$QUICK_PUB_INC_DIR/quickchromepalette.h \
|
||||
$$QUICK_PUB_INC_DIR/quickmicamaterial.h \
|
||||
$$QUICK_PUB_INC_DIR/quickimageitem.h \
|
||||
$$QUICK_PRIV_INC_DIR/quickstandardsystembutton_p.h \
|
||||
$$QUICK_PRIV_INC_DIR/quickstandardtitlebar_p.h \
|
||||
$$QUICK_PRIV_INC_DIR/framelessquickhelper_p.h \
|
||||
$$QUICK_PRIV_INC_DIR/framelessquickwindow_p.h \
|
||||
$$QUICK_PRIV_INC_DIR/framelessquickwindow_p_p.h \
|
||||
$$QUICK_PRIV_INC_DIR/quickmicamaterial_p.h \
|
||||
$$QUICK_PRIV_INC_DIR/quickimageitem_p.h
|
||||
|
||||
SOURCES += \
|
||||
$$QUICK_SRC_DIR/quickstandardsystembutton.cpp \
|
||||
$$QUICK_SRC_DIR/quickstandardtitlebar.cpp \
|
||||
$$QUICK_SRC_DIR/framelessquickutils.cpp \
|
||||
$$QUICK_SRC_DIR/framelessquickmodule.cpp \
|
||||
$$QUICK_SRC_DIR/framelessquickwindow.cpp \
|
||||
$$QUICK_SRC_DIR/framelessquickhelper.cpp \
|
||||
$$QUICK_SRC_DIR/quickchromepalette.cpp \
|
||||
$$QUICK_SRC_DIR/framelesshelperquick_global.cpp \
|
||||
$$QUICK_SRC_DIR/quickmicamaterial.cpp \
|
||||
$$QUICK_SRC_DIR/quickimageitem.cpp
|
|
@ -0,0 +1,39 @@
|
|||
QT += widgets widgets-private
|
||||
|
||||
WIDGETS_PUB_INC_DIR = $$PWD/../include/FramelessHelper/Widgets
|
||||
WIDGETS_PRIV_INC_DIR = $$WIDGETS_PUB_INC_DIR/private
|
||||
WIDGETS_SRC_DIR = $$PWD/../src/widgets
|
||||
|
||||
DEFINES += \
|
||||
FRAMELESSHELPER_WIDGETS_STATIC
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$WIDGETS_PUB_INC_DIR \
|
||||
$$WIDGETS_PRIV_INC_DIR
|
||||
|
||||
DEPENDPATH += \
|
||||
$$WIDGETS_PUB_INC_DIR \
|
||||
$$WIDGETS_PRIV_INC_DIR
|
||||
|
||||
HEADERS += \
|
||||
$$WIDGETS_PUB_INC_DIR/framelesshelperwidgets_global.h \
|
||||
$$WIDGETS_PUB_INC_DIR/framelesswidget.h \
|
||||
$$WIDGETS_PUB_INC_DIR/framelessmainwindow.h \
|
||||
$$WIDGETS_PUB_INC_DIR/standardsystembutton.h \
|
||||
$$WIDGETS_PUB_INC_DIR/framelesswidgetshelper.h \
|
||||
$$WIDGETS_PUB_INC_DIR/standardtitlebar.h \
|
||||
$$WIDGETS_PRIV_INC_DIR/framelesswidgetshelper_p.h \
|
||||
$$WIDGETS_PRIV_INC_DIR/standardsystembutton_p.h \
|
||||
$$WIDGETS_PRIV_INC_DIR/standardtitlebar_p.h \
|
||||
$$WIDGETS_PRIV_INC_DIR/framelesswidget_p.h \
|
||||
$$WIDGETS_PRIV_INC_DIR/framelessmainwindow_p.h \
|
||||
$$WIDGETS_PRIV_INC_DIR/widgetssharedhelper_p.h
|
||||
|
||||
SOURCES += \
|
||||
$$WIDGETS_SRC_DIR/framelessmainwindow.cpp \
|
||||
$$WIDGETS_SRC_DIR/framelesswidgetshelper.cpp \
|
||||
$$WIDGETS_SRC_DIR/framelesswidget.cpp \
|
||||
$$WIDGETS_SRC_DIR/standardsystembutton.cpp \
|
||||
$$WIDGETS_SRC_DIR/standardtitlebar.cpp \
|
||||
$$WIDGETS_SRC_DIR/widgetssharedhelper.cpp \
|
||||
$$WIDGETS_SRC_DIR/framelesshelperwidgets_global.cpp
|
|
@ -65,14 +65,13 @@ set(PRIVATE_HEADERS
|
|||
)
|
||||
|
||||
set(SOURCES
|
||||
framelesshelpercore.qrc
|
||||
utils.cpp
|
||||
framelesshelper_qt.cpp
|
||||
framelessmanager.cpp
|
||||
framelessconfig.cpp
|
||||
sysapiloader.cpp
|
||||
chromepalette.cpp
|
||||
global.cpp
|
||||
framelesshelpercore_global.cpp
|
||||
micamaterial.cpp
|
||||
)
|
||||
|
||||
|
@ -119,6 +118,20 @@ endif()
|
|||
add_library(${PROJECT_NAME}::${SUB_PROJ_NAME} ALIAS ${SUB_PROJ_NAME})
|
||||
add_library(${PROJECT_NAME}::${SUB_MOD_NAME} ALIAS ${SUB_PROJ_NAME})
|
||||
|
||||
if(${QT_VERSION} VERSION_GREATER_EQUAL 6.2)
|
||||
qt_add_resources(${SUB_PROJ_NAME} framelesshelpercore
|
||||
PREFIX
|
||||
"/org.wangwenx190.${PROJECT_NAME}"
|
||||
FILES
|
||||
"resources/fonts/Micon.ttf"
|
||||
"resources/images/noise.png"
|
||||
)
|
||||
else()
|
||||
target_sources(${SUB_PROJ_NAME} PRIVATE
|
||||
framelesshelpercore.qrc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
||||
target_compile_definitions(${SUB_PROJ_NAME} PUBLIC
|
||||
FRAMELESSHELPER_CORE_STATIC
|
||||
|
|
|
@ -95,12 +95,11 @@ void FramelessHelperQt::addWindow(const SystemParameters ¶ms)
|
|||
params.setWindowFlags(params.getWindowFlags() | Qt::FramelessWindowHint);
|
||||
}
|
||||
window->installEventFilter(data.eventFilter);
|
||||
#if (defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0)))
|
||||
Utils::registerThemeChangeNotification();
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
Utils::setSystemTitleBarVisible(windowId, false);
|
||||
#endif
|
||||
static const bool isQtQuickApplication = (params.getCurrentApplicationType() == ApplicationType::Quick);
|
||||
FramelessHelper::Core::setApplicationOSThemeAware(true, isQtQuickApplication);
|
||||
}
|
||||
|
||||
bool FramelessHelperQt::eventFilter(QObject *object, QEvent *event)
|
||||
|
|
|
@ -133,22 +133,23 @@ Q_GLOBAL_STATIC(Win32Helper, g_win32Helper)
|
|||
((uMsg >= WM_NCMOUSEMOVE) && (uMsg <= WM_NCXBUTTONDBLCLK)));
|
||||
const auto releaseButtons = [&data](const std::optional<SystemButtonType> exclude) -> void {
|
||||
static constexpr const auto defaultButtonState = ButtonState::Unspecified;
|
||||
if (!exclude.has_value() || (exclude.value() != SystemButtonType::WindowIcon)) {
|
||||
const SystemButtonType button = exclude.value_or(SystemButtonType::Unknown);
|
||||
if (button != SystemButtonType::WindowIcon) {
|
||||
data.params.setSystemButtonState(SystemButtonType::WindowIcon, defaultButtonState);
|
||||
}
|
||||
if (!exclude.has_value() || (exclude.value() != SystemButtonType::Help)) {
|
||||
if (button != SystemButtonType::Help) {
|
||||
data.params.setSystemButtonState(SystemButtonType::Help, defaultButtonState);
|
||||
}
|
||||
if (!exclude.has_value() || (exclude.value() != SystemButtonType::Minimize)) {
|
||||
if (button != SystemButtonType::Minimize) {
|
||||
data.params.setSystemButtonState(SystemButtonType::Minimize, defaultButtonState);
|
||||
}
|
||||
if (!exclude.has_value() || (exclude.value() != SystemButtonType::Maximize)) {
|
||||
if (button != SystemButtonType::Maximize) {
|
||||
data.params.setSystemButtonState(SystemButtonType::Maximize, defaultButtonState);
|
||||
}
|
||||
if (!exclude.has_value() || (exclude.value() != SystemButtonType::Restore)) {
|
||||
if (button != SystemButtonType::Restore) {
|
||||
data.params.setSystemButtonState(SystemButtonType::Restore, defaultButtonState);
|
||||
}
|
||||
if (!exclude.has_value() || (exclude.value() != SystemButtonType::Close)) {
|
||||
if (button != SystemButtonType::Close) {
|
||||
data.params.setSystemButtonState(SystemButtonType::Close, defaultButtonState);
|
||||
}
|
||||
};
|
||||
|
@ -521,13 +522,7 @@ void FramelessHelperWin::addWindow(const SystemParameters ¶ms)
|
|||
const bool dark = Utils::shouldAppsUseDarkMode();
|
||||
static const bool isQtQuickApplication = (params.getCurrentApplicationType() == ApplicationType::Quick);
|
||||
// Tell DWM we may need dark theme non-client area (title bar & frame border).
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
static bool darkModeAwareSet = false;
|
||||
if (!darkModeAwareSet) {
|
||||
darkModeAwareSet = true;
|
||||
Utils::setQtDarkModeAwareEnabled(true, isQtQuickApplication);
|
||||
}
|
||||
#endif
|
||||
FramelessHelper::Core::setApplicationOSThemeAware(true, isQtQuickApplication);
|
||||
Utils::updateWindowFrameBorderColor(windowId, dark);
|
||||
static const bool isWin10RS5OrGreater = Utils::isWindowsVersionOrGreater(WindowsVersion::_10_1809);
|
||||
if (isWin10RS5OrGreater) {
|
||||
|
|
|
@ -274,6 +274,26 @@ void registerUninitializeHook(const UninitializeHookCallback &cb)
|
|||
coreData()->uninitHooks.append(cb);
|
||||
}
|
||||
|
||||
void setApplicationOSThemeAware(const bool enable, const bool pureQuick)
|
||||
{
|
||||
Q_UNUSED(enable);
|
||||
Q_UNUSED(pureQuick);
|
||||
|
||||
static bool set = false;
|
||||
if (set) {
|
||||
return;
|
||||
}
|
||||
set = true;
|
||||
|
||||
#if (defined(Q_OS_WINDOWS) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
Utils::setQtDarkModeAwareEnabled(enable, pureQuick);
|
||||
#endif
|
||||
|
||||
#if (defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0)))
|
||||
Utils::registerThemeChangeNotification();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "registrykey_p.h"
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
# include <QtCore/private/qwinregistry_p.h>
|
||||
#else
|
||||
|
|
|
@ -576,9 +576,8 @@ bool Utils::isDwmCompositionEnabled()
|
|||
if (!registry.isValid()) {
|
||||
return false;
|
||||
}
|
||||
bool ok = false;
|
||||
const DWORD value = registry.value(kComposition).toULongLong(&ok);
|
||||
return (ok && (value != 0));
|
||||
const DWORD value = registry.value<DWORD>(kComposition).value_or(0);
|
||||
return (value != 0);
|
||||
};
|
||||
if (!API_DWM_AVAILABLE(DwmIsCompositionEnabled)) {
|
||||
return resultFromRegistry();
|
||||
|
@ -702,9 +701,8 @@ QColor Utils::getDwmColorizationColor()
|
|||
if (!registry.isValid()) {
|
||||
return kDefaultDarkGrayColor;
|
||||
}
|
||||
bool ok = false;
|
||||
const DWORD value = registry.value(kColorizationColor).toULongLong(&ok);
|
||||
return (ok ? QColor::fromRgba(value) : kDefaultDarkGrayColor);
|
||||
const DWORD value = registry.value<DWORD>(kColorizationColor).value_or(0);
|
||||
return QColor::fromRgba(value);
|
||||
};
|
||||
if (!API_DWM_AVAILABLE(DwmGetColorizationColor)) {
|
||||
return resultFromRegistry();
|
||||
|
@ -727,13 +725,11 @@ DwmColorizationArea Utils::getDwmColorizationArea()
|
|||
return DwmColorizationArea::None_;
|
||||
}
|
||||
const RegistryKey themeRegistry(RegistryRootKey::CurrentUser, personalizeRegistryKey());
|
||||
bool themeOk = false;
|
||||
const DWORD themeValue = themeRegistry.isValid() ? themeRegistry.value(qDwmColorKeyName).toULongLong(&themeOk) : 0;
|
||||
const DWORD themeValue = themeRegistry.isValid() ? themeRegistry.value<DWORD>(qDwmColorKeyName).value_or(0) : 0;
|
||||
const RegistryKey dwmRegistry(RegistryRootKey::CurrentUser, dwmRegistryKey());
|
||||
bool dwmOk = false;
|
||||
const DWORD dwmValue = dwmRegistry.isValid() ? dwmRegistry.value(qDwmColorKeyName).toULongLong(&dwmOk) : 0;
|
||||
const bool theme = (themeOk && (themeValue != 0));
|
||||
const bool dwm = (dwmOk && (dwmValue != 0));
|
||||
const DWORD dwmValue = dwmRegistry.isValid() ? dwmRegistry.value<DWORD>(qDwmColorKeyName).value_or(0) : 0;
|
||||
const bool theme = (themeValue != 0);
|
||||
const bool dwm = (dwmValue != 0);
|
||||
if (theme && dwm) {
|
||||
return DwmColorizationArea::All;
|
||||
} else if (theme) {
|
||||
|
@ -1518,9 +1514,8 @@ bool Utils::shouldAppsUseDarkMode_windows()
|
|||
if (!registry.isValid()) {
|
||||
return false;
|
||||
}
|
||||
bool ok = false;
|
||||
const DWORD value = registry.value(kAppsUseLightTheme).toULongLong(&ok);
|
||||
return (ok && (value == 0));
|
||||
const DWORD value = registry.value<DWORD>(kAppsUseLightTheme).value_or(0);
|
||||
return (value == 0);
|
||||
};
|
||||
// Starting from Windows 10 1903, "ShouldAppsUseDarkMode()" (exported by UXTHEME.DLL,
|
||||
// ordinal number 132) always return "TRUE" (actually, a random non-zero number at
|
||||
|
@ -1752,11 +1747,7 @@ QColor Utils::getDwmAccentColor()
|
|||
if (!registry.isValid()) {
|
||||
return kDefaultDarkGrayColor;
|
||||
}
|
||||
bool ok = false;
|
||||
const DWORD value = registry.value(kAccentColor).toULongLong(&ok);
|
||||
if (!ok) {
|
||||
return kDefaultDarkGrayColor;
|
||||
}
|
||||
const DWORD value = registry.value<DWORD>(kAccentColor).value_or(0);
|
||||
// The retrieved value is in the #AABBGGRR format, we need to
|
||||
// convert it to the #AARRGGBB format that Qt accepts.
|
||||
const QColor abgr = QColor::fromRgba(value);
|
||||
|
@ -1780,16 +1771,11 @@ WallpaperAspectStyle Utils::getWallpaperAspectStyle()
|
|||
if (!registry.isValid()) {
|
||||
return defaultStyle;
|
||||
}
|
||||
bool ok = false;
|
||||
const DWORD wallpaperStyle = registry.value(kWallpaperStyle).toULongLong(&ok);
|
||||
if (!ok) {
|
||||
return defaultStyle;
|
||||
}
|
||||
const DWORD wallpaperStyle = registry.value<DWORD>(kWallpaperStyle).value_or(0);
|
||||
switch (wallpaperStyle) {
|
||||
case 0: {
|
||||
ok = false;
|
||||
const DWORD tileWallpaper = registry.value(kTileWallpaper).toULongLong(&ok);
|
||||
if (ok && (tileWallpaper != 0)) {
|
||||
const DWORD tileWallpaper = registry.value<DWORD>(kTileWallpaper).value_or(0);
|
||||
if (tileWallpaper != 0) {
|
||||
return WallpaperAspectStyle::Tile;
|
||||
}
|
||||
return WallpaperAspectStyle::Center;
|
||||
|
@ -1860,22 +1846,22 @@ void Utils::setQtDarkModeAwareEnabled(const bool enable, const bool pureQuick)
|
|||
// There's no global dark theme for Qt Quick applications, so setting this
|
||||
// flag has no effect for pure Qt Quick applications.
|
||||
return {App::DarkModeWindowFrames | App::DarkModeStyle};
|
||||
#else
|
||||
#else // (QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
|
||||
if (pureQuick) {
|
||||
// Pure Qt Quick application, it's OK to enable the DarkModeStyle flag.
|
||||
return {App::DarkModeWindowFrames | App::DarkModeStyle};
|
||||
}
|
||||
// Don't try to use the broken dark theme for Qt Widgets applications.
|
||||
return {App::DarkModeWindowFrames};
|
||||
#endif
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
}());
|
||||
} else {
|
||||
WARNING << "QWindowsApplication is not available.";
|
||||
}
|
||||
#else
|
||||
#else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
Q_UNUSED(enable);
|
||||
Q_UNUSED(pureQuick);
|
||||
#endif
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -69,7 +69,7 @@ set(SOURCES
|
|||
framelessquickwindow.cpp
|
||||
framelessquickhelper.cpp
|
||||
quickchromepalette.cpp
|
||||
global.cpp
|
||||
framelesshelperquick_global.cpp
|
||||
quickmicamaterial.cpp
|
||||
quickimageitem.cpp
|
||||
)
|
||||
|
|
|
@ -62,7 +62,7 @@ set(SOURCES
|
|||
standardsystembutton.cpp
|
||||
standardtitlebar.cpp
|
||||
widgetssharedhelper.cpp
|
||||
global.cpp
|
||||
framelesshelperwidgets_global.cpp
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||
|
|
Loading…
Reference in New Issue