From 43d572edde63e0ec9fb3efdb37cbcce477c60583 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sun, 18 Jan 2015 21:25:54 +0000 Subject: [PATCH] Fix Device Config and Wizard Interaction .. when you add a device using the wizard from preferences it resets the model to reflect the changes made. Fixes #785 --- src/Pages.cpp | 10 ++++++++++ src/Pages.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Pages.cpp b/src/Pages.cpp index ae1a3e6d4..ab18fe5ee 100644 --- a/src/Pages.cpp +++ b/src/Pages.cpp @@ -1084,6 +1084,7 @@ DevicePage::DevicePage(QWidget *parent, Context *context) : QWidget(parent), con connect(addButton, SIGNAL(clicked()), this, SLOT(devaddClicked())); connect(delButton, SIGNAL(clicked()), this, SLOT(devdelClicked())); + connect(context, SIGNAL(configChanged(qint32)), deviceListModel, SLOT(doReset())); } qint32 @@ -1164,6 +1165,15 @@ deviceModel::deviceModel(QObject *parent) : QAbstractTableModel(parent) Configuration = all.getList(); } +void +deviceModel::doReset() +{ + beginResetModel(); + DeviceConfigurations all; + Configuration = all.getList(); + endResetModel(); +} + int deviceModel::rowCount(const QModelIndex &parent) const { diff --git a/src/Pages.h b/src/Pages.h index 9f6deadef..6805b4352 100644 --- a/src/Pages.h +++ b/src/Pages.h @@ -235,8 +235,12 @@ class deviceModel : public QAbstractTableModel bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex()); bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex()); - QList Configuration; // the actual data + + public slots: + // config changed by wizard so reset + void doReset(); + }; class DevicePage : public QWidget