Skip to content

A timeline widget with smooth scrolling and adaptive zooming.

Notifications You must be signed in to change notification settings

Skoparov/Timeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Timeline

A simple timeline widget with smooth scrolling and zooming.

The concept is there are two types of items : tasks and events.

  • A task represents some continuous action, and events occur during the task's execution.
  • Any event must have a parent task.
  • Tasks may have different types, specified by a user.
  • There must be an axis for every task type (temporary, going to remove this constraint soon)
  • A unique style can be specified for every task type.
  • Both tasks and events have time duration.
  • There is a storage for tasks implemented as a separate class

So, a basic example of using the class may look as follows:

TaskStoragePtr taskStorage = std::make_shared<TaskStorage>();
SphereTimeLineWidget* timeLineWidget = new SphereTimeLineWidget(taskStorage);

TaskStyle testTaskStyle1(QBrush(Qt::red), QPen(Qt::red), ":/Sphere/Resources/timeline_warning_vector.svg");
TaskStyle testTaskStyle2(QBrush(Qt::blue), QPen(Qt::blue), "");
TaskStyle testTaskStyle3(QBrush(QColor(0, 87, 16)), QPen(QColor(0, 87, 16)), "");

timeLineWidget->addItemType(TEST_ITEM_TYPE_1, testTaskStyle1);
timeLineWidget->addItemType(TEST_ITEM_TYPE_2, testTaskStyle2);
timeLineWidget->addItemType(TEST_ITEM_TYPE_2, testTaskStyle3);

TaskItemPtr taskPtr = std::make_shared<TaskItem>(QDateTime::currentDateTime(), 
                                                 QDateTime::currentDateTime().addMonths(10), 
                                                 0,    //no end time
                                                 true, //task is infinite 
												 "TEST_TASK_NAME",
                                                 TEST_ITEM_TYPE_1 ));
                                             
taskStorage->addTask(taskPtr);

EventItemPtr eventPtr = std::make_shared<EventItem(QDateTime::currentDateTime().addMonth(5), 
                                                   QDateTime::currentDateTime().addMonth(6), 
                                                   OperationSphereItem::EVENT_STATUS_SUCCEDED));

taskStorage->addEvent(eventPtr);

About

A timeline widget with smooth scrolling and adaptive zooming.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages