diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2017-03-07 12:30:45 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2017-03-07 14:53:20 +0000 |
commit | 424dd6e931f8a97709ac3713e37014e2c257e94f (patch) | |
tree | da4ac1646cadfc92c621d552560540e36e986b8d | |
parent | a9404523588b22fb9f4baab6348832a0f4fce2ad (diff) | |
download | qtapplicationmanager-424dd6e931f8a97709ac3713e37014e2c257e94f.tar.gz |
Fix for building against Qt 5.6
QByteArray::append(int count, char c) was only added in Qt 5.7.
Change-Id: Iefc356e9b60e49f3c45b1987c7ff0eed6155edd4
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r-- | src/common-lib/global.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common-lib/global.cpp b/src/common-lib/global.cpp index 653e3d9b..4b0cb491 100644 --- a/src/common-lib/global.cpp +++ b/src/common-lib/global.cpp @@ -222,7 +222,18 @@ static void colorLogToStderr(QtMsgType msgType, const QMessageLogContext &contex while (spacing < 0) spacing += consoleWidth; } +#if QT_VERSION < QT_VERSION_CHECK(5,7,0) + // efficiently appending spaces without allocating is hard in Qt 5.6 + static const char spacingStr[] = " "; + Q_STATIC_ASSERT(sizeof(spacingStr) == 80); + while (spacing > 0) { + int spacingLen = qMin(spacing, int(sizeof(spacingStr)) - 1); + out.append(spacingStr, spacingLen); + spacing -= spacingLen; + } +#else out.append(spacing, ' '); +#endif out.append('['); color(out, Magenta); |