diff --git a/CHANGELOG.md b/CHANGELOG.md index d40b1057..3749d52e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ - Minor: Add feedback when writing a non-command message in the `/whispers` split. (#3439) - Minor: Opening streamlink through hotkeys and/or split header menu matches `/streamlink` command and shows feedback in chat as well. (#3510) - Minor: Removed timestamp from AutoMod messages. (#3503) +- Minor: Added ability to copy message ID with `Shift + Right Click`. (#3481) - Bugfix: Fix Split Input hotkeys not being available when input is hidden (#3362) - Bugfix: Fixed colored usernames sometimes not working. (#3170) - Bugfix: Restored ability to send duplicate `/me` messages. (#3166) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 653177fc..85f215a3 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1828,7 +1828,7 @@ void ChannelView::handleMouseClick(QMouseEvent *event, } else { - this->addContextMenuItems(hoveredElement, layout); + this->addContextMenuItems(hoveredElement, layout, event); } } break; @@ -1845,7 +1845,8 @@ void ChannelView::handleMouseClick(QMouseEvent *event, } void ChannelView::addContextMenuItems( - const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout) + const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout, + QMouseEvent *event) { const auto &creator = hoveredElement->getCreator(); auto creatorFlags = creator.getFlags(); @@ -1983,6 +1984,15 @@ void ChannelView::addContextMenuItems( } } + if (event->modifiers() == Qt::ShiftModifier && + !layout->getMessage()->id.isEmpty()) + { + menu->addAction("Copy message ID", + [messageID = layout->getMessage()->id] { + crossPlatformCopy(messageID); + }); + } + menu->popup(QCursor::pos()); menu->raise(); diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index 43534981..4b4c7afe 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -160,7 +160,7 @@ private: const MessageLayoutElement *hoverLayoutElement, MessageLayoutPtr layout); void addContextMenuItems(const MessageLayoutElement *hoveredElement, - MessageLayoutPtr layout); + MessageLayoutPtr layout, QMouseEvent *event); int getLayoutWidth() const; void updatePauses(); void unpaused();