fix 15 bit depth hex value update
This commit is contained in:
parent
12d5f22475
commit
ca0229f444
1 changed files with 2 additions and 1 deletions
|
@ -73,7 +73,7 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset
|
||||||
// Connect to function that will update color when hex edit is changed
|
// Connect to function that will update color when hex edit is changed
|
||||||
for (int i = 0; i < this->hexEdits.length(); i++) {
|
for (int i = 0; i < this->hexEdits.length(); i++) {
|
||||||
connect(this->hexEdits[i], &QLineEdit::textEdited, [this, i](QString text){
|
connect(this->hexEdits[i], &QLineEdit::textEdited, [this, i](QString text){
|
||||||
if (text.length() == 6) setRgbFromHexEdit(i);
|
if ((this->bitDepth == 24 && text.length() == 6) || (this->bitDepth == 15 && text.length() == 4)) setRgbFromHexEdit(i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,7 @@ void PaletteEditor::updateColorUi(int colorIndex, QRgb rgb) {
|
||||||
// hex
|
// hex
|
||||||
int hex15 = (rgb5(blue) << 10) | (rgb5(green) << 5) | rgb5(red);
|
int hex15 = (rgb5(blue) << 10) | (rgb5(green) << 5) | rgb5(red);
|
||||||
QString hexcode = QString::number(hex15, 16).toUpper();
|
QString hexcode = QString::number(hex15, 16).toUpper();
|
||||||
|
this->hexEdits[colorIndex]->setText(hexcode);
|
||||||
|
|
||||||
// spinners
|
// spinners
|
||||||
this->spinners[colorIndex][0]->setValue(rgb5(red));
|
this->spinners[colorIndex][0]->setValue(rgb5(red));
|
||||||
|
|
Loading…
Reference in a new issue