加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
timeline.cpp 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
kostas 提交于 2019-11-22 00:36 . first commit
#include "timeline.h"
TimeLine::TimeLine(QWidget *parent) :
QWidget(parent)
{
}
QColor Track::selectedColor = QColor(200,30,180);
QColor Track::selectedColorOutline = Track::selectedColor.lighter(30);
int Track::penWidth = 2;
bool Track::hasShadow = false;
float Track::thresholdShadow=0.0f;
int Track::rounded = 10;
TimeLine::TimeLine(QGraphicsView *_view, QWidget *_parent)
{
if (_view) view = _view;
else view = new QGraphicsView(this);
scene = view->scene();
setMouseTracking(true);
int xOffset =100;
for(int i =0; i < 10; i++){
QGraphicsItem *item = scene->addText(QString::number(i));
item->setPos(i*xOffset,-40);
}
indicator = new Indicator(height());
scene->addItem(indicator);
indicator->setZValue(101);
Track *track = new Track(200,QColor(Qt::cyan),scene);
scene->addItem(track);
track->setPos(QPointF(300,0));
}
TimeLine::~TimeLine()
{
}
void TimeLine::AddItem(QPointF pos, QRect rect, QPen pen, QBrush brush)
{
QGraphicsItem *item = scene->addRect(rect,pen,brush);
item->setPos(pos);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化