X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.cpp;h=8063a972365ace53da297ad7a1bdaa431373fb02;hp=4da2bb47075b5ab0c9cde1490c51f5777e3b6f05;hb=f9efdde7f3a6004af8f834c409cfa6ae1d877692;hpb=b7447afe8e836376776dac26704e227a678d2913 diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index 4da2bb47..8063a972 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -20,6 +20,9 @@ #include "chatitem.h" +#include +#include + #include #include #include @@ -30,6 +33,7 @@ #include #include +#include "action.h" #include "buffermodel.h" #include "bufferview.h" #include "chatline.h" @@ -46,7 +50,7 @@ ChatItem::ChatItem(const QRectF &boundingRect, ChatLine *parent) _boundingRect(boundingRect), _selectionMode(NoSelection), _selectionStart(-1), - _cachedLayout(0) + _cachedLayout(nullptr) { } @@ -138,7 +142,7 @@ QTextLayout *ChatItem::layout() const void ChatItem::clearCache() { delete _cachedLayout; - _cachedLayout = 0; + _cachedLayout = nullptr; } @@ -286,36 +290,92 @@ void ChatItem::overlayFormat(UiStyle::FormatList &fmtList, quint16 start, quint1 QVector ChatItem::additionalFormats() const { - return selectionFormats(); -} + // Calculate formats to overlay (only) if there's a selection, and/or a hovered clickable + if (!hasSelection() && !hasActiveClickable()) { + return {}; + } + using Label = UiStyle::MessageLabel; + using Format = UiStyle::Format; -QVector ChatItem::selectionFormats() const -{ - if (!hasSelection()) - return QVector(); + auto itemLabel = data(ChatLineModel::MsgLabelRole).value