Skip to content

Commit

Permalink
Update timeline frame range scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 19, 2023
1 parent 496a3eb commit 26af22a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
33 changes: 12 additions & 21 deletions src/app/GUI/animationwidgetscrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ void FrameScrollBar::paintEvent(QPaintEvent *) {
const int handleLeft = mBottom ? qRound(hLeftFrames*pixPerFrame + x0) : qRound((hLeftFrames*pixPerFrame + x0)+(handleWidth/2)-(handleFixedWidth/2));

handleRect.setLeft(handleLeft);
handleRect.setTop(mBottom ? 0 : 5);
handleRect.setTop(mBottom ? 2 : 5);
handleRect.setWidth(mBottom ? handleWidth : handleFixedWidth);
handleRect.setBottom(mBottom ? 4 : height());
handleRect.setBottom(mBottom ? 6 : height());
p.fillRect(handleRect, col);

if (mCurrentCanvas) {
Expand Down Expand Up @@ -125,27 +125,18 @@ void FrameScrollBar::paintEvent(QPaintEvent *) {

const qreal threeFourthsHeight = height()*0.75;
const qreal maxX = width() + eSizesUI::widget;
while(xL < maxX) {
//if(!mRange) {
p.drawLine(QPointF(xL, threeFourthsHeight + 2),
QPointF(xL, height()));
//}
QString drawValue = QString::number(currentFrame);
qreal leftValue = xL;
if (mDisplayTime && mFps > 0) {
drawValue = AppSupport::getTimeCodeFromFrame(currentFrame, mFps);
if (mRange) {
if (currentFrame == mFrameRange.fMin) {
leftValue = xL + 40;
} else if (currentFrame == mFrameRange.fMax) {
leftValue = xL - 40;
}
if (!mRange) {
while(xL < maxX) {
p.drawLine(QPointF(xL, threeFourthsHeight + 2), QPointF(xL, height()));
QString drawValue = QString::number(currentFrame);
if (mDisplayTime && mFps > 0) {
drawValue = AppSupport::getTimeCodeFromFrame(currentFrame, mFps);
}
p.drawText(QRectF(xL - inc, 0, 2*inc, height()),
Qt::AlignCenter, drawValue);
xL += inc;
currentFrame += mDrawFrameInc;
}
p.drawText(QRectF(leftValue - inc, 0, 2*inc, height()),
Qt::AlignCenter, drawValue);
xL += inc;
currentFrame += mDrawFrameInc;
}

/*p.setPen(QPen(Qt::white, 1));
Expand Down
7 changes: 4 additions & 3 deletions src/app/GUI/timelinewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,10 @@ TimelineWidget::TimelineWidget(Document &document,
mMainLayout->addWidget(mFrameScrollBar, 0, 1);

mFrameRangeScrollBar = new FrameScrollBar(20, 200, true, true, true, this);
eSizesUI::widget.add(mFrameRangeScrollBar, [this](const int size) {
mFrameRangeScrollBar->setMinimumHeight(size+5/**2/3*/);
});
mFrameRangeScrollBar->setFixedHeight(10);
//eSizesUI::widget.add(mFrameRangeScrollBar, [this](const int size) {
// mFrameRangeScrollBar->setMinimumHeight(size+5/**2/3*/);
//});

connect(mFrameRangeScrollBar, &FrameScrollBar::triggeredFrameRangeChange,
this, &TimelineWidget::setViewedFrameRange);
Expand Down

0 comments on commit 26af22a

Please sign in to comment.