Compare commits

...

3 commits

Author SHA1 Message Date
Roman Telezhynskyi 748d18ce9a Fix size of Unsaved changes dialog.
Since Qt 6 produces warnings "QWindowsWindow::setGeometry: Unable to set geometry".
2024-01-29 17:07:54 +02:00
Roman Telezhynskyi 0cd42f83e6 Fix color of a line edit text in dark mode. 2024-01-29 16:47:19 +02:00
Roman Telezhynskyi a0c1b6a512 QFutureWatcher::connect: connecting after calling setFuture() is likely to produce race. 2024-01-29 16:33:24 +02:00
11 changed files with 21 additions and 12 deletions

View file

@ -459,7 +459,7 @@ void DialogSaveManualLayout::PathChanged(const QString &text)
if (not text.isEmpty() && dir.exists(text))
{
bOk->setEnabled(true);
palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black);
palette.setColor(ui->lineEditPath->foregroundRole(), palette.color(QPalette::Text));
}
else
{

View file

@ -1794,6 +1794,7 @@ auto VPMainWindow::MaybeSave() -> bool
}
messageBox->setWindowModality(Qt::ApplicationModal);
messageBox->setFixedSize(300, 85);
const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
switch (ret)

View file

@ -829,10 +829,10 @@ void MApplication::RepopulateMeasurementsDatabase(const QString &path)
Q_UNUSED(path)
if (m_knownMeasurementsDatabase != nullptr)
{
m_knownMeasurementsRepopulateWatcher->setFuture(
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher<void>::finished, this,
&MApplication::SyncKnownMeasurements);
m_knownMeasurementsRepopulateWatcher->setFuture(
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
}
}

View file

@ -1942,6 +1942,7 @@ auto TKMMainWindow::MaybeSave() -> bool
}
messageBox->setWindowModality(Qt::ApplicationModal);
messageBox->setFixedSize(300, 85);
const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
switch (ret)

View file

@ -3474,6 +3474,7 @@ auto TMainWindow::MaybeSave() -> bool
}
messageBox->setWindowModality(Qt::ApplicationModal);
messageBox->setFixedSize(300, 85);
const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
switch (ret)

View file

@ -332,11 +332,13 @@ void DialogPatternProperties::ValidatePassmarkLength() const
QRegularExpression rx(NameRegExp());
if (not text.isEmpty())
{
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red);
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text)
? palette.color(QPalette::Text)
: Qt::red);
}
else
{
palette.setColor(foregroundRole, Qt::black);
palette.setColor(foregroundRole, palette.color(QPalette::Text));
}
ui->lineEditPassmarkLength->setPalette(palette);
@ -352,11 +354,13 @@ void DialogPatternProperties::ValidatePassmarkWidth() const
QRegularExpression rx(NameRegExp());
if (not text.isEmpty())
{
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red);
palette.setColor(foregroundRole, rx.match(text).hasMatch() && m_variables.contains(text)
? palette.color(QPalette::Text)
: Qt::red);
}
else
{
palette.setColor(foregroundRole, Qt::black);
palette.setColor(foregroundRole, palette.color(QPalette::Text));
}
ui->lineEditPassmarkWidth->setPalette(palette);
@ -555,7 +559,7 @@ void DialogPatternProperties::LabelPathChanged(const QString &text)
{
QPalette palette = ui->lineEditPieceLabelPath->palette();
palette.setColor(ui->lineEditPieceLabelPath->foregroundRole(),
text.isEmpty() || QFileInfo::exists(text) ? Qt::black : Qt::red);
text.isEmpty() || QFileInfo::exists(text) ? palette.color(QPalette::Text) : Qt::red);
ui->lineEditPieceLabelPath->setPalette(palette);
m_descriptionChanged = true;
}

View file

@ -410,7 +410,7 @@ void DialogSaveLayout::PathChanged(const QString &text)
if (not text.isEmpty() && dir.exists(text))
{
bOk->setEnabled(true);
palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black);
palette.setColor(ui->lineEditPath->foregroundRole(), palette.color(QPalette::Text));
}
else
{

View file

@ -5756,6 +5756,7 @@ auto MainWindow::MaybeSave() -> bool
}
messageBox->setWindowModality(Qt::ApplicationModal);
messageBox->setFixedSize(300, 85);
const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
switch (ret)

View file

@ -284,10 +284,10 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
{
QEventLoop wait;
QFutureWatcher<void> fw;
QObject::connect(&fw, &QFutureWatcher<void>::finished, &wait, &QEventLoop::quit);
fw.setFuture(
QtConcurrent::run([&lGenerator, timer, nestingState]()
{ lGenerator.Generate(timer, lGenerator.GetNestingTimeMSecs(), nestingState); }));
QObject::connect(&fw, &QFutureWatcher<void>::finished, &wait, &QEventLoop::quit);
wait.exec();
}

View file

@ -502,6 +502,7 @@ auto WatermarkWindow::MaybeSave() -> bool
}
messageBox->setWindowModality(Qt::ApplicationModal);
messageBox->setFixedSize(300, 85);
const auto ret = static_cast<QMessageBox::StandardButton>(messageBox->exec());
switch (ret)

View file

@ -235,10 +235,10 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop,
return position.getBestResult();
};
watcher.setFuture(QtConcurrent::mapped(jobs, Nest));
QEventLoop wait;
QObject::connect(&watcher, &QFutureWatcher<VBestSquare>::finished, &wait, &QEventLoop::quit);
watcher.setFuture(QtConcurrent::mapped(jobs, Nest));
wait.exec();
if (stop->load())