From 700214372ece10c6676cb0cea09daca9fa27ac86 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Tue, 23 Jan 2024 02:01:17 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkgui Synchronize source files from linuxdeepin/dtkgui. Source-pull-request: https://github.com/linuxdeepin/dtkgui/pull/220 --- src/kernel/dplatformhandle.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/kernel/dplatformhandle.cpp b/src/kernel/dplatformhandle.cpp index f3e5c92..110a989 100644 --- a/src/kernel/dplatformhandle.cpp +++ b/src/kernel/dplatformhandle.cpp @@ -588,9 +588,10 @@ static void initWindowRadius(QWindow *window) return; auto theme = DGuiApplicationHelper::instance()->systemTheme(); - int radius = theme->windowRadius(18); //###(zccrs): 暂时在此处给窗口默认设置为18px的圆角 - - setWindowProperty(window, _windowRadius, radius); + if (theme->isValid()) { + int radius = theme->windowRadius(18); //###(zccrs): 暂时在此处给窗口默认设置为18px的圆角 + setWindowProperty(window, _windowRadius, radius); + } // Qt::UniqueConnection will report a warning // to `unique connections require a pointer to member function of a QObject subclass`. const char *uniqueueConnectionFlag("_d_uniqueueConnectionFlag"); @@ -604,9 +605,9 @@ static void initWindowRadius(QWindow *window) } } -class Q_DECL_HIDDEN CreatorWindowEventFile : public QObject { +class Q_DECL_HIDDEN WindowCreateEventFilter : public QObject { public: - CreatorWindowEventFile(QObject *par= nullptr): QObject(par){} + WindowCreateEventFilter(QObject *par= nullptr) : QObject(par){} public: bool eventFilter(QObject *watched, QEvent *event) override { @@ -657,7 +658,7 @@ bool DPlatformHandle::setEnabledNoTitlebarForWindow(QWindow *window, bool enable if (window->handle()) { initWindowRadius(window); } else { - window->installEventFilter(new CreatorWindowEventFile(window)); + window->installEventFilter(new WindowCreateEventFilter(window)); } }