reimplemented rubberband and hand drag routines

This commit is contained in:
itsmattkc
2019-10-14 07:28:27 +11:00
parent 6f4e5a04e4
commit b09fc2b697
8 changed files with 76 additions and 27 deletions
+15 -1
View File
@@ -25,5 +25,19 @@
TimelineWidget::HandTool::HandTool(TimelineWidget* parent) :
Tool(parent)
{
set_drag_mode(QGraphicsView::ScrollHandDrag);
}
void TimelineWidget::HandTool::MousePress(TimelineViewMouseEvent *)
{
parent()->StartHandDrag();
}
void TimelineWidget::HandTool::MouseMove(TimelineViewMouseEvent *)
{
parent()->MoveHandDrag();
}
void TimelineWidget::HandTool::MouseRelease(TimelineViewMouseEvent *)
{
parent()->EndHandDrag();
}
+2 -2
View File
@@ -237,8 +237,8 @@ void TimelineWidget::ImportTool::DragDrop(TimelineViewMouseEvent *event)
if (event->GetModifiers() & Qt::ControlModifier) {
//emit parent()->RequestInsertBlockAtTime(clip, ghost->GetAdjustedIn());
} else {
new TrackPlaceBlockCommand(parent()->timeline_node_->track_list(ghost->Track().type()),
ghost->Track().index(),
new TrackPlaceBlockCommand(parent()->timeline_node_->track_list(ghost->GetAdjustedTrack().type()),
ghost->GetAdjustedTrack().index(),
clip,
ghost->GetAdjustedIn(),
command);
@@ -38,7 +38,6 @@ TimelineWidget::PointerTool::PointerTool(TimelineWidget *parent) :
track_movement_allowed_(true),
rubberband_selecting_(false)
{
set_drag_mode(QGraphicsView::RubberBandDrag);
}
void TimelineWidget::PointerTool::MousePress(TimelineViewMouseEvent *event)
+1 -12
View File
@@ -26,8 +26,7 @@
TimelineWidget::Tool::Tool(TimelineWidget *parent) :
dragging_(false),
parent_(parent),
drag_mode_(QGraphicsView::NoDrag)
parent_(parent)
{
}
@@ -53,16 +52,6 @@ olive::timeline::MovementMode TimelineWidget::Tool::FlipTrimMode(const olive::ti
return trim_mode;
}
const QGraphicsView::DragMode &TimelineWidget::Tool::drag_mode()
{
return drag_mode_;
}
void TimelineWidget::Tool::set_drag_mode(const QGraphicsView::DragMode &mode)
{
drag_mode_ = mode;
}
TimelineViewBlockItem *TimelineWidget::Tool::GetItemAtScenePos(const TimelineCoordinate& coord)
{
QMapIterator<Block*, TimelineViewBlockItem*> iterator(parent()->block_items_);