Skip to main content

class Heatmap

Source

A day grid coloured by a bucketed value, with a weekday axis and a level legend.

The grid is one focus stop. Arrow keys move a selected cell and wrap at the edges, so an eighty-four day grid does not become eighty-four tab stops. The selected cell is outlined, so the selection never depends on colour alone.

Inherits from QWidget

Functions​

Heatmap​

public Heatmap(QWidget * parent)

setDays​

public std::expected<void, ValueError> setDays(QList<HeatmapDay> days)

Replaces the grid. Days need not be contiguous or ordered; the grid lays them out by date with weeks as columns, matching a contribution graph. Non-finite values, invalid dates and spans wider than Qt's widget limit are rejected without replacing the grid. Storage follows supplied days.

setMaximum​

public void setMaximum(double maximum)

The value that maps to the top level. Zero is rejected: every day would then be the top level, which is a mistake in the caller's data.

setLevelCount​

public void setLevelCount(int count)

Bucket count above the empty cell. Clamped to one through four, because the ramp is read from a fixed set of role mixes.

setStartOfWeek​

public void setStartOfWeek(Qt::DayOfWeek day)

Invalid weekdays leave the current start unchanged.

setWeekdayLabelsVisible​

public void setWeekdayLabelsVisible(bool visible)

setLegendVisible​

public void setLegendVisible(bool visible)

setSelectedCell​

public void setSelectedCell(QPoint cell)

cellText​

public QString cellText(QPoint cell)

The accessible text for one cell, or an empty string when it is empty.

cellFor​

public QPoint cellFor(const QDate & date)

The week column and weekday row holding a date, or an invalid point when the grid does not hold it.

weekdayLabel​

public QString weekdayLabel(int row)

The axis label drawn for a weekday row, empty when labels are hidden.

setAccessiblePrefix​

public void setAccessiblePrefix(const QString & prefix)

sizeHint​

public QSize sizeHint()

minimumSizeHint​

public QSize minimumSizeHint()

cellActivated​

public void cellActivated(const QDate & date, double value)

selectionChanged​

public void selectionChanged(const QDate & date, double value)

paintEvent​

protected void paintEvent(QPaintEvent * )

mousePressEvent​

protected void mousePressEvent(QMouseEvent * )

mouseMoveEvent​

protected void mouseMoveEvent(QMouseEvent * )

leaveEvent​

protected void leaveEvent(QEvent * )

keyPressEvent​

protected void keyPressEvent(QKeyEvent * )

event​

protected bool event(QEvent * event)

changeEvent​

protected void changeEvent(QEvent * event)

days​

public QList<HeatmapDay> days()

Source

maximum​

public double maximum()

Source

levelCount​

public int levelCount()

Source

startOfWeek​

public Qt::DayOfWeek startOfWeek()

Source

weekdayLabelsVisible​

public bool weekdayLabelsVisible()

Source

legendVisible​

public bool legendVisible()

Source

weekCount​

public int weekCount()

Source

rowCount​

public int rowCount()

Source

selectedCell​

public QPoint selectedCell()

Source

The selected cell as a week column and a weekday row, or an invalid index.