Use QString::number where applicable

This commit is contained in:
Silent 2021-03-02 23:33:03 +01:00
parent c0b7ee5722
commit 84bec06a90
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
6 changed files with 17 additions and 17 deletions

View file

@ -544,7 +544,7 @@ bool AutoUpdaterDialog::doUpdate(const QString& zip_path, const QString& updater
} }
QStringList arguments; QStringList arguments;
arguments << QStringLiteral("%1").arg(QCoreApplication::applicationPid()); arguments << QString::number(QCoreApplication::applicationPid());
arguments << destination_path; arguments << destination_path;
arguments << zip_path; arguments << zip_path;
arguments << program_path; arguments << program_path;

View file

@ -48,9 +48,9 @@ static QString formatHexAndDecValue(u32 value, u8 size, bool is_signed)
static QString formatValue(u32 value, bool is_signed) static QString formatValue(u32 value, bool is_signed)
{ {
if (is_signed) if (is_signed)
return QStringLiteral("%1").arg(static_cast<int>(value)); return QString::number(static_cast<int>(value));
else else
return QStringLiteral("%1").arg(static_cast<uint>(value)); return QString::number(static_cast<uint>(value));
} }
CheatManagerDialog::CheatManagerDialog(QWidget* parent) : QDialog(parent) CheatManagerDialog::CheatManagerDialog(QWidget* parent) : QDialog(parent)

View file

@ -236,7 +236,7 @@ void GamePropertiesDialog::populateTracksInfo(const std::string& image_path)
const CDImage::TrackMode mode = image->GetTrackMode(static_cast<u8>(track)); const CDImage::TrackMode mode = image->GetTrackMode(static_cast<u8>(track));
const int row = static_cast<int>(track - 1u); const int row = static_cast<int>(track - 1u);
m_ui.tracks->insertRow(row); m_ui.tracks->insertRow(row);
m_ui.tracks->setItem(row, 0, new QTableWidgetItem(QStringLiteral("%1").arg(track))); m_ui.tracks->setItem(row, 0, new QTableWidgetItem(QString::number(track)));
m_ui.tracks->setItem(row, 1, new QTableWidgetItem(track_mode_strings[static_cast<u32>(mode)])); m_ui.tracks->setItem(row, 1, new QTableWidgetItem(track_mode_strings[static_cast<u32>(mode)]));
m_ui.tracks->setItem(row, 2, new QTableWidgetItem(MSFTotString(position))); m_ui.tracks->setItem(row, 2, new QTableWidgetItem(MSFTotString(position)));
m_ui.tracks->setItem(row, 3, new QTableWidgetItem(MSFTotString(length))); m_ui.tracks->setItem(row, 3, new QTableWidgetItem(MSFTotString(length)));

View file

@ -207,7 +207,7 @@ void MemoryCardEditorDialog::updateCardTable(Card* card)
card->table->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(fi.title))); card->table->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(fi.title)));
card->table->setItem(row, 2, new QTableWidgetItem(QString::fromStdString(fi.filename))); card->table->setItem(row, 2, new QTableWidgetItem(QString::fromStdString(fi.filename)));
card->table->setItem(row, 3, new QTableWidgetItem(QStringLiteral("%1").arg(fi.num_blocks))); card->table->setItem(row, 3, new QTableWidgetItem(QString::number(fi.num_blocks)));
} }
} }

View file

@ -47,7 +47,7 @@ void PostProcessingShaderConfigWidget::createUi()
QString label; QString label;
if (option.vector_size <= 1) if (option.vector_size <= 1)
{ {
label = QStringLiteral("%1").arg(QString::fromStdString(option.ui_name)); label = QString::fromStdString(option.ui_name);
} }
else else
{ {
@ -66,7 +66,7 @@ void PostProcessingShaderConfigWidget::createUi()
if (option.type == PostProcessingShader::Option::Type::Int) if (option.type == PostProcessingShader::Option::Type::Int)
{ {
slider_label->setText(QStringLiteral("%1").arg(option.value[i].int_value)); slider_label->setText(QString::number(option.value[i].int_value));
const int range = std::max(option.max_value[i].int_value - option.min_value[i].int_value, 1); const int range = std::max(option.max_value[i].int_value - option.min_value[i].int_value, 1);
const int step_value = const int step_value =
@ -81,20 +81,20 @@ void PostProcessingShaderConfigWidget::createUi()
const int new_value = std::clamp(option.min_value[i].int_value + (value * option.step_value[i].int_value), const int new_value = std::clamp(option.min_value[i].int_value + (value * option.step_value[i].int_value),
option.min_value[i].int_value, option.max_value[i].int_value); option.min_value[i].int_value, option.max_value[i].int_value);
option.value[i].int_value = new_value; option.value[i].int_value = new_value;
slider_label->setText(QStringLiteral("%1").arg(new_value)); slider_label->setText(QString::number(new_value));
configChanged(); configChanged();
}); });
connect(this, &PostProcessingShaderConfigWidget::resettingtoDefaults, connect(this, &PostProcessingShaderConfigWidget::resettingtoDefaults,
[&option, i, slider, slider_label, step_value]() { [&option, i, slider, slider_label, step_value]() {
QSignalBlocker sb(slider); QSignalBlocker sb(slider);
slider->setValue((option.default_value[i].int_value - option.min_value[i].int_value) / step_value); slider->setValue((option.default_value[i].int_value - option.min_value[i].int_value) / step_value);
slider_label->setText(QStringLiteral("%1").arg(option.default_value[i].int_value)); slider_label->setText(QString::number(option.default_value[i].int_value));
option.value = option.default_value; option.value = option.default_value;
}); });
} }
else else
{ {
slider_label->setText(QStringLiteral("%1").arg(option.value[i].float_value)); slider_label->setText(QString::number(option.value[i].float_value));
const float range = std::max(option.max_value[i].float_value - option.min_value[i].float_value, 1.0f); const float range = std::max(option.max_value[i].float_value - option.min_value[i].float_value, 1.0f);
const float step_value = const float step_value =
@ -111,7 +111,7 @@ void PostProcessingShaderConfigWidget::createUi()
(static_cast<float>(value) * option.step_value[i].float_value), (static_cast<float>(value) * option.step_value[i].float_value),
option.min_value[i].float_value, option.max_value[i].float_value); option.min_value[i].float_value, option.max_value[i].float_value);
option.value[i].float_value = new_value; option.value[i].float_value = new_value;
slider_label->setText(QStringLiteral("%1").arg(new_value)); slider_label->setText(QString::number(new_value));
configChanged(); configChanged();
}); });
connect(this, &PostProcessingShaderConfigWidget::resettingtoDefaults, connect(this, &PostProcessingShaderConfigWidget::resettingtoDefaults,
@ -119,7 +119,7 @@ void PostProcessingShaderConfigWidget::createUi()
QSignalBlocker sb(slider); QSignalBlocker sb(slider);
slider->setValue(static_cast<int>( slider->setValue(static_cast<int>(
(option.default_value[i].float_value - option.min_value[i].float_value) / step_value)); (option.default_value[i].float_value - option.min_value[i].float_value) / step_value));
slider_label->setText(QStringLiteral("%1").arg(option.default_value[i].float_value)); slider_label->setText(QString::number(option.default_value[i].float_value));
option.value = option.default_value; option.value = option.default_value;
}); });
} }

