From 5ee113e2c4f916b1078ace782bb130f5edf64bcf Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: ćšć, 14 12æ 2023 20:28:02 +0800 Subject: [PATCH] minor tweaks --- examples/mainwindow/mainwindow.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index 882dc9b..da44b23 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -169,18 +169,18 @@ #ifdef Q_OS_WINDOWS // Emulate Window system menu button behaviors - connect(iconButton, &QAbstractButton::clicked, agent, [this, iconButton, agent] { - setProperty("double-click-close", false); + connect(iconButton, &QAbstractButton::clicked, this, [iconButton, agent] { + iconButton->setProperty("double-click-close", false); // Pick a suitable time threshold - QTimer::singleShot(75, this, [this, iconButton, agent]() { - if (property("double-click-close").toBool()) + QTimer::singleShot(75, [iconButton, agent]() { + if (iconButton->property("double-click-close").toBool()) return; - agent->showSystemMenu(iconButton->mapToGlobal({0, iconButton->height()})); + agent->showSystemMenu(iconButton->mapToGlobal(QPoint{0, iconButton->height()})); }); }); - connect(iconButton, &QWK::WindowButton::doubleClicked, this, [this]() { - setProperty("double-click-close", true); + connect(iconButton, &QWK::WindowButton::doubleClicked, this, [iconButton, this]() { + iconButton->setProperty("double-click-close", true); close(); }); #endif @@ -195,7 +195,7 @@ // It's a Qt issue that if a QAbstractButton::clicked triggers a window's maximization, // the button remains to be hovered until the mouse move. As a result, we need to - // manully send leave events to the button. + // manually send leave events to the button. emulateLeaveEvent(maxButton); }); connect(windowBar, &QWK::WindowBar::closeRequested, this, &QWidget::close); -- Gitblit v1.9.1