Skip to content

Commit

Permalink
chore: dplatformhandle tweak
Browse files Browse the repository at this point in the history
1. check systemtheme is valid
2. typo fix. CreatorWindowEventFile==>WindowCreateEvenFilter
  • Loading branch information
kegechen committed Jan 22, 2024
1 parent 01af1cb commit 3993d86
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/kernel/dplatformhandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ static void initWindowRadius(QWindow *window)
return;

auto theme = DGuiApplicationHelper::instance()->systemTheme();
if (!theme->isValid())
return;

int radius = theme->windowRadius(18); //###(zccrs): 暂时在此处给窗口默认设置为18px的圆角

setWindowProperty(window, _windowRadius, radius);
Expand All @@ -604,9 +607,9 @@ static void initWindowRadius(QWindow *window)
}
}

class Q_DECL_HIDDEN CreatorWindowEventFile : public QObject {
class Q_DECL_HIDDEN WindowCreateEvenFilter : public QObject {
public:
CreatorWindowEventFile(QObject *par= nullptr): QObject(par){}
WindowCreateEvenFilter(QObject *par= nullptr) : QObject(par){}

public:
bool eventFilter(QObject *watched, QEvent *event) override {
Expand Down Expand Up @@ -657,7 +660,7 @@ bool DPlatformHandle::setEnabledNoTitlebarForWindow(QWindow *window, bool enable
if (window->handle()) {
initWindowRadius(window);
} else {
window->installEventFilter(new CreatorWindowEventFile(window));
window->installEventFilter(new WindowCreateEvenFilter(window));
}
}

Expand Down

0 comments on commit 3993d86

Please sign in to comment.