Skip to content

Commit 908c718

Browse files
committed
fixed clang-tidy warnings for Qt5
1 parent dbec0d1 commit 908c718

File tree

11 files changed

+61
-1
lines changed

11 files changed

+61
-1
lines changed

include/orm/tiny/tinybuilder.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,11 @@ namespace Orm::Tiny
13131313
progress.reserve(names.size());
13141314

13151315
for (auto &&segment : names) {
1316+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1317+
progress << segment;
1318+
#else
13161319
progress << std::move(segment);
1320+
#endif
13171321

13181322
auto last = progress.join(DOT);
13191323
const auto containsRelation = [&last](const auto &relation)

include/orm/utils/query.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ namespace Orm::Utils
105105
queryString.replace(queryString.indexOf(QLatin1Char('?')), 1, bindingValue);
106106

107107
if (simpleBindings)
108-
simpleBindingsList << std::move(bindingValue); // clazy:exclude=reserve-candidates
108+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
109+
simpleBindingsList << bindingValue;
110+
#else
111+
simpleBindingsList << std::move(bindingValue);
112+
#endif
109113
}
110114

111115
return {std::move(queryString), std::move(simpleBindingsList)};

src/orm/exceptions/sqlerror.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,25 @@ QString SqlError::formatMessage(const char *message, const QSqlError &error)
4949
errorText.reserve(3);
5050

5151
if (!nativeErrorCode.isEmpty())
52+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
53+
errorText << nativeErrorCode;
54+
#else
5255
errorText << std::move(nativeErrorCode);
56+
#endif
5357

5458
if (!driverText.isEmpty())
59+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
60+
errorText << driverText;
61+
#else
5562
errorText << std::move(driverText);
63+
#endif
5664

5765
if (!databaseText.isEmpty())
66+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
67+
errorText << databaseText;
68+
#else
5869
errorText << std::move(databaseText);
70+
#endif
5971

6072
result += errorText.join(COMMA);
6173

src/orm/schema/blueprint.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ QVector<QString> Blueprint::toSql(const DatabaseConnection &connection,
6363
if (auto sql = grammar.invokeCompileMethod(*command, connection, *this);
6464
!sql.isEmpty()
6565
)
66+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
67+
statements << sql;
68+
#else
6669
statements << std::move(sql);
70+
#endif
6771

6872
return statements;
6973
}

src/orm/types/sqlquery.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ SqlQuery::SqlQuery(QSqlQuery &&other, const QtTimeZoneConfig &qtTimeZone, // NOL
1818
const QueryGrammar &queryGrammar,
1919
const std::optional<bool> returnQDateTime
2020
)
21+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
22+
: QSqlQuery(other)
23+
#else
2124
: QSqlQuery(std::move(other))
25+
#endif
2226
, m_qtTimeZone(qtTimeZone)
2327
, m_isConvertingTimeZone(m_qtTimeZone.type != QtTimeZoneType::DontConvert)
2428
, m_isSQLiteDb(driver()->dbmsType() == QSqlDriver::DbmsType::SQLite)

tom/src/tom/application.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,11 @@ void Application::prependOptions(QList<CommandLineOption> &&options)
316316
m_options = std::move(options);
317317

318318
// Common options after Command options
319+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
320+
m_options << commonOptions;
321+
#else
319322
m_options << std::move(commonOptions);
323+
#endif
320324
}
321325

322326
/* Run command */

tom/src/tom/commands/command.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ QStringList Command::values(const QString &name) const
221221
// Support passing more values delimited by comma
222222
for (auto &&value : values) {
223223
if (!value.contains(regex)) {
224+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
225+
valuesSplitted << value;
226+
#else
224227
valuesSplitted << std::move(value);
228+
#endif
225229

226230
continue;
227231
}

tom/src/tom/commands/completecommand.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,12 @@ int CompleteCommand::printGuessedCommands(
255255
#ifdef _MSC_VER
256256
guessedCommands << QStringLiteral("%1;%2;%3").arg(commandName, commandName,
257257
command->description());
258+
#else
259+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
260+
guessedCommands << commandName;
258261
#else
259262
guessedCommands << std::move(commandName);
263+
#endif
260264
#endif
261265
}
262266

@@ -414,8 +418,12 @@ int CompleteCommand::printGuessedLongOptions(
414418
#ifdef _MSC_VER
415419
options << QStringLiteral("%1;%2;%3").arg(longOption, longOption,
416420
option.description());
421+
#else
422+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
423+
options << longOption;
417424
#else
418425
options << std::move(longOption);
426+
#endif
419427
#endif
420428
}
421429
// With a value
@@ -431,8 +439,12 @@ int CompleteCommand::printGuessedLongOptions(
431439
.arg(longOption, longOptionList,
432440
option.description(),
433441
getOptionDefaultValue(option));
442+
#else
443+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
444+
options << longOption;
434445
#else
435446
options << std::move(longOption);
447+
#endif
436448
#endif
437449
}
438450
}

tom/src/tom/concerns/callscommands.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ CallsCommands::createCommandLineArguments(
6060
newArguments.reserve(currentArguments.size() + arguments.size());
6161

6262
// Absolute path of the exe name
63+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
64+
newArguments << currentArguments.constFirst();
65+
#else
6366
newArguments << std::move(currentArguments.first());
67+
#endif
6468
// Command name
6569
newArguments << command;
6670

tom/src/tom/concerns/interactswithio.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,11 @@ QString InteractsWithIO::errorWallInternal(const QString &string) const
494494
// Split lines by the given width
495495
for (const auto &lineNl : splitted)
496496
for (auto &&line : StringUtils::splitStringByWidth(lineNl, maxLineWidth))
497+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
498+
lines << line;
499+
#else
497500
lines << std::move(line);
501+
#endif
498502
}
499503

500504
QString output;

tom/src/tom/tomutils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ Utils::convertToQCommandLineOptionList(QList<CommandLineOption> &&options)
8484
result.reserve(options.size());
8585

8686
for (auto &&option : options)
87+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
88+
result << option;
89+
#else
8790
result << std::move(option);
91+
#endif
8892

8993
return result;
9094
}

0 commit comments

Comments
 (0)