Skip to content

File Colors.hpp

File List > QAccelPlot > src > QAccelPlot > theme > Colors.hpp

Go to the documentation of this file

//
// SPDX-FileCopyrightText: 2026 Michal Grabarczyk
// SPDX-License-Identifier: GPL-3.0-only WITH Universal-FOSS-exception-1.0
//
// This file is also available under a separate commercial license.
// See COMMERCIAL-LICENSING.md for contact information.
//
#pragma once

#include "QAccelPlot/theme/ColorPalette.hpp"

#include <QObject>

#if __has_include(<QtQmlIntegration/qqmlintegration.h>)
#include <QtQmlIntegration/qqmlintegration.h>
#else
// QML_SINGLETON needs QQmlPrivate declared, which qqmlregistration.h alone does not pull in
// on Qt versions before the standalone QtQmlIntegration module (introduced in Qt 6.5).
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlregistration.h>
#endif

namespace QAccelPlot {

class Colors : public QObject {
    Q_OBJECT
    QML_NAMED_ELEMENT(Colors)
    QML_SINGLETON
    // Qt 6.3 and 6.4 register a singleton of a 0.x module without a name unless the added
    // version names major version 0 explicitly.
    QML_ADDED_IN_VERSION(0, 0)
    Q_PROPERTY(ColorPalette* dark READ dark CONSTANT)
    Q_PROPERTY(ColorPalette* light READ light CONSTANT)

public:
    explicit Colors(QObject* parent = nullptr);

    ColorPalette* dark() const;
    ColorPalette* light() const;
};

} // namespace QAccelPlot