Use the styles default delay for tooltips

This makes them less annoying when scrolling or accessing the popup
menu.

See also #860
This commit is contained in:
Nicolas Werner 2021-12-31 00:47:14 +01:00
parent 750c64f323
commit 6f77a1fe9d
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
7 changed files with 32 additions and 1 deletions

View file

@ -4,7 +4,9 @@
#include "NhekoGlobalObject.h"
#include <QApplication>
#include <QDesktopServices>
#include <QStyle>
#include <QUrl>
#include <QWindow>
@ -75,6 +77,12 @@ Nheko::theme() const
return Theme(UserSettings::instance()->theme());
}
int
Nheko::tooltipDelay() const
{
return QApplication::style()->styleHint(QStyle::StyleHint::SH_ToolTip_WakeUpDelay);
}
void
Nheko::openLink(QString link) const
{

View file

@ -24,6 +24,7 @@ class Nheko : public QObject
Q_PROPERTY(int paddingSmall READ paddingSmall CONSTANT)
Q_PROPERTY(int paddingMedium READ paddingMedium CONSTANT)
Q_PROPERTY(int paddingLarge READ paddingLarge CONSTANT)
Q_PROPERTY(int tooltipDelay READ tooltipDelay CONSTANT)
Q_PROPERTY(UserProfile *currentUser READ currentUser NOTIFY profileChanged)
@ -39,6 +40,9 @@ public:
int paddingSmall() const { return 4; }
int paddingMedium() const { return 8; }
int paddingLarge() const { return 20; }
int tooltipDelay() const;
UserProfile *currentUser() const;
Q_INVOKABLE QFont monospaceFont() const