diff --git a/examples/corelib/serialization/convert/CMakeLists.txt b/examples/corelib/serialization/convert/CMakeLists.txt index d948d76ace..1d20fb07bd 100644 --- a/examples/corelib/serialization/convert/CMakeLists.txt +++ b/examples/corelib/serialization/convert/CMakeLists.txt @@ -20,7 +20,7 @@ qt_standard_project_setup() qt_add_executable(convert cborconverter.cpp cborconverter.h - converter.h + converter.cpp converter.h datastreamconverter.cpp datastreamconverter.h debugtextdumper.cpp debugtextdumper.h jsonconverter.cpp jsonconverter.h diff --git a/examples/corelib/serialization/convert/convert.pro b/examples/corelib/serialization/convert/convert.pro index c4c6e6722a..7592de7a22 100644 --- a/examples/corelib/serialization/convert/convert.pro +++ b/examples/corelib/serialization/convert/convert.pro @@ -11,6 +11,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/corelib/serialization/convert INSTALLS += target SOURCES += main.cpp \ + converter.cpp \ cborconverter.cpp \ datastreamconverter.cpp \ debugtextdumper.cpp \ diff --git a/examples/corelib/serialization/convert/converter.cpp b/examples/corelib/serialization/convert/converter.cpp new file mode 100644 index 0000000000..7ecd4134e9 --- /dev/null +++ b/examples/corelib/serialization/convert/converter.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "converter.h" + +Converter::Converter() +{ + converters().append(this); +} + +Converter::~Converter() +{ + converters().removeAll(this); +} + +QList &Converter::converters() +{ + Q_CONSTINIT static QList store; + return store; +} + +const QList &Converter::allConverters() +{ + return converters(); +} diff --git a/examples/corelib/serialization/convert/main.cpp b/examples/corelib/serialization/convert/main.cpp index a5b2c78f65..8f58043ad4 100644 --- a/examples/corelib/serialization/convert/main.cpp +++ b/examples/corelib/serialization/convert/main.cpp @@ -14,27 +14,6 @@ using namespace Qt::StringLiterals; -Converter::Converter() -{ - converters().append(this); -} - -Converter::~Converter() -{ - converters().removeAll(this); -} - -QList &Converter::converters() -{ - Q_CONSTINIT static QList store; - return store; -} - -const QList &Converter::allConverters() -{ - return converters(); -} - static const Converter *prepareConverter(QString format, Converter::Direction direction, QFile *stream) {