Click tag mentions

You can now click on a username in the main chat to add a "@username"
tag to the chat. Makes communication with other users using tags faster.
This commit is contained in:
Matt Lowe 2015-01-17 14:47:16 +01:00
parent 9b7f488bd7
commit 45112e49b1
4 changed files with 14 additions and 4 deletions

View file

@ -249,12 +249,15 @@ void ChatView::mousePressEvent(QMouseEvent *event)
break;
}
case HoveredUser: {
if (event->button() == Qt::RightButton) {
if (event->button() != Qt::MidButton) {
const int delimiterIndex = hoveredContent.indexOf("_");
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
const QString userName = hoveredContent.mid(delimiterIndex + 1);
userContextMenu->showContextMenu(event->globalPos(), userName, userLevel);
if (event->button() == Qt::RightButton) {
UserLevelFlags userLevel(hoveredContent.left(delimiterIndex).toInt());
userContextMenu->showContextMenu(event->globalPos(), userName, userLevel);
}
else if (event->button() == Qt::LeftButton)
emit addMentionTag("@" + userName);
}
break;
}