Public Member Functions | Protected Attributes | List of all members
pqTimelinePainter Class Reference

pqTimelineItemDelegate draws timeline in cells. More...

#include <pqTimelinePainter.h>

Inherits QObject.

Public Member Functions

 pqTimelinePainter (QObject *parent=nullptr)
 
 ~pqTimelinePainter () override
 
void paint (QPainter *painter, const QModelIndex &index, const QStyleOptionViewItem &option)
 Paint the whole timeline for given index. More...
 
Scene informations

Cache information about scene for display purpose.

This is useful to compute tick position, and to do specific label display for locked start and end end.

void setSceneStartTime (double time)
 
void setSceneEndTime (double time)
 cache scene end time. More...
 
void setSceneCurrentTime (double time)
 cache scene current time. More...
 
double getSceneCurrentTime ()
 get scene cursor time More...
 
void setSceneLockStart (bool lock)
 cache scene lock start. More...
 
void setSceneLockEnd (bool lock)
 cache scene lock end More...
 
void setDisplayTimeRange (double start, double end)
 Set / Get the time range to display. More...
 
QPair< double, doubledisplayTimeRange ()
 Set / Get the time range to display. More...
 
Start and End rectangles

Get Start and End labels rectangle.

bool hasStartEndLabels ()
 
QRect getStartLabelRect ()
 Return first cached rect. More...
 
QRect getEndLabelRect ()
 Return second cached rect. More...
 
double positionFromTime (double time, const QStyleOptionViewItem &option)
 Return position of the given time. More...
 
double positionFromTime (double time)
 Return position of the given time. More...
 
double indexTimeFromPosition (double pos, const QStyleOptionViewItem &option, const QModelIndex &index)
 Return the time of the corresponding position. More...
 
double timeFromPosition (double pos, const QStyleOptionViewItem &option)
 Return the time of the corresponding position. More...
 
double timeFromPosition (double pos)
 Return the time of the corresponding position. More...
 
Items infos

Extract information from the item data.

bool isTimeTrack (QStandardItem *item)
 
bool isAnimationTrack (QStandardItem *item)
 return true if item is an animation track More...
 
std::vector< doublegetTimes (QStandardItem *item)
 get item times using relevant data role. More...
 
double getSourceTime (QStandardItem *item)
 get source time using relevant data role. More...
 
QString getLabel (QStandardItem *item, int index)
 return label for given index More...
 

Protected Member Functions

Paint methods

Paint the different elements of the track.

Those are mainly called from internal code.

See also
paint
void paintBackground (QPainter *painter, const QStyleOptionViewItem &option, bool alternate)
 
void paintTimeline (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item, bool paintLabels, const QStyleOptionViewItem &labelsOption)
 Paint the whole timeline for given track, i.e. More...
 
void paintTimeTrack (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item)
 Paint the main timeline, with time labels and a mark for current scene time. More...
 
void paintSourceTrack (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item)
 a temporal source times. Has a mark for scene time and one for source time. More...
 
void paintAnimationTrack (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item)
 animation track. One mark per keyframe. More...
 
void paintSourcePipelineTime (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item)
 time mark for source time More...
 
void paintSceneCurrentTime (QPainter *painter, const QStyleOptionViewItem &option)
 Paint time mark for scene time. More...
 
bool paintTick (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item, double time, bool paintLabels, const QStyleOptionViewItem &labelsOption, const QString &label)
 a tick, i.e. More...
 
void paintTimeMark (QPainter *painter, const QStyleOptionViewItem &option, double pos)
 a time mark, i.e a vertical line at given position. More...
 
bool paintLabel (QPainter *painter, const QStyleOptionViewItem &option, QStandardItem *item, double time, const QString &label)
 Paint labels as annotation. More...
 

Protected Attributes

double SceneCurrentTime = 0
 
double SceneStartTime = 0
 
double SceneEndTime = 1
 
double DisplayStartTime = 0.
 
double DisplayEndTime = 1.
 
bool SceneLockStart = false
 
bool SceneLockEnd = false
 

Detailed Description

pqTimelineItemDelegate draws timeline in cells.

A timeline is a list of ticks optionally labeled.

Inner data of QStandardItemModel are used from the following custom roles:

Drawing also depends on the pqTimelineItemRole::TYPE of the current item.

Definition at line 29 of file pqTimelinePainter.h.

Constructor & Destructor Documentation

◆ pqTimelinePainter()

pqTimelinePainter::pqTimelinePainter ( QObject *  parent = nullptr)

◆ ~pqTimelinePainter()

pqTimelinePainter::~pqTimelinePainter ( )
override

Member Function Documentation

◆ paint()

void pqTimelinePainter::paint ( QPainter *  painter,
const QModelIndex &  index,
const QStyleOptionViewItem &  option 
)

Paint the whole timeline for given index.

◆ setSceneStartTime()

void pqTimelinePainter::setSceneStartTime ( double  time)

cache scene start time.

◆ setSceneEndTime()

void pqTimelinePainter::setSceneEndTime ( double  time)

cache scene end time.

◆ setSceneCurrentTime()

void pqTimelinePainter::setSceneCurrentTime ( double  time)

cache scene current time.

◆ getSceneCurrentTime()

double pqTimelinePainter::getSceneCurrentTime ( )

get scene cursor time

◆ setSceneLockStart()

void pqTimelinePainter::setSceneLockStart ( bool  lock)

cache scene lock start.

◆ setSceneLockEnd()

void pqTimelinePainter::setSceneLockEnd ( bool  lock)

cache scene lock end

◆ setDisplayTimeRange()

void pqTimelinePainter::setDisplayTimeRange ( double  start,
double  end 
)

