Skip to content

Commit 7719eaf

Browse files
Fix some error formatting
1 parent 53bea22 commit 7719eaf

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
3131
- Fix excessive logging if Porymap fails to monitor all map files.
3232
- Fix map connections getting cut off in exported map images if they're on the same side as another short map connection.
3333
- Fix the project version check failing for some versions of `git`.
34+
- Fix some error highlights persisting after the error is resolved.
3435

3536
## [6.2.0] - 2025-08-08
3637
### Added

forms/newtilesetdialog.ui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<bool>true</bool>
1818
</property>
1919
<layout class="QVBoxLayout" name="verticalLayout">
20+
<property name="sizeConstraint">
21+
<enum>QLayout::SizeConstraint::SetFixedSize</enum>
22+
</property>
2023
<item>
2124
<widget class="QFrame" name="form">
2225
<layout class="QFormLayout" name="formLayout">

src/core/utility.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ QString Util::replaceExtension(const QString &path, const QString &newExtension)
110110
}
111111

112112
void Util::setErrorStylesheet(QLineEdit *lineEdit, bool isError) {
113-
static const QString stylesheet = QStringLiteral("QLineEdit { background-color: rgba(255, 0, 0, 25%) }");
114-
lineEdit->setStyleSheet(isError ? stylesheet : "");
113+
static const QString errorStylesheet = QStringLiteral("QLineEdit { background-color: rgba(255, 0, 0, 25%) }");
114+
static const QString defaultStylesheet = QStringLiteral("QLineEdit {}");
115+
lineEdit->setStyleSheet(isError ? errorStylesheet : defaultStylesheet);
115116
}
116117

117118
void Util::show(QWidget *w) {

src/ui/newtilesetdialog.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "project.h"
44
#include "imageexport.h"
55
#include "validator.h"
6+
#include "log.h"
67

78
NewTilesetDialog::NewTilesetDialog(Project* project, QWidget *parent) :
89
QDialog(parent),
@@ -20,8 +21,6 @@ NewTilesetDialog::NewTilesetDialog(Project* project, QWidget *parent) :
2021

2122
connect(ui->lineEdit_Name, &QLineEdit::textChanged, this, &NewTilesetDialog::onNameChanged);
2223
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &NewTilesetDialog::dialogButtonClicked);
23-
24-
adjustSize();
2524
}
2625

2726
NewTilesetDialog::~NewTilesetDialog()
@@ -67,7 +66,7 @@ void NewTilesetDialog::accept() {
6766
bool secondary = ui->comboBox_Type->currentIndex() == 1;
6867
Tileset *tileset = this->project->createNewTileset(ui->lineEdit_Name->text(), secondary, ui->checkBox_CheckerboardFill->isChecked());
6968
if (!tileset) {
70-
ui->label_GenericError->setText(QString("Failed to create tileset. See %1 for details.").arg(getLogPath()));
69+
ui->label_GenericError->setText(getMostRecentError());
7170
ui->label_GenericError->setVisible(true);
7271
return;
7372
}

src/ui/projectsettingseditor.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,13 @@ void ProjectSettingsEditor::updateMaskOverlapWarning(QLabel * warning, QList<UIn
259259
// It'de nice if we could style this as a persistent red border around the line edit for any
260260
// overlapping masks. As it is editing the border undesirably modifies the arrow buttons.
261261
// This stylesheet will just highlight the currently selected line edit, which is fine enough.
262-
static const QString styleSheet = "QAbstractSpinBox { selection-background-color: rgba(255, 0, 0, 25%) }";
262+
static const QString errorStylesheet = QStringLiteral("QAbstractSpinBox { selection-background-color: rgba(255, 0, 0, 25%) }");
263+
static const QString defaultStylesheet = QStringLiteral("QAbstractSpinBox {}");
263264

264265
// Update warning display
265266
if (warning) warning->setHidden(overlapping.isEmpty());
266267
for (int i = 0; i < masks.length(); i++)
267-
masks.at(i)->setStyleSheet(overlapping.contains(i) ? styleSheet : "");
268+
masks.at(i)->setStyleSheet(overlapping.contains(i) ? errorStylesheet : defaultStylesheet);
268269
}
269270

270271
void ProjectSettingsEditor::updateBlockMaskOverlapWarning() {

0 commit comments

Comments
 (0)