diff --git a/src/drivers/Qt/CheatsConf.cpp b/src/drivers/Qt/CheatsConf.cpp index bd918a3b..7c8b3ec9 100644 --- a/src/drivers/Qt/CheatsConf.cpp +++ b/src/drivers/Qt/CheatsConf.cpp @@ -704,14 +704,10 @@ int GuiCheatsDialog_t::activeCheatListCB(const char *name, uint32 a, uint8 v, in if (item == NULL) { - item = new QTreeWidgetItem(); - - actvCheatList->addTopLevelItem(item); + item = new QTreeWidgetItem(actvCheatList); } - //item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsUserCheckable ); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemNeverHasChildren); - item->setCheckState(0, s ? Qt::Checked : Qt::Unchecked); item->setText(0, tr(codeStr)); @@ -737,8 +733,6 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw) enaCheats->setChecked(!globalCheatDisabled); - actvCheatRedraw = redraw; - if (redraw) { actvCheatList->clear(); @@ -746,6 +740,8 @@ void GuiCheatsDialog_t::showActiveCheatList(bool redraw) actvCheatIdx = 0; FCEUI_ListCheats(::activeCheatListCB, (void *)this); + + actvCheatList->viewport()->update(); } //---------------------------------------------------------------------------- void GuiCheatsDialog_t::openCheatFile(void) diff --git a/src/drivers/Qt/CheatsConf.h b/src/drivers/Qt/CheatsConf.h index 4eab63a9..44b44123 100644 --- a/src/drivers/Qt/CheatsConf.h +++ b/src/drivers/Qt/CheatsConf.h @@ -72,7 +72,6 @@ protected: int fontCharWidth; int actvCheatIdx; - bool actvCheatRedraw; bool pauseWhileActive; bool wasPausedByCheats; diff --git a/src/drivers/Qt/GameGenie.cpp b/src/drivers/Qt/GameGenie.cpp index 7d77b00c..56a3b02d 100644 --- a/src/drivers/Qt/GameGenie.cpp +++ b/src/drivers/Qt/GameGenie.cpp @@ -42,6 +42,7 @@ #include "Qt/config.h" #include "Qt/keyscan.h" #include "Qt/fceuWrapper.h" +#include "Qt/CheatsConf.h" #include "Qt/HexEditor.h" #include "Qt/GameGenie.h" @@ -278,6 +279,7 @@ void GameGenieDialog_t::addCheatClicked(void) FCEU_WRAPPER_LOCK(); FCEUI_AddCheat( name.c_str(), a, v, c, 1 ); + updateCheatDialog(); FCEU_WRAPPER_UNLOCK(); }