From a113e500503dd4f91211254b74b4b090b64ead34 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 12 Jan 2023 11:23:02 +0400 Subject: [PATCH] Separate ClickHandler::url from dragText. --- ui/basic_click_handlers.h | 1 - ui/click_handler.h | 5 +++++ ui/widgets/labels.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/basic_click_handlers.h b/ui/basic_click_handlers.h index 89d5773..178e68c 100644 --- a/ui/basic_click_handlers.h +++ b/ui/basic_click_handlers.h @@ -28,7 +28,6 @@ public: } protected: - virtual QString url() const = 0; virtual QString readable() const; bool _fullDisplayed; diff --git a/ui/click_handler.h b/ui/click_handler.h index 9e1b0b9..b22576e 100644 --- a/ui/click_handler.h +++ b/ui/click_handler.h @@ -38,6 +38,11 @@ public: virtual void onClick(ClickContext context) const = 0; + // Some sort of `id`, for text links contains urls. + virtual QString url() const { + return QString(); + } + // What text to show in a tooltip when mouse is over that click handler as a link in Text. virtual QString tooltip() const { return QString(); diff --git a/ui/widgets/labels.cpp b/ui/widgets/labels.cpp index 7d44cae..0cdadf5 100644 --- a/ui/widgets/labels.cpp +++ b/ui/widgets/labels.cpp @@ -398,7 +398,7 @@ void FlatLabel::overrideLinkClickHandler(Fn handler) { if (button != Qt::LeftButton) { return true; } - handler(link->dragText()); + handler(link->url()); return false; }); }