Gui: Use QStringLiteral
This commit is contained in:
@@ -94,7 +94,7 @@ void CommandIconView::startDrag (Qt::DropActions supportedActions)
|
||||
}
|
||||
|
||||
auto mimeData = new QMimeData;
|
||||
mimeData->setData(QString::fromLatin1("text/x-action-items"), itemData);
|
||||
mimeData->setData(QStringLiteral("text/x-action-items"), itemData);
|
||||
|
||||
auto drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
@@ -428,7 +428,7 @@ void AccelLineEdit::keyPressEvent (QKeyEvent * e)
|
||||
txtLine.clear();
|
||||
break;
|
||||
default:
|
||||
txtLine += QString::fromLatin1(",");
|
||||
txtLine += QStringLiteral(",");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -524,7 +524,7 @@ void ModifierLineEdit::keyPressEvent (QKeyEvent * e)
|
||||
ClearLineEdit::ClearLineEdit (QWidget * parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
clearAction = this->addAction(QIcon(QString::fromLatin1(":/icons/edit-cleartext.svg")),
|
||||
clearAction = this->addAction(QIcon(QStringLiteral(":/icons/edit-cleartext.svg")),
|
||||
QLineEdit::TrailingPosition);
|
||||
connect(clearAction, &QAction::triggered, this, &ClearLineEdit::clear);
|
||||
connect(this, &QLineEdit::textChanged, this, &ClearLineEdit::updateClearButton);
|
||||
@@ -943,7 +943,7 @@ void StatefulLabel::registerState(const QString& state, const QColor& color,
|
||||
{
|
||||
QString css;
|
||||
if (color.isValid())
|
||||
css = QString::fromUtf8("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
|
||||
css = QStringLiteral("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
|
||||
_availableStates[state] = { css, preferenceName };
|
||||
}
|
||||
|
||||
@@ -952,10 +952,10 @@ void StatefulLabel::registerState(const QString& state, const QColor& fg, const
|
||||
{
|
||||
QString colorEntries;
|
||||
if (fg.isValid())
|
||||
colorEntries.append(QString::fromUtf8("color : rgba(%1,%2,%3,%4);").arg(fg.red()).arg(fg.green()).arg(fg.blue()).arg(fg.alpha()));
|
||||
colorEntries.append(QStringLiteral("color : rgba(%1,%2,%3,%4);").arg(fg.red()).arg(fg.green()).arg(fg.blue()).arg(fg.alpha()));
|
||||
if (bg.isValid())
|
||||
colorEntries.append(QString::fromUtf8("background-color : rgba(%1,%2,%3,%4);").arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(bg.alpha()));
|
||||
QString css = QString::fromUtf8("Gui--StatefulLabel{ %1 }").arg(colorEntries);
|
||||
colorEntries.append(QStringLiteral("background-color : rgba(%1,%2,%3,%4);").arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(bg.alpha()));
|
||||
QString css = QStringLiteral("Gui--StatefulLabel{ %1 }").arg(colorEntries);
|
||||
_availableStates[state] = { css, preferenceName };
|
||||
}
|
||||
|
||||
@@ -1010,7 +1010,7 @@ void StatefulLabel::setState(QString state)
|
||||
// Convert the stored Uint into usable color data:
|
||||
unsigned int col = unsignedEntry.second;
|
||||
QColor qcolor(App::Color::fromPackedRGB<QColor>(col));
|
||||
this->setStyleSheet(QString::fromUtf8("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(qcolor.red()).arg(qcolor.green()).arg(qcolor.blue()).arg(qcolor.alpha()));
|
||||
this->setStyleSheet(QStringLiteral("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(qcolor.red()).arg(qcolor.green()).arg(qcolor.blue()).arg(qcolor.alpha()));
|
||||
_styleCache[state] = this->styleSheet();
|
||||
return;
|
||||
}
|
||||
@@ -1020,7 +1020,7 @@ void StatefulLabel::setState(QString state)
|
||||
auto availableStringPrefs = _parameterGroup->GetASCIIMap();
|
||||
for (const auto& stringEntry : availableStringPrefs) {
|
||||
if (stringEntry.first == entry->second.preferenceString) {
|
||||
QString css = QString::fromUtf8("Gui--StatefulLabel{ %1 }").arg(QString::fromStdString(stringEntry.second));
|
||||
QString css = QStringLiteral("Gui--StatefulLabel{ %1 }").arg(QString::fromStdString(stringEntry.second));
|
||||
this->setStyleSheet(css);
|
||||
_styleCache[state] = this->styleSheet();
|
||||
return;
|
||||
@@ -1409,7 +1409,7 @@ public:
|
||||
if (edit) {
|
||||
QString inputText = edit->toPlainText();
|
||||
if (!inputText.isEmpty()) // let pass empty input, regardless of the type, so user can void the value
|
||||
lines = inputText.split(QString::fromLatin1("\n"));
|
||||
lines = inputText.split(QStringLiteral("\n"));
|
||||
}
|
||||
if (!lines.isEmpty()) {
|
||||
if (type == 1) { // floats
|
||||
@@ -1483,7 +1483,7 @@ void LabelEditor::setText(const QString& s)
|
||||
{
|
||||
this->plainText = s;
|
||||
|
||||
QString text = QString::fromLatin1("[%1]").arg(this->plainText);
|
||||
QString text = QStringLiteral("[%1]").arg(this->plainText);
|
||||
lineEdit->setText(text);
|
||||
}
|
||||
|
||||
@@ -1506,7 +1506,7 @@ void LabelEditor::changeText()
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, dlg, &PropertyListDialog::reject);
|
||||
connect(dlg, &PropertyListDialog::accepted, this, [&] {
|
||||
QString inputText = edit->toPlainText();
|
||||
QString text = QString::fromLatin1("[%1]").arg(inputText);
|
||||
QString text = QStringLiteral("[%1]").arg(inputText);
|
||||
lineEdit->setText(text);
|
||||
});
|
||||
|
||||
@@ -1578,7 +1578,7 @@ void ExpLineEdit::bind(const ObjectIdentifier& _path) {
|
||||
ExpressionBinding::bind(_path);
|
||||
|
||||
int frameWidth = style()->pixelMetric(QStyle::PM_SpinBoxFrameWidth);
|
||||
setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
|
||||
setStyleSheet(QStringLiteral("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
|
||||
|
||||
iconLabel->show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user