uic: Change some QLatin1String literals to QString literals
While working on QTBUG-98434 some potential improvements were found in the pre-existing code. Some of the QLatin1String literals are used to initialize QStrings or are converted to QStrings and so it makes sense to replace them with QString literals. As a related change, change the type of namespaceDelimitier from QString to QL1SV, since it is used only for a function call and that function has an overload to take QL1SV. Task-number: QTBUG-103100 Change-Id: I56db6ddd84ad2a7133a765bb49ecd8f962ac5c13 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
3a7027a1ae
commit
8d7d210aa5
@ -120,7 +120,7 @@ void WriteDeclaration::acceptUI(DomUI *node)
|
||||
|
||||
void WriteDeclaration::acceptWidget(DomWidget *node)
|
||||
{
|
||||
QString className = "QWidget"_L1;
|
||||
QString className = u"QWidget"_s;
|
||||
if (node->hasAttributeClass())
|
||||
className = node->attributeClass();
|
||||
|
||||
@ -137,7 +137,7 @@ void WriteDeclaration::acceptSpacer(DomSpacer *node)
|
||||
|
||||
void WriteDeclaration::acceptLayout(DomLayout *node)
|
||||
{
|
||||
QString className = "QLayout"_L1;
|
||||
QString className = u"QLayout"_s;
|
||||
if (node->hasAttributeClass())
|
||||
className = node->attributeClass();
|
||||
|
||||
|
@ -37,7 +37,7 @@ WriteIncludes::WriteIncludes(Uic *uic) : WriteIncludesBase(uic),
|
||||
// When possible (no namespace) use the "QtModule/QClass" convention
|
||||
// and create a re-mapping of the old header "qclass.h" to it. Do not do this
|
||||
// for the "Phonon::Someclass" classes, however.
|
||||
const QString namespaceDelimiter = "::"_L1;
|
||||
const QLatin1StringView namespaceDelimiter = "::"_L1;
|
||||
for (const auto &e : classInfoEntries()) {
|
||||
const QString klass = QLatin1StringView(e.klass);
|
||||
const QString module = QLatin1StringView(e.module);
|
||||
|
@ -669,7 +669,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
|
||||
|
||||
const DomPropertyMap attributes = propertyMap(node->elementAttribute());
|
||||
|
||||
const QString pageDefaultString = "Page"_L1;
|
||||
const QString pageDefaultString = u"Page"_s;
|
||||
|
||||
if (cwi->extends(parentClass, "QMainWindow")) {
|
||||
if (cwi->extends(className, "QMenuBar")) {
|
||||
@ -781,10 +781,10 @@ void WriteInitialization::acceptWidget(DomWidget *node)
|
||||
};
|
||||
|
||||
static const QStringList trees = {
|
||||
"QTreeView"_L1, "QTreeWidget"_L1
|
||||
u"QTreeView"_s, u"QTreeWidget"_s
|
||||
};
|
||||
static const QStringList tables = {
|
||||
"QTableView"_L1, "QTableWidget"_L1
|
||||
u"QTableView"_s, u"QTableWidget"_s
|
||||
};
|
||||
|
||||
if (cwi->extendsOneOf(className, trees)) {
|
||||
@ -1237,8 +1237,8 @@ void WriteInitialization::writeProperties(const QString &varName,
|
||||
continue;
|
||||
}
|
||||
static const QStringList currentIndexWidgets = {
|
||||
"QComboBox"_L1, "QStackedWidget"_L1,
|
||||
"QTabWidget"_L1, "QToolBox"_L1
|
||||
u"QComboBox"_s, u"QStackedWidget"_s,
|
||||
u"QTabWidget"_s, u"QToolBox"_s
|
||||
};
|
||||
if (propertyName == "currentIndex"_L1 // set currentIndex later
|
||||
&& (m_uic->customWidgetsInfo()->extendsOneOf(className, currentIndexWidgets))) {
|
||||
@ -1929,7 +1929,7 @@ QString WriteInitialization::writeBrushInitialization(const DomBrush *brush)
|
||||
|
||||
void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brushName)
|
||||
{
|
||||
QString style = "SolidPattern"_L1;
|
||||
QString style = u"SolidPattern"_s;
|
||||
if (brush->hasAttributeBrushStyle())
|
||||
style = brush->attributeBrushStyle();
|
||||
|
||||
|
@ -96,7 +96,7 @@ bool CustomWidgetsInfo::isAmbiguousSignal(const QString &className,
|
||||
QString CustomWidgetsInfo::realClassName(const QString &className) const
|
||||
{
|
||||
if (className == "Line"_L1)
|
||||
return "QFrame"_L1;
|
||||
return u"QFrame"_s;
|
||||
|
||||
return className;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ QString Driver::headerFileName() const
|
||||
QString Driver::headerFileName(const QString &fileName)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return headerFileName("noname"_L1);
|
||||
return headerFileName(u"noname"_s);
|
||||
|
||||
QFileInfo info(fileName);
|
||||
QString baseName = info.baseName();
|
||||
|
@ -58,9 +58,9 @@ QString self;
|
||||
QString eol;
|
||||
QString emptyString;
|
||||
|
||||
QString cppQualifier = "::"_L1;
|
||||
QString cppTrue = "true"_L1;
|
||||
QString cppFalse = "false"_L1;
|
||||
QString cppQualifier = u"::"_s;
|
||||
QString cppTrue = u"true"_s;
|
||||
QString cppFalse = u"false"_s;
|
||||
|
||||
QTextStream &operator<<(QTextStream &str, const qtConfig &c)
|
||||
{
|
||||
|
@ -291,9 +291,9 @@ void Uic::writeHeaderProtectionEnd()
|
||||
bool Uic::isButton(const QString &className) const
|
||||
{
|
||||
static const QStringList buttons = {
|
||||
"QRadioButton"_L1, "QToolButton"_L1,
|
||||
"QCheckBox"_L1, "QPushButton"_L1,
|
||||
"QCommandLinkButton"_L1
|
||||
u"QRadioButton"_s, u"QToolButton"_s,
|
||||
u"QCheckBox"_s, u"QPushButton"_s,
|
||||
u"QCommandLinkButton"_s
|
||||
};
|
||||
return customWidgetsInfo()->extendsOneOf(className, buttons);
|
||||
}
|
||||
@ -301,10 +301,10 @@ bool Uic::isButton(const QString &className) const
|
||||
bool Uic::isContainer(const QString &className) const
|
||||
{
|
||||
static const QStringList containers = {
|
||||
"QStackedWidget"_L1, "QToolBox"_L1,
|
||||
"QTabWidget"_L1, "QScrollArea"_L1,
|
||||
"QMdiArea"_L1, "QWizard"_L1,
|
||||
"QDockWidget"_L1
|
||||
u"QStackedWidget"_s, u"QToolBox"_s,
|
||||
u"QTabWidget"_s, u"QScrollArea"_s,
|
||||
u"QMdiArea"_s, u"QWizard"_s,
|
||||
u"QDockWidget"_s
|
||||
};
|
||||
|
||||
return customWidgetsInfo()->extendsOneOf(className, containers);
|
||||
@ -313,7 +313,7 @@ bool Uic::isContainer(const QString &className) const
|
||||
bool Uic::isMenu(const QString &className) const
|
||||
{
|
||||
static const QStringList menus = {
|
||||
"QMenu"_L1, "QPopupMenu"_L1
|
||||
u"QMenu"_s, u"QPopupMenu"_s
|
||||
};
|
||||
return customWidgetsInfo()->extendsOneOf(className, menus);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user