mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
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:
parent
750c64f323
commit
6f77a1fe9d
7 changed files with 32 additions and 1 deletions
|
@ -62,6 +62,7 @@ Page {
|
|||
state: "normal"
|
||||
ToolTip.visible: hovered && collapsed
|
||||
ToolTip.text: model.tooltip
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
onClicked: Communities.setCurrentTagId(model.id)
|
||||
onPressAndHold: communityContextMenu.show(model.id)
|
||||
states: [
|
||||
|
@ -123,6 +124,7 @@ Page {
|
|||
width: fontMetrics.lineSpacing
|
||||
image: model.collapsed ? ":/icons/icons/ui/collapsed.svg" : ":/icons/icons/ui/expanded.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: model.collapsed ? qsTr("Expand") : qsTr("Collapse")
|
||||
hoverEnabled: true
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@ TextEdit {
|
|||
color: Nheko.colors.text
|
||||
onLinkActivated: Nheko.openLink(link)
|
||||
ToolTip.visible: hoveredLink || false
|
||||
ToolTip.text: hoveredLink || ""
|
||||
ToolTip.text: hoveredLink
|
||||
// Setting a tooltip delay makes the hover text empty .-.
|
||||
//ToolTip.delay: Nheko.tooltipDelay
|
||||
Component.onCompleted: {
|
||||
TimelineManager.fixImageRendering(r.textDocument, r);
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ ScrollView {
|
|||
hoverEnabled: true
|
||||
image: ":/icons/icons/ui/edit.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Edit")
|
||||
onClicked: {
|
||||
if (row.model.isEditable)
|
||||
|
@ -121,6 +122,7 @@ ScrollView {
|
|||
hoverEnabled: true
|
||||
image: ":/icons/icons/ui/smile.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("React")
|
||||
onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(reactButton, function(emoji) {
|
||||
var event_id = row.model ? row.model.eventId : "";
|
||||
|
@ -137,6 +139,7 @@ ScrollView {
|
|||
hoverEnabled: true
|
||||
image: ":/icons/icons/ui/reply.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Reply")
|
||||
onClicked: chat.model.replyAction(row.model.eventId)
|
||||
}
|
||||
|
@ -148,6 +151,7 @@ ScrollView {
|
|||
hoverEnabled: true
|
||||
image: ":/icons/icons/ui/options.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Options")
|
||||
onClicked: messageContextMenu.show(row.model.eventId, row.model.type, row.model.isSender, row.model.isEncrypted, row.model.isEditable, "", row.model.body, optionsButton)
|
||||
}
|
||||
|
@ -284,6 +288,7 @@ ScrollView {
|
|||
userid: userId
|
||||
onClicked: room.openUserProfile(userId)
|
||||
ToolTip.visible: avatarHover.hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: userid
|
||||
|
||||
HoverHandler {
|
||||
|
@ -311,6 +316,7 @@ ScrollView {
|
|||
color: TimelineManager.userColor(userId, Nheko.colors.base)
|
||||
textFormat: Text.RichText
|
||||
ToolTip.visible: displayNameHover.hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: userId
|
||||
|
||||
TapHandler {
|
||||
|
|
|
@ -140,6 +140,7 @@ Page {
|
|||
width: ListView.view.width
|
||||
state: "normal"
|
||||
ToolTip.visible: hovered && collapsed
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: roomName
|
||||
onClicked: {
|
||||
console.log("tapped " + roomId);
|
||||
|
@ -325,6 +326,7 @@ Page {
|
|||
radius: height / 2
|
||||
color: hasLoudNotification ? Nheko.theme.red : roomItem.bubbleBackground
|
||||
ToolTip.text: notificationCount
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.visible: notificationBubbleHover.hovered && (notificationCount > 9999)
|
||||
|
||||
Label {
|
||||
|
@ -495,6 +497,7 @@ Page {
|
|||
Layout.preferredHeight: fontMetrics.lineSpacing * 2
|
||||
image: ":/icons/icons/ui/power-off.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Logout")
|
||||
onClicked: Nheko.openLogoutDialog()
|
||||
}
|
||||
|
@ -560,6 +563,7 @@ Page {
|
|||
height: fontMetrics.font.pixelSize
|
||||
image: ":/icons/icons/ui/dismiss.svg"
|
||||
ToolTip.visible: closeUnverifiedBubble.hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Close")
|
||||
onClicked: unverifiedStuffBubble.visible = false
|
||||
}
|
||||
|
@ -625,6 +629,7 @@ Page {
|
|||
height: 22
|
||||
image: ":/icons/icons/ui/add-square-button.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Start a new chat")
|
||||
Layout.margins: Nheko.paddingMedium
|
||||
onClicked: roomJoinCreateMenu.open(parent)
|
||||
|
@ -654,6 +659,7 @@ Page {
|
|||
height: 22
|
||||
image: ":/icons/icons/ui/speech-bubbles.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Room directory")
|
||||
Layout.margins: Nheko.paddingMedium
|
||||
onClicked: {
|
||||
|
@ -670,6 +676,7 @@ Page {
|
|||
height: 22
|
||||
image: ":/icons/icons/ui/settings.svg"
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("User settings")
|
||||
Layout.margins: Nheko.paddingMedium
|
||||
onClicked: Nheko.showUserSettingsPage()
|
||||
|
|
|
@ -171,6 +171,7 @@ Item {
|
|||
sourceSize.height: 16 * Screen.devicePixelRatio
|
||||
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
|
||||
ToolTip.visible: editHovered.hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: qsTr("Edited")
|
||||
|
||||
HoverHandler {
|
||||
|
@ -194,6 +195,7 @@ Item {
|
|||
width: Math.max(implicitWidth, text.length * fontMetrics.maximumCharacterWidth)
|
||||
color: Nheko.inactiveColors.text
|
||||
ToolTip.visible: ma.hovered
|
||||
ToolTip.delay: Nheko.tooltipDelay
|
||||
ToolTip.text: Qt.formatDateTime(timestamp, Qt.DefaultLocaleLongDate)
|
||||
|
||||
HoverHandler {
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue