Skip to content

Class QAccelPlot::LegendModel

ClassList > QAccelPlot > LegendModel

List model of the legend entries of a list of series. More...

  • #include <LegendModel.hpp>

Inherits the following classes: QAbstractListModel

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1LegendModel["QAccelPlot::LegendModel"]

  external_base_classQAccelPlot_1_1LegendModel_1["QAbstractListModel"]
  external_base_classQAccelPlot_1_1LegendModel_1 --> classQAccelPlot_1_1LegendModel

Public Types

Type Name
enum Role
Data roles; the QML role names are listed in the class description.

Public Properties

Type Name
property int count
Read-only: number of rows.
property QList< PlotSeries * > series
Series to list, in legend order. Default: empty.

Public Signals

Type Name
signal void countChanged
Emitted when the number of rows changes.
signal void seriesChanged
Emitted when the series property changes.

Public Functions

Type Name
LegendModel (QObject * parent=nullptr)
Constructs an empty model with the given parent .
int count () const
Returns the number of rows.
QVariant data (const QModelIndex & index, int role) override const
Returns the value of role for the row at__index .
QHash< int, QByteArray > roleNames () override const
Returns the QML role names.
int rowCount (const QModelIndex & parent={}) override const
Returns the number of rows; parent must be invalid.
QList< PlotSeries * > series () const
Returns the listed series.
void setSeries (const QList< PlotSeries * > & series)
Sets the listed series to series .

Detailed Description

Has one row per PlotSeries::legendEntries() entry of each visible series in series: one row for most series, and one per category for a series colored by category. Series without an entry, such as HeatmapSeries, and hidden series have no row. Rows follow changes of the series' entries, names, and visibility.

Roles: series, name (the entry's name, else the series' name, its objectName, or "Series N"), and entry (a LegendEntry). Plot provides one over all its series as legendModel:

QAccelPlot.Plot {
    id: plot
    legend: QAccelPlot.Legend { model: QAccelPlot.LegendModel { series: [signal, fit] } }
}

See also: LegendEntry, PlotSeries::legendEntries()

Public Types Documentation

enum Role

Data roles; the QML role names are listed in the class description.

enum QAccelPlot::LegendModel::Role {
    SeriesRole = Qt::UserRole + 1,
    NameRole,
    EntryRole
};


Public Properties Documentation

property count

Read-only: number of rows.

int QAccelPlot::LegendModel::count;


property series

Series to list, in legend order. Default: empty.

QList<PlotSeries*> QAccelPlot::LegendModel::series;


Public Signals Documentation

signal countChanged

Emitted when the number of rows changes.

void QAccelPlot::LegendModel::countChanged;


signal seriesChanged

Emitted when the series property changes.

void QAccelPlot::LegendModel::seriesChanged;


Public Functions Documentation

function LegendModel

Constructs an empty model with the given parent .

explicit QAccelPlot::LegendModel::LegendModel (
    QObject * parent=nullptr
) 


function count

Returns the number of rows.

int QAccelPlot::LegendModel::count () const


function data

Returns the value of role for the row at__index .

QVariant QAccelPlot::LegendModel::data (
    const QModelIndex & index,
    int role
) override const


function roleNames

Returns the QML role names.

QHash< int, QByteArray > QAccelPlot::LegendModel::roleNames () override const


function rowCount

Returns the number of rows; parent must be invalid.

int QAccelPlot::LegendModel::rowCount (
    const QModelIndex & parent={}
) override const


function series

Returns the listed series.

QList< PlotSeries * > QAccelPlot::LegendModel::series () const


function setSeries

Sets the listed series to series .

void QAccelPlot::LegendModel::setSeries (
    const QList< PlotSeries * > & series
) 



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/legend/LegendModel.hpp