Give metatile label copy feedback, skip empty labels

This commit is contained in:
GriffinR 2022-10-03 10:14:41 -04:00
parent 167710b4b2
commit 5b5d6ddf25

View file

@ -1074,12 +1074,11 @@ void TilesetEditor::countTileUsage() {
}
void TilesetEditor::on_copyButton_metatileLabel_clicked() {
QClipboard * clipboard = QGuiApplication::clipboard();
QString label = this->ui->lineEdit_metatileLabel->text();
if (!label.isEmpty()) {
Tileset * tileset = Tileset::getMetatileTileset(this->getSelectedMetatileId(), this->primaryTileset, this->secondaryTileset);
if (tileset)
label.prepend("METATILE_" + QString(tileset->name).replace("gTileset_", "") + "_");
}
clipboard->setText(label);
if (label.isEmpty()) return;
Tileset * tileset = Tileset::getMetatileTileset(this->getSelectedMetatileId(), this->primaryTileset, this->secondaryTileset);
if (tileset)
label.prepend("METATILE_" + QString(tileset->name).replace("gTileset_", "") + "_");
QGuiApplication::clipboard()->setText(label);
QToolTip::showText(this->ui->copyButton_metatileLabel->mapToGlobal(QPoint(0, 0)), "Copied!");
}