mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +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"
|
state: "normal"
|
||||||
ToolTip.visible: hovered && collapsed
|
ToolTip.visible: hovered && collapsed
|
||||||
ToolTip.text: model.tooltip
|
ToolTip.text: model.tooltip
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
onClicked: Communities.setCurrentTagId(model.id)
|
onClicked: Communities.setCurrentTagId(model.id)
|
||||||
onPressAndHold: communityContextMenu.show(model.id)
|
onPressAndHold: communityContextMenu.show(model.id)
|
||||||
states: [
|
states: [
|
||||||
|
@ -123,6 +124,7 @@ Page {
|
||||||
width: fontMetrics.lineSpacing
|
width: fontMetrics.lineSpacing
|
||||||
image: model.collapsed ? ":/icons/icons/ui/collapsed.svg" : ":/icons/icons/ui/expanded.svg"
|
image: model.collapsed ? ":/icons/icons/ui/collapsed.svg" : ":/icons/icons/ui/expanded.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: model.collapsed ? qsTr("Expand") : qsTr("Collapse")
|
ToolTip.text: model.collapsed ? qsTr("Expand") : qsTr("Collapse")
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,9 @@ TextEdit {
|
||||||
color: Nheko.colors.text
|
color: Nheko.colors.text
|
||||||
onLinkActivated: Nheko.openLink(link)
|
onLinkActivated: Nheko.openLink(link)
|
||||||
ToolTip.visible: hoveredLink || false
|
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: {
|
Component.onCompleted: {
|
||||||
TimelineManager.fixImageRendering(r.textDocument, r);
|
TimelineManager.fixImageRendering(r.textDocument, r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ ScrollView {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
image: ":/icons/icons/ui/edit.svg"
|
image: ":/icons/icons/ui/edit.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Edit")
|
ToolTip.text: qsTr("Edit")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (row.model.isEditable)
|
if (row.model.isEditable)
|
||||||
|
@ -121,6 +122,7 @@ ScrollView {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
image: ":/icons/icons/ui/smile.svg"
|
image: ":/icons/icons/ui/smile.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("React")
|
ToolTip.text: qsTr("React")
|
||||||
onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(reactButton, function(emoji) {
|
onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(reactButton, function(emoji) {
|
||||||
var event_id = row.model ? row.model.eventId : "";
|
var event_id = row.model ? row.model.eventId : "";
|
||||||
|
@ -137,6 +139,7 @@ ScrollView {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
image: ":/icons/icons/ui/reply.svg"
|
image: ":/icons/icons/ui/reply.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Reply")
|
ToolTip.text: qsTr("Reply")
|
||||||
onClicked: chat.model.replyAction(row.model.eventId)
|
onClicked: chat.model.replyAction(row.model.eventId)
|
||||||
}
|
}
|
||||||
|
@ -148,6 +151,7 @@ ScrollView {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
image: ":/icons/icons/ui/options.svg"
|
image: ":/icons/icons/ui/options.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Options")
|
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)
|
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
|
userid: userId
|
||||||
onClicked: room.openUserProfile(userId)
|
onClicked: room.openUserProfile(userId)
|
||||||
ToolTip.visible: avatarHover.hovered
|
ToolTip.visible: avatarHover.hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: userid
|
ToolTip.text: userid
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
|
@ -311,6 +316,7 @@ ScrollView {
|
||||||
color: TimelineManager.userColor(userId, Nheko.colors.base)
|
color: TimelineManager.userColor(userId, Nheko.colors.base)
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
ToolTip.visible: displayNameHover.hovered
|
ToolTip.visible: displayNameHover.hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: userId
|
ToolTip.text: userId
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
|
|
|
@ -140,6 +140,7 @@ Page {
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
state: "normal"
|
state: "normal"
|
||||||
ToolTip.visible: hovered && collapsed
|
ToolTip.visible: hovered && collapsed
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: roomName
|
ToolTip.text: roomName
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("tapped " + roomId);
|
console.log("tapped " + roomId);
|
||||||
|
@ -325,6 +326,7 @@ Page {
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
color: hasLoudNotification ? Nheko.theme.red : roomItem.bubbleBackground
|
color: hasLoudNotification ? Nheko.theme.red : roomItem.bubbleBackground
|
||||||
ToolTip.text: notificationCount
|
ToolTip.text: notificationCount
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.visible: notificationBubbleHover.hovered && (notificationCount > 9999)
|
ToolTip.visible: notificationBubbleHover.hovered && (notificationCount > 9999)
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
@ -495,6 +497,7 @@ Page {
|
||||||
Layout.preferredHeight: fontMetrics.lineSpacing * 2
|
Layout.preferredHeight: fontMetrics.lineSpacing * 2
|
||||||
image: ":/icons/icons/ui/power-off.svg"
|
image: ":/icons/icons/ui/power-off.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Logout")
|
ToolTip.text: qsTr("Logout")
|
||||||
onClicked: Nheko.openLogoutDialog()
|
onClicked: Nheko.openLogoutDialog()
|
||||||
}
|
}
|
||||||
|
@ -560,6 +563,7 @@ Page {
|
||||||
height: fontMetrics.font.pixelSize
|
height: fontMetrics.font.pixelSize
|
||||||
image: ":/icons/icons/ui/dismiss.svg"
|
image: ":/icons/icons/ui/dismiss.svg"
|
||||||
ToolTip.visible: closeUnverifiedBubble.hovered
|
ToolTip.visible: closeUnverifiedBubble.hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Close")
|
ToolTip.text: qsTr("Close")
|
||||||
onClicked: unverifiedStuffBubble.visible = false
|
onClicked: unverifiedStuffBubble.visible = false
|
||||||
}
|
}
|
||||||
|
@ -625,6 +629,7 @@ Page {
|
||||||
height: 22
|
height: 22
|
||||||
image: ":/icons/icons/ui/add-square-button.svg"
|
image: ":/icons/icons/ui/add-square-button.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Start a new chat")
|
ToolTip.text: qsTr("Start a new chat")
|
||||||
Layout.margins: Nheko.paddingMedium
|
Layout.margins: Nheko.paddingMedium
|
||||||
onClicked: roomJoinCreateMenu.open(parent)
|
onClicked: roomJoinCreateMenu.open(parent)
|
||||||
|
@ -654,6 +659,7 @@ Page {
|
||||||
height: 22
|
height: 22
|
||||||
image: ":/icons/icons/ui/speech-bubbles.svg"
|
image: ":/icons/icons/ui/speech-bubbles.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Room directory")
|
ToolTip.text: qsTr("Room directory")
|
||||||
Layout.margins: Nheko.paddingMedium
|
Layout.margins: Nheko.paddingMedium
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -670,6 +676,7 @@ Page {
|
||||||
height: 22
|
height: 22
|
||||||
image: ":/icons/icons/ui/settings.svg"
|
image: ":/icons/icons/ui/settings.svg"
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("User settings")
|
ToolTip.text: qsTr("User settings")
|
||||||
Layout.margins: Nheko.paddingMedium
|
Layout.margins: Nheko.paddingMedium
|
||||||
onClicked: Nheko.showUserSettingsPage()
|
onClicked: Nheko.showUserSettingsPage()
|
||||||
|
|
|
@ -171,6 +171,7 @@ Item {
|
||||||
sourceSize.height: 16 * Screen.devicePixelRatio
|
sourceSize.height: 16 * Screen.devicePixelRatio
|
||||||
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
|
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? Nheko.colors.highlight : Nheko.colors.buttonText)
|
||||||
ToolTip.visible: editHovered.hovered
|
ToolTip.visible: editHovered.hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: qsTr("Edited")
|
ToolTip.text: qsTr("Edited")
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
|
@ -194,6 +195,7 @@ Item {
|
||||||
width: Math.max(implicitWidth, text.length * fontMetrics.maximumCharacterWidth)
|
width: Math.max(implicitWidth, text.length * fontMetrics.maximumCharacterWidth)
|
||||||
color: Nheko.inactiveColors.text
|
color: Nheko.inactiveColors.text
|
||||||
ToolTip.visible: ma.hovered
|
ToolTip.visible: ma.hovered
|
||||||
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: Qt.formatDateTime(timestamp, Qt.DefaultLocaleLongDate)
|
ToolTip.text: Qt.formatDateTime(timestamp, Qt.DefaultLocaleLongDate)
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
#include "NhekoGlobalObject.h"
|
#include "NhekoGlobalObject.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QStyle>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
|
@ -75,6 +77,12 @@ Nheko::theme() const
|
||||||
return Theme(UserSettings::instance()->theme());
|
return Theme(UserSettings::instance()->theme());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Nheko::tooltipDelay() const
|
||||||
|
{
|
||||||
|
return QApplication::style()->styleHint(QStyle::StyleHint::SH_ToolTip_WakeUpDelay);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Nheko::openLink(QString link) const
|
Nheko::openLink(QString link) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@ class Nheko : public QObject
|
||||||
Q_PROPERTY(int paddingSmall READ paddingSmall CONSTANT)
|
Q_PROPERTY(int paddingSmall READ paddingSmall CONSTANT)
|
||||||
Q_PROPERTY(int paddingMedium READ paddingMedium CONSTANT)
|
Q_PROPERTY(int paddingMedium READ paddingMedium CONSTANT)
|
||||||
Q_PROPERTY(int paddingLarge READ paddingLarge CONSTANT)
|
Q_PROPERTY(int paddingLarge READ paddingLarge CONSTANT)
|
||||||
|
Q_PROPERTY(int tooltipDelay READ tooltipDelay CONSTANT)
|
||||||
|
|
||||||
Q_PROPERTY(UserProfile *currentUser READ currentUser NOTIFY profileChanged)
|
Q_PROPERTY(UserProfile *currentUser READ currentUser NOTIFY profileChanged)
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ public:
|
||||||
int paddingSmall() const { return 4; }
|
int paddingSmall() const { return 4; }
|
||||||
int paddingMedium() const { return 8; }
|
int paddingMedium() const { return 8; }
|
||||||
int paddingLarge() const { return 20; }
|
int paddingLarge() const { return 20; }
|
||||||
|
|
||||||
|
int tooltipDelay() const;
|
||||||
|
|
||||||
UserProfile *currentUser() const;
|
UserProfile *currentUser() const;
|
||||||
|
|
||||||
Q_INVOKABLE QFont monospaceFont() const
|
Q_INVOKABLE QFont monospaceFont() const
|
||||||
|
|
Loading…
Reference in a new issue