Skip to content

File TextTickLabelFormatter.hpp

File List > formatters > TextTickLabelFormatter.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/formatters/TickLabelFormatter.hpp"

#include <QStringList>
#include <QtQml/qqmlregistration.h>

namespace QAccelPlot {

class TextTickLabelFormatter : public TickLabelFormatter {
    Q_OBJECT
    QML_NAMED_ELEMENT(TextTickLabelFormatter)


    Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged)

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

    QStringList labels() const;
    void setLabels(const QStringList& labels);

    qreal minimumTickStep() const override;

signals:
    void labelsChanged();

protected:
    QString doFormat(qreal value, qreal tickStep) const override;

private:
    QStringList labels_;
};

} // namespace QAccelPlot