diff options
author | Petr Mrázek <peterix@gmail.com> | 2019-07-25 01:02:30 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-07-25 01:02:30 +0200 |
commit | 7dfe73df0c26733d68abc576c3eefab1a69e2149 (patch) | |
tree | 0e490b13ad475f0d551f8087851f83869589eb09 /application/pages/instance/ScreenshotsPage.cpp | |
parent | c3e61536a3ba7b0dca1171df36e9aeb09b6e2a0d (diff) | |
download | MultiMC-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.cpp | 9 |
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(); |