/*! * * Copyright (c) 2021 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file VUIPostSingleResultData.h * \author (last) Peter Lucia * \date (last) 21-May-2021 * \author (original) Peter Lucia * \date (original) 21-May-2021 * */ #pragma once // Qt #include #include // Project #include "main.h" // Doxygen : don't remove #include "VView.h" #include "MSettings.h" // namespace namespace View { /*! * \brief The VUIPost class * \details View for displaying UI power on self test results * */ class VUIPostSingleResult : public QAbstractListModel { Q_OBJECT PROPERTY(quint32, result, 0) PROPERTY(quint32, index, 0) VIEW_DEC_SLOT(SettingsData) private: struct PostTest { QString name; quint32 result = 2; }; QList _tests; public: explicit VUIPostSingleResult(QAbstractListModel *parent = nullptr); enum TestDataRole { TestNameRole = Qt::UserRole + 1, TestResultRole, }; protected: int rowCount (const QModelIndex &parent = QModelIndex()) const override; QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override; QHash roleNames() const override; bool setData(int vIndex, const QVariant &vValue, const TestDataRole &vRole); void removeAllRows(); private: void initConnections(); void addSelfTest(const PostTest &vTest); }; }