Emitting a dataChanged signal from setData after succesful update and connecting...
authorMikko Keinänen <mikko.keinanen@gmail.com>
Wed, 22 Dec 2010 23:17:27 +0000 (01:17 +0200)
committerMikko Keinänen <mikko.keinanen@gmail.com>
Wed, 22 Dec 2010 23:17:27 +0000 (01:17 +0200)
src/models/emufrontfileobjectmodel.cpp
src/models/emufrontfileobjectmodel.h
src/models/externalexecutablemodel.cpp
src/models/externalexecutablemodel.h
src/models/filepathmodel.cpp
src/models/filepathmodel.h
src/models/setupmodel.cpp
src/models/setupmodel.h
src/views/emufronteditview.cpp
src/views/emufronteditview.h

index 0720a4b..fd89a1b 100644 (file)
@@ -54,6 +54,7 @@ bool EmuFrontFileObjectModel::setData(const QModelIndex &index, const QVariant &
     }
 
     refresh();
+       if (ok) emit dataChanged();
     return ok;
 }
 
index f2cbc4e..3595d76 100644 (file)
@@ -44,6 +44,9 @@ public:
         EmuFrontFileObject_FileUpdateTime
     };
 
+signals:
+       void dataChanged();
+
 protected:
     virtual void refresh();
     virtual QString constructSelect(QString where = "") const;
index a6a786c..dc57af3 100644 (file)
@@ -103,6 +103,7 @@ bool ExternalExecutableModel::setData(const QModelIndex &index, const QVariant &
             ok = false;
     }
     refresh();
+       if (ok) emit dataChanged();
     return ok;
 }
 
index b4d0efe..2e33343 100644 (file)
@@ -48,6 +48,9 @@ public:
     };
     virtual void refresh();
 
+signals:
+       void dataChanged();
+
 protected:
     virtual QString constructSelect(QString where = "") const;
     virtual bool setSetup(int isd, int setupId);
index bd59729..0622a5c 100644 (file)
@@ -96,6 +96,7 @@ bool FilePathModel::setData(const QModelIndex &index, const QVariant &value, int
         ok = false;
         qDebug() << "File path model, this shouldn't be happening!";
     }
+       if (ok) emit dataChanged();
     refresh();
     return ok;
 }
index 712ba35..3aa4fb9 100644 (file)
@@ -44,6 +44,10 @@ public:
     FilePathObject* getFilePathObject(const QModelIndex &index);
     virtual bool setScanned(int id);
 
+signals:
+       void dataChanged();
+
+
 protected:
     virtual void refresh();
     virtual QString constructSelect(QString where = "") const;
index 6c52270..9a871d6 100644 (file)
@@ -105,6 +105,7 @@ bool SetupModel::setData(const QModelIndex &index, const QVariant &value, int /*
         ok = false;
         qDebug() << "Setup model, this shouldn't be happening!";
     };
+       if (ok) emit dataChanged();
     refresh();
     return ok;
 }
index 3c64344..04c9ee0 100644 (file)
@@ -41,6 +41,9 @@ public:
     static const QString FILE_TYPE_EXTENSION_SEPARATOR;
     virtual void refresh();
 
+signals:
+       void dataChanged();
+
 protected:
     virtual QString constructSelect(QString where = "") const;
     virtual bool setPlatform(int id, int platformId);
index 3d7b713..8d8c29a 100644 (file)
@@ -65,6 +65,7 @@ void EmuFrontEditView::connectSignals()
     connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
     connect(objectList, SIGNAL(clicked(const QModelIndex &)),
         this, SLOT(listObjectClicked(const QModelIndex &)));
+       connect(model, SIGNAL(dataChanged()), this, SLOT(onDataChanged()));
     connect(editButton, SIGNAL(clicked()), this, SLOT(editButtonClicked()));
     connect(addButton, SIGNAL(clicked()), this, SLOT(addButtonClicked()));
     connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteButtonClicked()));
@@ -133,4 +134,7 @@ bool EmuFrontEditView::confirm(QString &msg)
     return true;
 }
 
-
+void EmuFrontEditView::onDataChanged()
+{
+       qDebug() << "Data changed";
+}
index b03b466..eb1e590 100644 (file)
@@ -38,6 +38,7 @@ private slots:
     void addButtonClicked();
     void deleteButtonClicked();
     void listObjectClicked(const QModelIndex &);
+       void onDataChanged();
 
 protected:
     EmuFrontQueryModel *model;