diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-01-05 16:53:51 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-01-05 16:53:51 +0100 |
commit | ced640f68c25c1ea40f86be5af736aa0263dd3ee (patch) | |
tree | bab0b570ba00204d2a9d9afcf69ce4cb36dd4afa /gui/MainWindow.cpp | |
parent | a64eebf8eb758971b090b2e87212c2458424797e (diff) | |
parent | ebc14a9d9d55b64d490ab07d3f11835f2f1f36b1 (diff) | |
download | MultiMC-ced640f68c25c1ea40f86be5af736aa0263dd3ee.tar MultiMC-ced640f68c25c1ea40f86be5af736aa0263dd3ee.tar.gz MultiMC-ced640f68c25c1ea40f86be5af736aa0263dd3ee.tar.lz MultiMC-ced640f68c25c1ea40f86be5af736aa0263dd3ee.tar.xz MultiMC-ced640f68c25c1ea40f86be5af736aa0263dd3ee.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'gui/MainWindow.cpp')
-rw-r--r-- | gui/MainWindow.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index 35c4ee15..968fecb7 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -166,6 +166,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi view->setFrameShape(QFrame::NoFrame); view->setModel(proxymodel); + view->setContextMenuPolicy(Qt::CustomContextMenu); + connect(view, SIGNAL(customContextMenuRequested(const QPoint&)), + this, SLOT(showInstanceContextMenu(const QPoint&))); + ui->horizontalLayout->addWidget(view); } // The cat background @@ -315,6 +319,29 @@ MainWindow::~MainWindow() delete drawer; } +void MainWindow::showInstanceContextMenu(const QPoint& pos) +{ + if(!view->indexAt(pos).isValid()) + { + return; + } + + QList<QAction *> actions = ui->instanceToolBar->actions(); + + // HACK: Filthy rename button hack because the instance view is getting rewritten anyway + QAction *actionRename; + actionRename = new QAction(tr("Rename"), this); + actionRename->setToolTip(ui->actionRenameInstance->toolTip()); + + connect(actionRename, SIGNAL(triggered(bool)), SLOT(on_actionRenameInstance_triggered())); + + actions.replace(1, actionRename); + + QMenu myMenu; + myMenu.addActions(actions); + myMenu.exec(view->mapToGlobal(pos)); +} + void MainWindow::repopulateAccountsMenu() { accountMenu->clear(); |