forked from github_mirror/framelesshelper
minor fixes of the last commit
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
463ac0a999
commit
abf4b29dca
|
@ -17,7 +17,7 @@ You can join our [Discord channel](https://discord.gg/grrM4Tmesy) to communicate
|
||||||
|
|
||||||
## Highlights v2.2
|
## Highlights v2.2
|
||||||
|
|
||||||
- Common: Added blur behind window feature for Windows (7~11), Linux and macOS. On Windows 11 and macOS, FramelessHelper will make use of the blur effect provided by the OS to get the best appearance and performance, while on Windows 7~10 and Linux, FramelessHelper will use a homemade blur effect to provide as much consistent experience as possible.
|
- Common: Added blur behind window feature for Windows (7\~11), Linux and macOS. On Windows 11 and macOS, FramelessHelper will make use of the blur effect provided by the OS to get the best appearance and performance, while on Windows 7\~10 and Linux, FramelessHelper will use a homemade blur effect to provide as much consistent experience as possible.
|
||||||
- Common: Added window icon support. It's now possible to set the window icon's image, size and visibility for the standard title bar control.
|
- Common: Added window icon support. It's now possible to set the window icon's image, size and visibility for the standard title bar control.
|
||||||
- Windows: If you are using Qt 6.4+, your Qt Widgets applications will now automatically switch to light/dark theme if the OS theme changes. It requires you are using the default palette provided by Qt. Qt Quick applications will not be affected.
|
- Windows: If you are using Qt 6.4+, your Qt Widgets applications will now automatically switch to light/dark theme if the OS theme changes. It requires you are using the default palette provided by Qt. Qt Quick applications will not be affected.
|
||||||
- Linux: FramelessHelper is now theme-aware. If you change your OS theme, FramelessHelper will now emit the theme change signal and refresh it's internal palette.
|
- Linux: FramelessHelper is now theme-aware. If you change your OS theme, FramelessHelper will now emit the theme change signal and refresh it's internal palette.
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
|
|
||||||
#include <QtWidgets/qapplication.h>
|
#include <QtWidgets/qapplication.h>
|
||||||
#include <framelessconfig_p.h>
|
#include <framelessconfig_p.h>
|
||||||
|
#include <clocale>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||||
|
|
||||||
// Not necessary, but better call this function, before the construction
|
// Not necessary, but better call this function, before the construction
|
||||||
// of any Q(Core|Gui)Application instances.
|
// of any Q(Core|Gui)Application instances.
|
||||||
FramelessHelper::Widgets::initialize();
|
FramelessHelper::Widgets::initialize();
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <framelessconfig_p.h>
|
#include <framelessconfig_p.h>
|
||||||
|
#include <clocale>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
// This example demonstrates easy, cross-platform usage of OpenGL ES 3.0 functions via
|
// This example demonstrates easy, cross-platform usage of OpenGL ES 3.0 functions via
|
||||||
|
@ -67,6 +68,8 @@ FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||||
|
|
||||||
// Not necessary, but better call this function, before the construction
|
// Not necessary, but better call this function, before the construction
|
||||||
// of any Q(Core|Gui)Application instances.
|
// of any Q(Core|Gui)Application instances.
|
||||||
FramelessHelper::Widgets::initialize();
|
FramelessHelper::Widgets::initialize();
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <QtQuickControls2/qquickstyle.h>
|
#include <QtQuickControls2/qquickstyle.h>
|
||||||
#include <framelessquickmodule.h>
|
#include <framelessquickmodule.h>
|
||||||
#include <framelessconfig_p.h>
|
#include <framelessconfig_p.h>
|
||||||
|
#include <clocale>
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#if QMLTC_ENABLED
|
#if QMLTC_ENABLED
|
||||||
# include <mainwindow.h>
|
# include <mainwindow.h>
|
||||||
|
@ -42,6 +43,8 @@ FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||||
|
|
||||||
// Not necessary, but better call this function, before the construction
|
// Not necessary, but better call this function, before the construction
|
||||||
// of any Q(Core|Gui)Application instances.
|
// of any Q(Core|Gui)Application instances.
|
||||||
FramelessHelper::Quick::initialize();
|
FramelessHelper::Quick::initialize();
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
|
|
||||||
#include <QtWidgets/qapplication.h>
|
#include <QtWidgets/qapplication.h>
|
||||||
#include <framelessconfig_p.h>
|
#include <framelessconfig_p.h>
|
||||||
|
#include <clocale>
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||||
|
|
||||||
// Not necessary, but better call this function, before the construction
|
// Not necessary, but better call this function, before the construction
|
||||||
// of any Q(Core|Gui)Application instances.
|
// of any Q(Core|Gui)Application instances.
|
||||||
FramelessHelper::Widgets::initialize();
|
FramelessHelper::Widgets::initialize();
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include <QtCore/qobject.h>
|
#include <QtCore/qobject.h>
|
||||||
#include <QtCore/qpointer.h>
|
#include <QtCore/qpointer.h>
|
||||||
#include <QtCore/qvariant.h>
|
#include <QtCore/qvariant.h>
|
||||||
#include <QtGui/qpixmap.h>
|
|
||||||
#include <QtGui/qicon.h>
|
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -48,25 +46,23 @@ public:
|
||||||
Q_NODISCARD static QuickImageItemPrivate *get(QuickImageItem *q);
|
Q_NODISCARD static QuickImageItemPrivate *get(QuickImageItem *q);
|
||||||
Q_NODISCARD static const QuickImageItemPrivate *get(const QuickImageItem *q);
|
Q_NODISCARD static const QuickImageItemPrivate *get(const QuickImageItem *q);
|
||||||
|
|
||||||
void paint(QPainter *painter);
|
void paint(QPainter *painter) const;
|
||||||
|
|
||||||
Q_NODISCARD QVariant source() const;
|
Q_NODISCARD QVariant source() const;
|
||||||
void setSource(const QVariant &value);
|
void setSource(const QVariant &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize();
|
void initialize();
|
||||||
void fromUrl(const QUrl &value, QPainter *painter);
|
void fromUrl(const QUrl &value, QPainter *painter) const;
|
||||||
void fromString(const QString &value, QPainter *painter);
|
void fromString(const QString &value, QPainter *painter) const;
|
||||||
void fromImage(const QImage &value, QPainter *painter);
|
void fromImage(const QImage &value, QPainter *painter) const;
|
||||||
void fromPixmap(const QPixmap &value, QPainter *painter);
|
void fromPixmap(const QPixmap &value, QPainter *painter) const;
|
||||||
void fromIcon(const QIcon &value, QPainter *painter);
|
void fromIcon(const QIcon &value, QPainter *painter) const;
|
||||||
Q_NODISCARD QRect paintArea() const;
|
Q_NODISCARD QRect paintArea() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<QuickImageItem> q_ptr = nullptr;
|
QPointer<QuickImageItem> q_ptr = nullptr;
|
||||||
QVariant m_source = {};
|
QVariant m_source = {};
|
||||||
QPixmap m_pixmap = {};
|
|
||||||
QIcon m_icon = {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtGui/qpainter.h>
|
#include <QtGui/qpainter.h>
|
||||||
#include <QtGui/qimage.h>
|
#include <QtGui/qimage.h>
|
||||||
|
#include <QtGui/qpixmap.h>
|
||||||
|
#include <QtGui/qicon.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -73,7 +75,7 @@ const QuickImageItemPrivate *QuickImageItemPrivate::get(const QuickImageItem *q)
|
||||||
return q->d_func();
|
return q->d_func();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItemPrivate::paint(QPainter *painter)
|
void QuickImageItemPrivate::paint(QPainter *painter) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(painter);
|
Q_ASSERT(painter);
|
||||||
if (!painter) {
|
if (!painter) {
|
||||||
|
@ -137,7 +139,7 @@ void QuickImageItemPrivate::initialize()
|
||||||
q->setClip(true);
|
q->setClip(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromUrl(const QUrl &value, QPainter *painter)
|
void QuickImageItemPrivate::fromUrl(const QUrl &value, QPainter *painter) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(value.isValid());
|
Q_ASSERT(value.isValid());
|
||||||
Q_ASSERT(painter);
|
Q_ASSERT(painter);
|
||||||
|
@ -147,7 +149,7 @@ void QuickImageItemPrivate::fromUrl(const QUrl &value, QPainter *painter)
|
||||||
fromString((value.isLocalFile() ? value.toLocalFile() : value.toString()), painter);
|
fromString((value.isLocalFile() ? value.toLocalFile() : value.toString()), painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter)
|
void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!value.isEmpty());
|
Q_ASSERT(!value.isEmpty());
|
||||||
Q_ASSERT(painter);
|
Q_ASSERT(painter);
|
||||||
|
@ -155,6 +157,9 @@ void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return fromPixmap(QPixmap([&value]() -> QString {
|
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;
|
QString path = value;
|
||||||
if (path.startsWith(kQrcPrefix, Qt::CaseInsensitive)) {
|
if (path.startsWith(kQrcPrefix, Qt::CaseInsensitive)) {
|
||||||
path.replace(kQrcPrefix, kFileSystemPrefix, Qt::CaseInsensitive);
|
path.replace(kQrcPrefix, kFileSystemPrefix, Qt::CaseInsensitive);
|
||||||
|
@ -166,7 +171,7 @@ void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter)
|
||||||
}()), painter);
|
}()), painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromImage(const QImage &value, QPainter *painter)
|
void QuickImageItemPrivate::fromImage(const QImage &value, QPainter *painter) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!value.isNull());
|
Q_ASSERT(!value.isNull());
|
||||||
Q_ASSERT(painter);
|
Q_ASSERT(painter);
|
||||||
|
@ -176,7 +181,7 @@ void QuickImageItemPrivate::fromImage(const QImage &value, QPainter *painter)
|
||||||
fromPixmap(QPixmap::fromImage(value), painter);
|
fromPixmap(QPixmap::fromImage(value), painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromPixmap(const QPixmap &value, QPainter *painter)
|
void QuickImageItemPrivate::fromPixmap(const QPixmap &value, QPainter *painter) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!value.isNull());
|
Q_ASSERT(!value.isNull());
|
||||||
Q_ASSERT(painter);
|
Q_ASSERT(painter);
|
||||||
|
@ -186,7 +191,7 @@ void QuickImageItemPrivate::fromPixmap(const QPixmap &value, QPainter *painter)
|
||||||
painter->drawPixmap(paintArea(), value);
|
painter->drawPixmap(paintArea(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickImageItemPrivate::fromIcon(const QIcon &value, QPainter *painter)
|
void QuickImageItemPrivate::fromIcon(const QIcon &value, QPainter *painter) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!value.isNull());
|
Q_ASSERT(!value.isNull());
|
||||||
Q_ASSERT(painter);
|
Q_ASSERT(painter);
|
||||||
|
|
Loading…
Reference in New Issue