1 Star 0 Fork 0

mashen666/Timeline

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mainwindow.cpp 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
kostas 提交于 2019-11-22 00:36 . first commit
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
scene= new QGraphicsScene();
view = new GraphicsView(scene);
scene->setSceneRect(360,0, 360, 180);
// view->scale(1,-1);
timeline = new TimeLine(view);
view->setInteractive(true);
view->setMouseTracking(true);
view->setFocus();
int outlineSize = 3;
QColor red(255,0,0);
QColor reddimmed(red.red()-80,red.green(),red.blue());
QColor purple(255, 51, 153);
QColor purpledimmed(153, 0, 77);
QColor green(102, 255, 102);
QColor greendimmed(51, 204, 51);
QColor blue(51, 102, 255);
QColor bluedimmed(0, 51, 204);
QColor orange(255, 153, 51);
QColor orangedimmed(255, 102, 0);
QPen penPurple(purple,outlineSize);
penPurple.setCapStyle(Qt::RoundCap);
QPen penGreen(green,outlineSize);
penGreen.setCapStyle(Qt::RoundCap);
QPen penBlue(blue,outlineSize);
penBlue.setCapStyle(Qt::RoundCap);
QPen penOrange(orange,outlineSize);
penOrange.setCapStyle(Qt::RoundCap);
QBrush brushPurple(purpledimmed);
QBrush brushGreen(greendimmed);
QBrush brushBlue(bluedimmed);
QBrush brushOrange(orangedimmed);
QBrush brush(reddimmed);
QPen pen(red,outlineSize);
pen.setCapStyle(Qt::RoundCap);
timeline->AddItem(QPointF(0,0), QRect(0,0,240,30), pen, brush);
timeline->AddItem(QPointF(0,0), QRect(0,0,240,30), penPurple, brushPurple);
timeline->AddItem(QPointF(60,35), QRect(0,0,40,30), penGreen, brushGreen);
timeline->AddItem(QPointF(60+50,35*2), QRect(0,0,100,30), penBlue, brushBlue);
timeline->AddItem(QPointF(60+100,35*3), QRect(0,0,340,30), penOrange, brushOrange);
setCentralWidget(view);
}
MainWindow::~MainWindow()
{
delete ui;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mashen666/Timeline.git
git@gitee.com:mashen666/Timeline.git
mashen666
Timeline
Timeline
master

搜索帮助