Correctly initialize palette for palette editor

This commit is contained in:
GriffinR 2020-03-23 05:14:38 -04:00 committed by huderlem
parent 5cf0e35ffc
commit 3ff5483267
3 changed files with 4 additions and 5 deletions

View file

@ -23,7 +23,7 @@ public:
class PaletteEditor : public QMainWindow {
Q_OBJECT
public:
explicit PaletteEditor(Project*, Tileset*, Tileset*, QWidget *parent = nullptr);
explicit PaletteEditor(Project*, Tileset*, Tileset*, int paletteId, QWidget *parent = nullptr);
~PaletteEditor();
void setPaletteId(int);
void setTilesets(Tileset*, Tileset*);

View file

@ -5,7 +5,7 @@
#include <QMessageBox>
#include "log.h"
PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset *secondaryTileset, QWidget *parent) :
PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset *secondaryTileset, int paletteId, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::PaletteEditor)
{
@ -110,8 +110,7 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset
}
this->initColorSliders();
this->refreshColorSliders();
this->refreshColors();
this->setPaletteId(paletteId);
this->commitEditHistory(this->ui->spinBox_PaletteId->value());
}

View file

@ -591,7 +591,7 @@ void TilesetEditor::on_actionChange_Metatiles_Count_triggered()
void TilesetEditor::on_actionChange_Palettes_triggered()
{
if (!this->paletteEditor) {
this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, this->secondaryTileset, this);
this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, this->secondaryTileset, this->paletteId, this);
connect(this->paletteEditor, SIGNAL(changedPaletteColor()), this, SLOT(onPaletteEditorChangedPaletteColor()));
connect(this->paletteEditor, SIGNAL(changedPalette(int)), this, SLOT(onPaletteEditorChangedPalette(int)));
}