Skip to content

Commit 20b5de7

Browse files
committed
Added ability to open menu from history view top bar with right click.
1 parent b8a17d4 commit 20b5de7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ namespace {
7575

7676
constexpr auto kEmojiInteractionSeenDuration = 3 * crl::time(1000);
7777

78+
class MenuToggleButton final : public Ui::IconButton {
79+
public:
80+
using IconButton::IconButton;
81+
82+
protected:
83+
void contextMenuEvent(QContextMenuEvent *e) override {
84+
Ui::AbstractButton::clicked(Qt::KeyboardModifiers(), Qt::LeftButton);
85+
}
86+
};
87+
7888
[[nodiscard]] inline bool HasGroupCallMenu(not_null<PeerData*> peer) {
7989
return !peer->isUser()
8090
&& !peer->groupCall()
@@ -125,7 +135,9 @@ TopBarWidget::TopBarWidget(
125135
, _groupCall(this, st::topBarGroupCall)
126136
, _search(this, st::topBarSearch)
127137
, _infoToggle(this, st::topBarInfo)
128-
, _menuToggle(this, st::topBarMenuToggle)
138+
, _menuToggle(
139+
object_ptr<Ui::IconButton>::fromRaw(
140+
Ui::CreateChild<MenuToggleButton>(this, st::topBarMenuToggle)))
129141
, _titlePeerText(st::windowMinWidth / 3)
130142
, _onlineUpdater([=] { updateOnlineDisplay(); }) {
131143
setAttribute(Qt::WA_OpaquePaintEvent);

0 commit comments

Comments
 (0)