https://bugs.kde.org/show_bug.cgi?id=388087

--- Comment #1 from Nate Graham <pointedst...@zoho.com> ---
Something seems not quite right, since browsing the code, kirigami's
showPassiveNotification() function is supposed to use a timeout of 4500ms by
default if no timeout value is specified, and Discover invokes the method
without a timeout argument:

QMetaObject::invokeMethod(rootObject(), "showPassiveNotification",
Qt::QueuedConnection, Q_ARG(QVariant, msg), Q_ARG(QVariant, {}),
Q_ARG(QVariant, {}), Q_ARG(QVariant, {}));


I tried removing the timer wrapping it:


diff --git a/discover/DiscoverMainWindow.cpp b/discover/DiscoverMainWindow.cpp
index 247268f..83436cd 100644
--- a/discover/DiscoverMainWindow.cpp
+++ b/discover/DiscoverMainWindow.cpp
@@ -401,7 +401,5 @@ QWindow* DiscoverMainWindow::rootObject() const

 void DiscoverMainWindow::showPassiveNotification(const QString& msg)
 {
-    QTimer::singleShot(100, this, [this, msg](){
-        QMetaObject::invokeMethod(rootObject(), "showPassiveNotification",
Qt::QueuedConnection, Q_ARG(QVariant, msg), Q_ARG(QVariant, {}),
Q_ARG(QVariant, {}), Q_ARG(QVariant, {}));
-    });
+    QMetaObject::invokeMethod(rootObject(), "showPassiveNotification",
Qt::QueuedConnection, Q_ARG(QVariant, msg), Q_ARG(QVariant, {}),
Q_ARG(QVariant, {}), Q_ARG(QVariant, {}));
 }



Then I tried manually specifying a "long" timeout:

diff --git a/discover/DiscoverMainWindow.cpp b/discover/DiscoverMainWindow.cpp
index 247268f..8c46aa2 100644
--- a/discover/DiscoverMainWindow.cpp
+++ b/discover/DiscoverMainWindow.cpp
@@ -401,7 +401,5 @@ QWindow* DiscoverMainWindow::rootObject() const

 void DiscoverMainWindow::showPassiveNotification(const QString& msg)
 {
-    QTimer::singleShot(100, this, [this, msg](){
-        QMetaObject::invokeMethod(rootObject(), "showPassiveNotification",
Qt::QueuedConnection, Q_ARG(QVariant, msg), Q_ARG(QVariant, {}),
Q_ARG(QVariant, {}), Q_ARG(QVariant, {}));
-    });
+    QMetaObject::invokeMethod(rootObject(), "showPassiveNotification",
Qt::QueuedConnection, Q_ARG(QVariant, msg), Q_ARG(QVariant,
QStringLiteral("long")), Q_ARG(QVariant, {}), Q_ARG(QVariant, {}));
 }



Both of them just made the notifications disappear almost instantly; it seems
like the timeout was always getting set to 0 or something.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to