Skip to content

Commit c8a05b9

Browse files
committed
Make code Qt 6 compatible / raises minimum Qt 5 version to 5.14
In addition to replacing Qt5 with Qt6 in CMakeLists.txt two small changes to the code are needed to make things build on Qt 6 (which in turn is needed for Apple M1/M2 support). The cost of this change is that when building on Qt 5, at least version 5.14 is needed. Certain older but still used Linux distributions such as Ubuntu 10.04 LTS still use 5.12, so revert this commit if you are building on those...
1 parent 08599d0 commit c8a05b9

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ set(SOURCES "main.cpp" "imagewriter.cpp" "networkaccessmanagerfactory.cpp"
100100
"devicewrapper.cpp" "devicewrapperblockcacheentry.cpp" "devicewrapperpartition.cpp" "devicewrapperfatpartition.cpp"
101101
"driveformatthread.cpp" "localfileextractthread.cpp" "powersaveblocker.cpp" "downloadstatstelemetry.cpp" "qml.qrc" "dependencies/sha256crypt/sha256crypt.c" "cli.cpp")
102102

103-
find_package(Qt5 COMPONENTS Core Quick LinguistTools Svg OPTIONAL_COMPONENTS Widgets)
103+
find_package(Qt5 5.14 COMPONENTS Core Quick LinguistTools Svg OPTIONAL_COMPONENTS Widgets)
104104
if (Qt5Widgets_FOUND)
105105
set(EXTRALIBS ${EXTRALIBS} Qt5::Widgets)
106106
endif()

src/OptionsPopup.qml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (C) 2021 Raspberry Pi Ltd
44
*/
55

6-
import QtQuick 2.9
6+
import QtQuick 2.15
77
import QtQuick.Controls 2.2
88
import QtQuick.Layouts 1.0
99
import QtQuick.Controls.Material 2.2
@@ -128,9 +128,7 @@ Popup {
128128
id: fieldHostname
129129
enabled: chkHostname.checked
130130
text: "raspberrypi"
131-
/* FIXME: use RegularExpressionValidator instead when moving to newer Qt version.
132-
It is not available in 5.12 that is still being used by Ubuntu 20 LTS though */
133-
validator: RegExpValidator { regExp: /[0-9A-Za-z][0-9A-Za-z-]{0,62}/ }
131+
validator: RegularExpressionValidator { regularExpression: /[0-9A-Za-z][0-9A-Za-z-]{0,62}/ }
134132
}
135133
Text {
136134
text : ".local"

src/devicewrapperfatpartition.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "devicewrapperfatpartition.h"
22
#include "devicewrapperstructs.h"
3-
#include "qdebug.h"
43

54
/*
65
* SPDX-License-Identifier: Apache-2.0
@@ -314,7 +313,7 @@ void DeviceWrapperFatPartition::writeFile(const QString &filename, const QByteAr
314313
for (uint32_t cluster : qAsConst(clusterList))
315314
{
316315
seekCluster(cluster);
317-
write(contents.data()+pos, qMin(_bytesPerCluster, contents.length()-pos));
316+
write(contents.data()+pos, qMin((qsizetype)_bytesPerCluster, (qsizetype)(contents.length()-pos)));
318317

319318
pos += _bytesPerCluster;
320319
if (pos >= contents.length())

0 commit comments

Comments
 (0)