summary refs log tree commit diff
path: root/src/SuggestionsPopup.cpp
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-27 14:04:13 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-27 14:04:13 +0300
commit2c6192d08f8f609c32adfb56c628dc86b43c8c54 (patch)
treea2375f2d6193ebb7404d2e0b8555a25418da9fff /src/SuggestionsPopup.cpp
parentImprove room searching (diff)
downloadnheko-2c6192d08f8f609c32adfb56c628dc86b43c8c54.tar.xz
Fix clicking on room list suggestions
Diffstat (limited to 'src/SuggestionsPopup.cpp')
-rw-r--r--src/SuggestionsPopup.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/SuggestionsPopup.cpp b/src/SuggestionsPopup.cpp

index cb569ddf..86586c92 100644 --- a/src/SuggestionsPopup.cpp +++ b/src/SuggestionsPopup.cpp
@@ -38,17 +38,6 @@ PopupItem::paintEvent(QPaintEvent *) p.fillRect(rect(), hoverColor_); } -void -PopupItem::mousePressEvent(QMouseEvent *event) -{ - if (event->buttons() != Qt::RightButton) - // TODO: should be abstracted. - emit clicked( - Cache::displayName(ChatPage::instance()->currentRoom(), selectedText())); - - QWidget::mousePressEvent(event); -} - UserItem::UserItem(QWidget *parent, const QString &user_id) : PopupItem(parent) , userId_{user_id} @@ -77,6 +66,16 @@ UserItem::UserItem(QWidget *parent, const QString &user_id) [this](const QImage &img) { avatar_->setImage(img); }); } +void +UserItem::mousePressEvent(QMouseEvent *event) +{ + if (event->buttons() != Qt::RightButton) + emit clicked( + Cache::displayName(ChatPage::instance()->currentRoom(), selectedText())); + + QWidget::mousePressEvent(event); +} + RoomItem::RoomItem(QWidget *parent, const RoomSearchResult &res) : PopupItem(parent) , roomId_{QString::fromStdString(res.room_id)} @@ -97,6 +96,15 @@ RoomItem::RoomItem(QWidget *parent, const RoomSearchResult &res) avatar_->setImage(res.img); } +void +RoomItem::mousePressEvent(QMouseEvent *event) +{ + if (event->buttons() != Qt::RightButton) + emit clicked(selectedText()); + + QWidget::mousePressEvent(event); +} + SuggestionsPopup::SuggestionsPopup(QWidget *parent) : QWidget(parent) {