Port androiddeployqt and uic from QStringRef to QStringView
Task-number: QTBUG-84319 Change-Id: I7f30a4d73dd98ee1977645d7274816cd71307506 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
31828b3d6b
commit
2393432cd0
@ -983,9 +983,10 @@ bool readInputFile(Options *options)
|
||||
const QJsonValue deploymentDependencies = jsonObject.value(QLatin1String("deployment-dependencies"));
|
||||
if (!deploymentDependencies.isUndefined()) {
|
||||
QString deploymentDependenciesString = deploymentDependencies.toString();
|
||||
const auto dependencies = deploymentDependenciesString.splitRef(QLatin1Char(','));
|
||||
for (const QStringRef &dependency : dependencies) {
|
||||
QString path = options->qtInstallDirectory + QLatin1Char('/') + dependency;
|
||||
const auto dependencies = QStringView{deploymentDependenciesString}.split(QLatin1Char(','));
|
||||
for (const auto &dependency : dependencies) {
|
||||
QString path = options->qtInstallDirectory + QChar::fromLatin1('/');
|
||||
path += dependency;
|
||||
if (QFileInfo(path).isDir()) {
|
||||
QDirIterator iterator(path, QDirIterator::Subdirectories);
|
||||
while (iterator.hasNext()) {
|
||||
@ -1137,7 +1138,7 @@ bool copyAndroidExtraLibs(Options *options)
|
||||
return true;
|
||||
|
||||
if (options->verbose)
|
||||
fprintf(stdout, "Copying %zd external libraries to package.\n", options->extraLibs.size());
|
||||
fprintf(stdout, "Copying %zd external libraries to package.\n", qsizetype(options->extraLibs.size()));
|
||||
|
||||
for (const QString &extraLib : options->extraLibs) {
|
||||
QFileInfo extraLibInfo(extraLib);
|
||||
|
@ -315,7 +315,7 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global)
|
||||
// Check for the old headers 'qslider.h' and replace by 'QtGui/QSlider'
|
||||
for (const QString &header : headers) {
|
||||
const QString value = m_oldHeaderToNewHeader.value(header, header);
|
||||
const auto trimmed = QStringRef(&value).trimmed();
|
||||
const auto trimmed = QStringView(value).trimmed();
|
||||
if (!trimmed.isEmpty())
|
||||
m_output << "#include " << openingQuote << trimmed << closingQuote << '\n';
|
||||
}
|
||||
|
@ -1308,7 +1308,7 @@ void WriteInitialization::writeProperties(const QString &varName,
|
||||
QTextStream str(&setFunction);
|
||||
if (stdset) {
|
||||
str << language::derefPointer <<"set" << propertyName.at(0).toUpper()
|
||||
<< propertyName.midRef(1) << '(';
|
||||
<< QStringView{propertyName}.mid(1) << '(';
|
||||
} else {
|
||||
str << language::derefPointer << QLatin1String("setProperty(\"")
|
||||
<< propertyName << "\", ";
|
||||
@ -2156,7 +2156,7 @@ void WriteInitialization::addInitializer(Item *item,
|
||||
if (!value.isEmpty()) {
|
||||
QString setter;
|
||||
QTextStream str(&setter);
|
||||
str << language::derefPointer << "set" << name.at(0).toUpper() << name.midRef(1) << '(';
|
||||
str << language::derefPointer << "set" << name.at(0).toUpper() << QStringView{name}.mid(1) << '(';
|
||||
if (column >= 0)
|
||||
str << column << ", ";
|
||||
str << value << ");";
|
||||
|
@ -394,12 +394,12 @@ static void formatMemberFnPtr(QTextStream &str, const SignalSlot &s,
|
||||
const int parenPos = s.signature.indexOf(QLatin1Char('('));
|
||||
Q_ASSERT(parenPos >= 0);
|
||||
if (useQOverload) {
|
||||
const auto parameters = s.signature.midRef(parenPos + 1,
|
||||
const auto parameters = QStringView{s.signature}.mid(parenPos + 1,
|
||||
s.signature.size() - parenPos - 2);
|
||||
str << "qOverload<" << parameters << ">(";
|
||||
}
|
||||
|
||||
const auto functionName = s.signature.leftRef(parenPos);
|
||||
const auto functionName = QStringView{s.signature}.left(parenPos);
|
||||
str << '&' << s.className << "::" << functionName;
|
||||
|
||||
if (useQOverload)
|
||||
@ -441,9 +441,9 @@ void formatConnection(QTextStream &str, const SignalSlot &sender, const SignalSl
|
||||
break;
|
||||
case Language::Python:
|
||||
str << sender.name << '.'
|
||||
<< sender.signature.leftRef(sender.signature.indexOf(QLatin1Char('(')))
|
||||
<< QStringView{sender.signature}.left(sender.signature.indexOf(QLatin1Char('(')))
|
||||
<< ".connect(" << receiver.name << '.'
|
||||
<< receiver.signature.leftRef(receiver.signature.indexOf(QLatin1Char('(')))
|
||||
<< QStringView{receiver.signature}.left(receiver.signature.indexOf(QLatin1Char('(')))
|
||||
<< ')';
|
||||
break;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static inline bool isCppCommentChar(QChar c)
|
||||
return c == QLatin1Char('/') || c == QLatin1Char('*');
|
||||
}
|
||||
|
||||
static int leadingCppCommentCharCount(const QStringRef &s)
|
||||
static int leadingCppCommentCharCount(QStringView s)
|
||||
{
|
||||
int i = 0;
|
||||
for (const int size = s.size(); i < size && isCppCommentChar(s.at(i)); ++i) {
|
||||
@ -142,7 +142,7 @@ void Uic::writeCopyrightHeaderPython(const DomUI *ui) const
|
||||
{
|
||||
QString comment = ui->elementComment();
|
||||
if (!comment.isEmpty()) {
|
||||
const auto lines = comment.splitRef(QLatin1Char('\n'));
|
||||
const auto lines = QStringView{comment}.split(QLatin1Char('\n'));
|
||||
for (const auto &line : lines) {
|
||||
if (const int leadingCommentChars = leadingCppCommentCharCount(line)) {
|
||||
out << language::repeat(leadingCommentChars, '#')
|
||||
|
Loading…
Reference in New Issue
Block a user