playhead item covers entire scene

This commit is contained in:
itsmattkc
2019-08-19 13:33:34 +10:00
parent 9ccf2610c8
commit 44f7c0ab40
4 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -77,5 +77,5 @@ NodeViewItemWidget {
/* Timeline playhead styling */
TimelinePlayhead {
qproperty-playheadColor: #ff0000;
qproperty-playheadHighlightColor: rgba(255, 255, 255, 0.33);
qproperty-playheadHighlightColor: rgba(255, 255, 255, 0.2);
}
+12
View File
@@ -23,6 +23,7 @@
#include <QDebug>
#include <QMimeData>
#include <QMouseEvent>
#include <QScrollBar>
#include <QtMath>
#include <QPen>
@@ -168,6 +169,17 @@ void TimelineView::dropEvent(QDropEvent *event)
import_tool_.DragDrop(event);
}
void TimelineView::resizeEvent(QResizeEvent *event)
{
QGraphicsView::resizeEvent(event);
if (scene_.height() < height()) {
QRectF rect = scene_.sceneRect();
rect.setHeight(height() - horizontalScrollBar()->height() - 2);
scene_.setSceneRect(rect);
}
}
void TimelineView::AddGhost(TimelineViewGhostItem *ghost)
{
ghost->SetScale(scale_);
+2
View File
@@ -75,6 +75,8 @@ protected:
virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
virtual void dropEvent(QDropEvent *event) override;
virtual void resizeEvent(QResizeEvent *event) override;
private:
class Tool
@@ -51,7 +51,7 @@ void TimelineViewPlayheadItem::UpdateRect()
double x = TimeToScreenCoord(rational(playhead_ * timebase_.numerator(), timebase_.denominator()));
double width = TimeToScreenCoord(timebase_);
setRect(0, 0, width, scene()->height());
setRect(0, 0, width, scene()->height()-1);
setPos(x, 0);
}