From 1f9dd45e498b812a4884ce8221f9ee8250f475df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 7 Apr 2015 01:21:03 +0200 Subject: GH-329 update description text in MainWindow when instance Minecraft version changes --- application/MainWindow.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'application/MainWindow.cpp') diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 07f0d02f..5b56ca31 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -480,6 +480,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi view->setFrameShape(QFrame::NoFrame); view->setModel(proxymodel); + connect(proxymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), SLOT(instanceDataChanged(QModelIndex,QModelIndex))); + view->setContextMenuPolicy(Qt::CustomContextMenu); connect(view, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showInstanceContextMenu(const QPoint &))); @@ -1939,6 +1941,17 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex & } } +void MainWindow::instanceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) +{ + auto current = view->selectionModel()->currentIndex(); + QItemSelection test(topLeft, bottomRight); + if(test.contains(current)) + { + instanceChanged(current, current); + } +} + + void MainWindow::selectionBad() { // start by reseting everything... -- cgit v1.2.3