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, double > | displayTimeRange () |
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< double > | getTimes (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.
| |
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 |
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.
pqTimelinePainter::pqTimelinePainter | ( | QObject * | parent = nullptr | ) |
|
override |
void pqTimelinePainter::paint | ( | QPainter * | painter, |
const QModelIndex & | index, | ||
const QStyleOptionViewItem & | option | ||
) |
Paint the whole timeline for given index.
void pqTimelinePainter::setSceneStartTime | ( | double | time | ) |
cache scene start time.
void pqTimelinePainter::setSceneEndTime | ( | double | time | ) |
cache scene end time.
void pqTimelinePainter::setSceneCurrentTime | ( | double | time | ) |
cache scene current time.
double pqTimelinePainter::getSceneCurrentTime | ( | ) |
get scene cursor time
void pqTimelinePainter::setSceneLockStart | ( | bool | lock | ) |
cache scene lock start.
void pqTimelinePainter::setSceneLockEnd | ( | bool | lock | ) |
cache scene lock end
Set / Get the time range to display.
bool pqTimelinePainter::hasStartEndLabels | ( | ) |
Return true if there is at least 2 rects in cache.
QRect pqTimelinePainter::getStartLabelRect | ( | ) |
Return first cached rect.
QRect pqTimelinePainter::getEndLabelRect | ( | ) |
Return second cached rect.
Return position of the given time.
Return -1 if outside the painting area, i.e. if time is not inside [DisplayStartTime, DisplayEndTime].
Return position of the given time.
Return -1 if outside the painting area, i.e. if time is not inside [DisplayStartTime, DisplayEndTime].
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.
Return the time of the corresponding position.
If given index has stored times, return the nearest one.
Return the time of the corresponding position.
If given index has stored times, return the nearest one.
bool pqTimelinePainter::isTimeTrack | ( | QStandardItem * | item | ) |
return true if item is the main time track
bool pqTimelinePainter::isAnimationTrack | ( | QStandardItem * | item | ) |
return true if item is an animation track
std::vector<double> pqTimelinePainter::getTimes | ( | QStandardItem * | item | ) |
get item times using relevant data role.
double pqTimelinePainter::getSourceTime | ( | QStandardItem * | item | ) |
get source time using relevant data role.
QString pqTimelinePainter::getLabel | ( | QStandardItem * | item, |
int | index | ||
) |
return label for given index
|
protected |
paint background
|
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.
|
protected |
Paint the main timeline, with time labels and a mark for current scene time.
|
protected |
a temporal source times. Has a mark for scene time and one for source time.
|
protected |
animation track. One mark per keyframe.
|
protected |
time mark for source time
|
protected |
Paint time mark for scene time.
|
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.
|
protected |
a time mark, i.e a vertical line at given position.
|
protected |
Paint labels as annotation.
Return true if the annotation is effectively painted. Do not add label that collides on previously added labels.
|
protected |
Definition at line 158 of file pqTimelinePainter.h.
|
protected |
Definition at line 159 of file pqTimelinePainter.h.
|
protected |
Definition at line 160 of file pqTimelinePainter.h.
|
protected |
Definition at line 162 of file pqTimelinePainter.h.
|
protected |
Definition at line 163 of file pqTimelinePainter.h.
|
protected |
Definition at line 165 of file pqTimelinePainter.h.
|
protected |
Definition at line 166 of file pqTimelinePainter.h.