mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Qt/MainWindow: Also display "List Columns" menu via right-click on table's header.
This commit is contained in:
@ -42,6 +42,7 @@
|
||||
#include "DolphinQt/GameList/GameListModel.h"
|
||||
#include "DolphinQt/GameList/GridProxyModel.h"
|
||||
#include "DolphinQt/GameList/ListProxyModel.h"
|
||||
#include "DolphinQt/MenuBar.h"
|
||||
#include "DolphinQt/QtUtils/DoubleClickEventFilter.h"
|
||||
#include "DolphinQt/Resources.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
@ -121,6 +122,9 @@ void GameList::MakeListView()
|
||||
hor_header->restoreState(
|
||||
Settings::GetQSettings().value(QStringLiteral("tableheader/state")).toByteArray());
|
||||
|
||||
hor_header->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(hor_header, &QWidget::customContextMenuRequested, this, &GameList::ShowHeaderContextMenu);
|
||||
|
||||
connect(hor_header, &QHeaderView::sortIndicatorChanged, this, &GameList::OnHeaderViewChanged);
|
||||
connect(hor_header, &QHeaderView::sectionCountChanged, this, &GameList::OnHeaderViewChanged);
|
||||
connect(hor_header, &QHeaderView::sectionMoved, this, &GameList::OnHeaderViewChanged);
|
||||
@ -223,6 +227,20 @@ void GameList::MakeGridView()
|
||||
});
|
||||
}
|
||||
|
||||
void GameList::ShowHeaderContextMenu(const QPoint& pos)
|
||||
{
|
||||
const MenuBar* const menu_bar = MenuBar::GetMenuBar();
|
||||
if (!menu_bar)
|
||||
return;
|
||||
|
||||
QMenu* const list_columns_menu = menu_bar->GetListColumnsMenu();
|
||||
if (!list_columns_menu)
|
||||
return;
|
||||
|
||||
const QWidget* const widget = qobject_cast<QWidget*>(sender());
|
||||
list_columns_menu->exec(widget ? widget->mapToGlobal(pos) : pos);
|
||||
}
|
||||
|
||||
void GameList::ShowContextMenu(const QPoint&)
|
||||
{
|
||||
if (!GetSelectedGame())
|
||||
|
@ -52,6 +52,7 @@ signals:
|
||||
void OpenGeneralSettings();
|
||||
|
||||
private:
|
||||
void ShowHeaderContextMenu(const QPoint& pos);
|
||||
void ShowContextMenu(const QPoint&);
|
||||
void OpenContainingFolder();
|
||||
void OpenProperties();
|
||||
|
Reference in New Issue
Block a user