Display RGB values in tileset palette editor
This commit is contained in:
parent
74ce9c9a45
commit
7a47c64509
3 changed files with 139 additions and 3 deletions
|
@ -146,6 +146,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -237,6 +244,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb5">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -328,6 +342,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb7">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -419,6 +440,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb6">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -510,6 +538,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb10">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -601,6 +636,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb8">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -692,6 +734,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb9">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -783,6 +832,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb11">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -874,6 +930,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb12">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -965,6 +1028,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb14">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1056,6 +1126,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb13">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1147,6 +1224,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb15">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1238,6 +1322,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb0">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1329,6 +1420,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb1">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1420,6 +1518,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb2">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1511,6 +1616,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_rgb3">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
#include <QLabel>
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -22,6 +23,7 @@ private:
|
||||||
Project *project = nullptr;
|
Project *project = nullptr;
|
||||||
QList<QList<QSlider*>> sliders;
|
QList<QList<QSlider*>> sliders;
|
||||||
QList<QFrame*> frames;
|
QList<QFrame*> frames;
|
||||||
|
QList<QLabel*> rgbLabels;
|
||||||
Tileset *primaryTileset;
|
Tileset *primaryTileset;
|
||||||
Tileset *secondaryTileset;
|
Tileset *secondaryTileset;
|
||||||
void disableSliderSignals();
|
void disableSliderSignals();
|
||||||
|
|
|
@ -82,6 +82,24 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset
|
||||||
this->frames.append(this->ui->frame_15);
|
this->frames.append(this->ui->frame_15);
|
||||||
this->frames.append(this->ui->frame_16);
|
this->frames.append(this->ui->frame_16);
|
||||||
|
|
||||||
|
this->rgbLabels.clear();
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb0);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb1);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb2);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb3);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb4);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb5);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb6);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb7);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb8);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb9);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb10);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb11);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb12);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb13);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb14);
|
||||||
|
this->rgbLabels.append(this->ui->label_rgb15);
|
||||||
|
|
||||||
this->initColorSliders();
|
this->initColorSliders();
|
||||||
this->refreshColorSliders();
|
this->refreshColorSliders();
|
||||||
this->refreshColors();
|
this->refreshColors();
|
||||||
|
@ -141,11 +159,15 @@ void PaletteEditor::refreshColors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaletteEditor::refreshColor(int colorIndex) {
|
void PaletteEditor::refreshColor(int colorIndex) {
|
||||||
|
int red = this->sliders[colorIndex][0]->value() * 8;
|
||||||
|
int green = this->sliders[colorIndex][1]->value() * 8;
|
||||||
|
int blue = this->sliders[colorIndex][2]->value() * 8;
|
||||||
QString stylesheet = QString("background-color: rgb(%1, %2, %3);")
|
QString stylesheet = QString("background-color: rgb(%1, %2, %3);")
|
||||||
.arg(this->sliders[colorIndex][0]->value() * 8)
|
.arg(red)
|
||||||
.arg(this->sliders[colorIndex][1]->value() * 8)
|
.arg(green)
|
||||||
.arg(this->sliders[colorIndex][2]->value() * 8);
|
.arg(blue);
|
||||||
this->frames[colorIndex]->setStyleSheet(stylesheet);
|
this->frames[colorIndex]->setStyleSheet(stylesheet);
|
||||||
|
this->rgbLabels[colorIndex]->setText(QString("RGB(%1, %2, %3)").arg(red).arg(green).arg(blue));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaletteEditor::setPaletteId(int paletteId) {
|
void PaletteEditor::setPaletteId(int paletteId) {
|
||||||
|
|
Loading…
Reference in a new issue