diff --git a/.github/workflows/BuildAndRelease.yml b/.github/workflows/BuildAndRelease.yml index 27dae0e..5d68611 100644 --- a/.github/workflows/BuildAndRelease.yml +++ b/.github/workflows/BuildAndRelease.yml @@ -117,7 +117,6 @@ jobs: dir: ${{ runner.temp }} cache: 'true' cache-key-prefix: 'install-qt-action-macos' - setup-python: false - name: Setup xcode uses: maxim-lobanov/setup-xcode@v1 diff --git a/leveleditor/tilesetpalette.cpp b/leveleditor/tilesetpalette.cpp index 4f7f746..d740009 100644 --- a/leveleditor/tilesetpalette.cpp +++ b/leveleditor/tilesetpalette.cpp @@ -153,20 +153,27 @@ void TilesetPalette::reloadTilesets() void TilesetPalette::loadTileset(int tilesetNbr) { - if (objectsModel == nullptr) - { - objectsModel = new QStandardItemModel(this); - } - if (!level->tilesets[tilesetNbr]) { objectLists[tilesetNbr]->setEnabled(false); + + QStandardItemModel* objectsModel = dynamic_cast(objectLists[tilesetNbr]->model()); + if (objectsModel == nullptr) + { + objectsModel = new QStandardItemModel(this); + } objectsModel->clear(); objectLists[tilesetNbr]->setModel(objectsModel); return; } objectLists[tilesetNbr]->setEnabled(true); + + QStandardItemModel* objectsModel = dynamic_cast(objectLists[tilesetNbr]->model()); + if (objectsModel == nullptr) + { + objectsModel = new QStandardItemModel(this); + } objectsModel->clear(); for (int i = 0; i < level->tilesets[tilesetNbr]->getNumObjects(); i++) diff --git a/leveleditor/tilesetpalette.h b/leveleditor/tilesetpalette.h index e22bce2..46c38ce 100644 --- a/leveleditor/tilesetpalette.h +++ b/leveleditor/tilesetpalette.h @@ -29,7 +29,6 @@ private slots: EditManager *editManager; Game *game; QUndoStack *undoStack; - QStandardItemModel* objectsModel = nullptr; QTabWidget *tabWidget; QList tilesetPickers;