Set / Get the time range to display.

◆ displayTimeRange()

QPair<double, double> pqTimelinePainter::displayTimeRange ( )

Set / Get the time range to display.

◆ hasStartEndLabels()

bool pqTimelinePainter::hasStartEndLabels ( )

Return true if there is at least 2 rects in cache.

◆ getStartLabelRect()

QRect pqTimelinePainter::getStartLabelRect ( )

Return first cached rect.

◆ getEndLabelRect()

QRect pqTimelinePainter::getEndLabelRect ( )

Return second cached rect.

◆ positionFromTime() [1/2]

double pqTimelinePainter::positionFromTime ( double  time,
const QStyleOptionViewItem &  option 
)

Return position of the given time.

Return -1 if outside the painting area, i.e. if time is not inside [DisplayStartTime, DisplayEndTime].

◆ positionFromTime() [2/2]

double pqTimelinePainter::positionFromTime ( double  time)

Return position of the given time.

Return -1 if outside the painting area, i.e. if time is not inside [DisplayStartTime, DisplayEndTime].

◆ indexTimeFromPosition()

double pqTimelinePainter::indexTimeFromPosition ( double  pos,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
)

Return the time of the corresponding position.

If given index has stored times, return the nearest one.

◆ timeFromPosition() [1/2]

double pqTimelinePainter::timeFromPosition ( double  pos,
const QStyleOptionViewItem &  option 
)

Return the time of the corresponding position.

If given index has stored times, return the nearest one.

◆ timeFromPosition() [2/2]

double pqTimelinePainter::timeFromPosition ( double  pos)

Return the time of the corresponding position.

If given index has stored times, return the nearest one.

◆ isTimeTrack()

bool pqTimelinePainter::isTimeTrack ( QStandardItem *  item)

return true if item is the main time track

◆ isAnimationTrack()

bool pqTimelinePainter::isAnimationTrack ( QStandardItem *  item)

return true if item is an animation track

◆ getTimes()

std::vector<double> pqTimelinePainter::getTimes ( QStandardItem *  item)

get item times using relevant data role.

◆ getSourceTime()

double pqTimelinePainter::getSourceTime ( QStandardItem *  item)

get source time using relevant data role.

◆ getLabel()

QString pqTimelinePainter::getLabel ( QStandardItem *  item,
int  index 
)

return label for given index

◆ paintBackground()

void pqTimelinePainter::paintBackground ( QPainter *  painter,
const QStyleOptionViewItem &  option,
bool  alternate 
)
protected

paint background

◆ paintTimeline()

void pqTimelinePainter::paintTimeline ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item,
bool  paintLabels,
const QStyleOptionViewItem &  labelsOption 
)
protected

Paint the whole timeline for given track, i.e.

loop over times to draw ticks and optionnal labels. Special code path to ensure Start and End visibility and position.

◆ paintTimeTrack()

void pqTimelinePainter::paintTimeTrack ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item 
)
protected

Paint the main timeline, with time labels and a mark for current scene time.

◆ paintSourceTrack()

void pqTimelinePainter::paintSourceTrack ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item 
)
protected

a temporal source times. Has a mark for scene time and one for source time.

◆ paintAnimationTrack()

void pqTimelinePainter::paintAnimationTrack ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item 
)
protected

animation track. One mark per keyframe.

◆ paintSourcePipelineTime()

void pqTimelinePainter::paintSourcePipelineTime ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item 
)
protected

time mark for source time

◆ paintSceneCurrentTime()

void pqTimelinePainter::paintSceneCurrentTime ( QPainter *  painter,
const QStyleOptionViewItem &  option 
)
protected

Paint time mark for scene time.

◆ paintTick()

bool pqTimelinePainter::paintTick ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item,
double  time,
bool  paintLabels,
const QStyleOptionViewItem &  labelsOption,
const QString &  label 
)
protected

a tick, i.e.

a mark corresponding to given time. Optionnally paint the associated label. When painting labels, the non-labeled ticks are half-sized, for readability. Return true if the label was painted.

◆ paintTimeMark()

void pqTimelinePainter::paintTimeMark ( QPainter *  painter,
const QStyleOptionViewItem &  option,
double  pos 
)
protected

a time mark, i.e a vertical line at given position.

◆ paintLabel()

bool pqTimelinePainter::paintLabel ( QPainter *  painter,
const QStyleOptionViewItem &  option,
QStandardItem *  item,
double  time,
const QString &  label 
)
protected

Paint labels as annotation.

Return true if the annotation is effectively painted. Do not add label that collides on previously added labels.

Member Data Documentation

◆ SceneCurrentTime

double pqTimelinePainter::SceneCurrentTime = 0
protected

Definition at line 158 of file pqTimelinePainter.h.

◆ SceneStartTime

double pqTimelinePainter::SceneStartTime = 0
protected

Definition at line 159 of file pqTimelinePainter.h.

◆ SceneEndTime

double pqTimelinePainter::SceneEndTime = 1
protected

Definition at line 160 of file pqTimelinePainter.h.

◆ DisplayStartTime

double pqTimelinePainter::DisplayStartTime = 0.
protected

Definition at line 162 of file pqTimelinePainter.h.

◆ DisplayEndTime

double pqTimelinePainter::DisplayEndTime = 1.
protected

Definition at line 163 of file pqTimelinePainter.h.

◆ SceneLockStart

bool pqTimelinePainter::SceneLockStart = false
protected

Definition at line 165 of file pqTimelinePainter.h.

◆ SceneLockEnd

bool pqTimelinePainter::SceneLockEnd = false
protected

Definition at line 166 of file pqTimelinePainter.h.


The documentation for this class was generated from the following file: