GH-329 update description text in MainWindow when instance Minecraft version changes

This commit is contained in:
Petr Mrázek 2015-04-07 01:21:03 +02:00
parent f061bf7a27
commit 1f9dd45e49
3 changed files with 16 additions and 0 deletions

View File

@ -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<int>)), 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 &current, 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...

View File

@ -154,6 +154,8 @@ slots:
void instanceChanged(const QModelIndex &current, const QModelIndex &previous);
void instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void selectionBad();
void startTask(Task *task);

View File

@ -264,6 +264,7 @@ bool OneSixInstance::setIntendedVersionId(QString version)
{
clearProfile();
}
emit propertiesChanged(this);
return true;
}