View file

@ -44,10 +44,10 @@ struct SettingAccessor<QLineEdit>
} }
static int getIntValue(const QLineEdit* widget) { return widget->text().toInt(); } static int getIntValue(const QLineEdit* widget) { return widget->text().toInt(); }
static void setIntValue(QLineEdit* widget, int value) { widget->setText(QStringLiteral("%1").arg(value)); } static void setIntValue(QLineEdit* widget, int value) { widget->setText(QString::number(value)); }
static float getFloatValue(const QLineEdit* widget) { return widget->text().toFloat(); } static float getFloatValue(const QLineEdit* widget) { return widget->text().toFloat(); }
static void setFloatValue(QLineEdit* widget, float value) { widget->setText(QStringLiteral("%1").arg(value)); } static void setFloatValue(QLineEdit* widget, float value) { widget->setText(QString::number(value)); }
static QString getStringValue(const QLineEdit* widget) { return widget->text(); } static QString getStringValue(const QLineEdit* widget) { return widget->text(); }
static void setStringValue(QLineEdit* widget, const QString& value) { widget->setText(value); } static void setStringValue(QLineEdit* widget, const QString& value) { widget->setText(value); }
@ -118,7 +118,7 @@ struct SettingAccessor<QSlider>
static float getFloatValue(const QSlider* widget) { return static_cast<float>(widget->value()); } static float getFloatValue(const QSlider* widget) { return static_cast<float>(widget->value()); }
static void setFloatValue(QSlider* widget, float value) { widget->setValue(static_cast<int>(value)); } static void setFloatValue(QSlider* widget, float value) { widget->setValue(static_cast<int>(value)); }
static QString getStringValue(const QSlider* widget) { return QStringLiteral("%1").arg(widget->value()); } static QString getStringValue(const QSlider* widget) { return QString::number(widget->value()); }
static void setStringValue(QSlider* widget, const QString& value) { widget->setValue(value.toInt()); } static void setStringValue(QSlider* widget, const QString& value) { widget->setValue(value.toInt()); }
template<typename F> template<typename F>
@ -140,7 +140,7 @@ struct SettingAccessor<QSpinBox>
static float getFloatValue(const QSpinBox* widget) { return static_cast<float>(widget->value()); } static float getFloatValue(const QSpinBox* widget) { return static_cast<float>(widget->value()); }
static void setFloatValue(QSpinBox* widget, float value) { widget->setValue(static_cast<int>(value)); } static void setFloatValue(QSpinBox* widget, float value) { widget->setValue(static_cast<int>(value)); }
static QString getStringValue(const QSpinBox* widget) { return QStringLiteral("%1").arg(widget->value()); } static QString getStringValue(const QSpinBox* widget) { return QString::number(widget->value()); }
static void setStringValue(QSpinBox* widget, const QString& value) { widget->setValue(value.toInt()); } static void setStringValue(QSpinBox* widget, const QString& value) { widget->setValue(value.toInt()); }
template<typename F> template<typename F>
@ -162,7 +162,7 @@ struct SettingAccessor<QDoubleSpinBox>
static float getFloatValue(const QDoubleSpinBox* widget) { return static_cast<float>(widget->value()); } static float getFloatValue(const QDoubleSpinBox* widget) { return static_cast<float>(widget->value()); }
static void setFloatValue(QDoubleSpinBox* widget, float value) { widget->setValue(static_cast<double>(value)); } static void setFloatValue(QDoubleSpinBox* widget, float value) { widget->setValue(static_cast<double>(value)); }
static QString getStringValue(const QDoubleSpinBox* widget) { return QStringLiteral("%1").arg(widget->value()); } static QString getStringValue(const QDoubleSpinBox* widget) { return QString::number(widget->value()); }
static void setStringValue(QDoubleSpinBox* widget, const QString& value) { widget->setValue(value.toDouble()); } static void setStringValue(QDoubleSpinBox* widget, const QString& value) { widget->setValue(value.toDouble()); }
template<typename F> template<typename F>