uic: Fix mismatches between QString/QLatin1StringView

While working on QTBUG-98434 some potential improvements were found
for pre-existing issues, for example some variables were wrongly
initialized. Fix the mismatches between QString/QLatin1StringView.


Task-number: QTBUG-103100
Change-Id: Ib120452fe8012cda3f9becea8f9837efc38cf199
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mate Barany 2022-09-01 16:56:21 +02:00 committed by Marc Mutz
parent cd37a773ca
commit 84c494d0f2
3 changed files with 7 additions and 7 deletions

View File

@ -90,7 +90,7 @@ void WriteIncludes::insertIncludeForClass(const QString &className, QString head
// Quick check by class name to detect includehints provided for custom widgets.
// Remove namespaces
QString lowerClassName = className.toLower();
static const QString namespaceSeparator = "::"_L1;
static const auto namespaceSeparator = "::"_L1;
const int namespaceIndex = lowerClassName.lastIndexOf(namespaceSeparator);
if (namespaceIndex != -1)
lowerClassName.remove(0, namespaceIndex + namespaceSeparator.size());

View File

@ -864,7 +864,7 @@ void WriteInitialization::addButtonGroup(const DomWidget *buttonNode, const QStr
const QString groupName = m_driver->findOrInsertButtonGroup(group);
// Create on demand
if (!m_buttonGroups.contains(groupName)) {
const QString className = "QButtonGroup"_L1;
const QString className = u"QButtonGroup"_s;
m_output << m_indent;
if (createGroupOnTheFly)
m_output << className << " *";
@ -1002,7 +1002,7 @@ static inline QString formLayoutRole(int column, int colspan)
static QString layoutAddMethod(DomLayoutItem::Kind kind, const QString &layoutClass)
{
const QString methodPrefix = layoutClass == "QFormLayout"_L1 ? "set"_L1 : "add"_L1;
const auto methodPrefix = layoutClass == "QFormLayout"_L1 ? "set"_L1 : "add"_L1;
switch (kind) {
case DomLayoutItem::Widget:
return methodPrefix + "Widget"_L1;
@ -1273,9 +1273,9 @@ void WriteInitialization::writeProperties(const QString &varName,
} else if (propertyName == "orientation"_L1
&& m_uic->customWidgetsInfo()->extends(className, "Line")) {
// Line support
QString shape = "QFrame::HLine"_L1;
QString shape = u"QFrame::HLine"_s;
if (p->elementEnum() == "Qt::Vertical"_L1)
shape = "QFrame::VLine"_L1;
shape = u"QFrame::VLine"_s;
m_output << m_indent << varName << language::derefPointer << "setFrameShape("
<< language::enumValue(shape) << ')' << language::eol;

View File

@ -146,7 +146,7 @@ void Uic::writeCopyrightHeaderPython(const DomUI *ui) const
static double versionFromUiAttribute(QXmlStreamReader &reader)
{
const QXmlStreamAttributes attributes = reader.attributes();
const QString versionAttribute = "version"_L1;
const auto versionAttribute = "version"_L1;
if (!attributes.hasAttribute(versionAttribute))
return 4.0;
const QStringView version = attributes.value(versionAttribute);
@ -157,7 +157,7 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader)
{
DomUI *ui = nullptr;
const QString uiElement = "ui"_L1;
const auto uiElement = "ui"_L1;
while (!reader.atEnd()) {
if (reader.readNext() == QXmlStreamReader::StartElement) {
if (reader.name().compare(uiElement, Qt::CaseInsensitive) == 0