projects
/
emufront
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d21f1d3
)
Fixing a bug with selection combo box not updating when editin an
author
Mikko Keinänen
<mikko.keinanen@gmail.com>
Sun, 24 Oct 2010 23:49:55 +0000
(
02:49
+0300)
committer
Mikko Keinänen
<mikko.keinanen@gmail.com>
Sun, 24 Oct 2010 23:49:55 +0000
(
02:49
+0300)
object.
src/dialogs/namedialog.cpp
patch
|
blob
|
history
src/dialogs/setupeditdialog.cpp
patch
|
blob
|
history
src/dialogs/setupmaindialog.cpp
patch
|
blob
|
history
src/widgets/efcombobox.cpp
patch
|
blob
|
history
diff --git
a/src/dialogs/namedialog.cpp
b/src/dialogs/namedialog.cpp
index
d3c1358
..
95bc5f0
100644
(file)
--- a/
src/dialogs/namedialog.cpp
+++ b/
src/dialogs/namedialog.cpp
@@
-89,8
+89,9
@@
void NameDialog::enableSaveButton(const QString &/*text*/)
void NameDialog::setDataObject(EmuFrontObject *ob)
{
if (!ob) return;
void NameDialog::setDataObject(EmuFrontObject *ob)
{
if (!ob) return;
- // delete efObject; -> we should not delete the previously referenced data object here, it may be still used in the parent widget
- // the parent widget will take of destruction
+ // delete efObject; -> we should not delete the previously referenced data object here, it
+ // may be still used in the parent widget
+ // the parent widget will take care of destruction
// we'll just refresh the name dialog pointer to a new object
efObject = ob;
}
// we'll just refresh the name dialog pointer to a new object
efObject = ob;
}
diff --git
a/src/dialogs/setupeditdialog.cpp
b/src/dialogs/setupeditdialog.cpp
index
40c1be3
..
c35042b
100644
(file)
--- a/
src/dialogs/setupeditdialog.cpp
+++ b/
src/dialogs/setupeditdialog.cpp
@@
-106,6
+106,7
@@
void SetupEditDialog::acceptChanges()
void SetupEditDialog::setDataObject(EmuFrontObject *ob)
{
if (!ob) return;
void SetupEditDialog::setDataObject(EmuFrontObject *ob)
{
if (!ob) return;
+ qDebug() << "Updating data object with " << ob->getName() << ".";
efObject = ob;
Setup *sup= dynamic_cast<Setup*>(ob);
if (sup->getPlatform()) setSelectedPlatform(sup->getPlatform());
efObject = ob;
Setup *sup= dynamic_cast<Setup*>(ob);
if (sup->getPlatform()) setSelectedPlatform(sup->getPlatform());
diff --git
a/src/dialogs/setupmaindialog.cpp
b/src/dialogs/setupmaindialog.cpp
index
663947f
..
82b9a05
100644
(file)
--- a/
src/dialogs/setupmaindialog.cpp
+++ b/
src/dialogs/setupmaindialog.cpp
@@
-28,7
+28,7
@@
SetupMainDialog::SetupMainDialog(QWidget *parent)
setWindowTitle(tr("Setups"));
dbManager = new DbSetup(this);
initDataTable();
setWindowTitle(tr("Setups"));
dbManager = new DbSetup(this);
initDataTable();
- initEditDialog();
+ //initEditDialog(); this is called when editObject is called!
objectList->hideColumn(DbSetup::Setup_Id);
objectList->hideColumn(DbSetup::Setup_PlatformId);
objectList->hideColumn(DbSetup::Setup_MediaTypeId);
objectList->hideColumn(DbSetup::Setup_Id);
objectList->hideColumn(DbSetup::Setup_PlatformId);
objectList->hideColumn(DbSetup::Setup_MediaTypeId);
diff --git
a/src/widgets/efcombobox.cpp
b/src/widgets/efcombobox.cpp
index
dfa12c2
..
9246b8e
100644
(file)
--- a/
src/widgets/efcombobox.cpp
+++ b/
src/widgets/efcombobox.cpp
@@
-72,12
+72,19
@@
void EFComboBox::setSelected(const EmuFrontObject *efo)
{
if (!efo)
return;
{
if (!efo)
return;
+ qDebug() << "EFCombobox selecting " << efo->getName()
+ << " [" << efo->getId() << "].";
QSqlQueryModel *qmodel
= dynamic_cast<QSqlQueryModel*>(model());
for (int i = 0; i < qmodel->rowCount(); i++){
QSqlRecord rec = qmodel->record(i);
QSqlQueryModel *qmodel
= dynamic_cast<QSqlQueryModel*>(model());
for (int i = 0; i < qmodel->rowCount(); i++){
QSqlRecord rec = qmodel->record(i);
- if (rec.value(dataModelIndex_id) == efo->getId()){
+ int id = rec.value(dataModelIndex_id).toInt();
+ qDebug() << "Checking record with id " << rec.value(dataModelIndex_id)
+ << " and name " << rec.value(dataModelIndex_name);
+ if (id == efo->getId()){
+ qDebug() << "Found!";
setCurrentIndex(i);
setCurrentIndex(i);
+ show();
break;
}
}
break;
}
}