summaryrefslogtreecommitdiffstats
path: root/application/pages/instance/ScreenshotsPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2019-07-25 01:02:30 +0200
committerPetr Mrázek <peterix@gmail.com>2019-07-25 01:02:30 +0200
commit7dfe73df0c26733d68abc576c3eefab1a69e2149 (patch)
tree0e490b13ad475f0d551f8087851f83869589eb09 /application/pages/instance/ScreenshotsPage.cpp
parentc3e61536a3ba7b0dca1171df36e9aeb09b6e2a0d (diff)
downloadMultiMC-7dfe73df0c26733d68abc576c3eefab1a69e2149.tar
MultiMC-7dfe73df0c26733d68abc576c3eefab1a69e2149.tar.gz
MultiMC-7dfe73df0c26733d68abc576c3eefab1a69e2149.tar.lz
MultiMC-7dfe73df0c26733d68abc576c3eefab1a69e2149.tar.xz
MultiMC-7dfe73df0c26733d68abc576c3eefab1a69e2149.zip
NOISSUE add context menus to pages with toolbars
Diffstat (limited to 'application/pages/instance/ScreenshotsPage.cpp')
-rw-r--r--application/pages/instance/ScreenshotsPage.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/application/pages/instance/ScreenshotsPage.cpp b/application/pages/instance/ScreenshotsPage.cpp
index d73fda51..efa0f9f2 100644
--- a/application/pages/instance/ScreenshotsPage.cpp
+++ b/application/pages/instance/ScreenshotsPage.cpp
@@ -235,6 +235,8 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
ui->listView->installEventFilter(this);
ui->listView->setEditTriggers(0);
ui->listView->setItemDelegate(new CenteredEditingDelegate(this));
+ ui->listView->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(ui->listView, &QListView::customContextMenuRequested, this, &ScreenshotsPage::ShowContextMenu);
connect(ui->listView, SIGNAL(activated(QModelIndex)), SLOT(onItemActivated(QModelIndex)));
}
@@ -266,6 +268,13 @@ ScreenshotsPage::~ScreenshotsPage()
delete ui;
}
+void ScreenshotsPage::ShowContextMenu(const QPoint& pos)
+{
+ auto menu = ui->toolBar->createContextMenu(this, tr("Context menu"));
+ menu->exec(ui->listView->mapToGlobal(pos));
+ delete menu;
+}
+
QMenu * ScreenshotsPage::createPopupMenu()
{
QMenu* filteredMenu = QMainWindow::createPopupMenu();