Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Allow to do a rectangle selection (Shift + click) also when starting the rectangle on a clip

svn path=/trunk/kdenlive/; revision=3694
parent 22308099
......@@ -27,6 +27,7 @@
#include <QPainter>
#include <QToolTip>
#include <QGraphicsSceneMouseEvent>
AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps) :
QObject(),
......@@ -418,3 +419,12 @@ bool AbstractClipItem::isItemLocked() const
return !(flags() & (QGraphicsItem::ItemIsSelectable));
}
// virtual
void AbstractClipItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
{
if (event->modifiers() & Qt::ShiftModifier) {
// User want to do a rectangle selection, so ignore the event to pass it to the view
event->ignore();
} else QGraphicsItem::mousePressEvent(event);
}
......@@ -26,6 +26,7 @@
#include "gentime.h"
class CustomTrackScene;
class QGraphicsSceneMouseEvent;
class AbstractClipItem : public QObject , public QGraphicsRectItem
{
......@@ -76,6 +77,7 @@ protected:
//QRect visibleRect();
void drawKeyFrames(QPainter *painter, QRectF exposedRect);
int mouseOverKeyFrames(QPointF pos);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
};
#endif
......@@ -30,7 +30,7 @@
#include <QStyleOptionGraphicsItem>
#include <QDomDocument>
#include <QMimeData>
#include <QGraphicsSceneMouseEvent>
AbstractGroupItem::AbstractGroupItem(double /* fps */) :
QObject(),
......@@ -234,3 +234,12 @@ void AbstractGroupItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{
Q_UNUSED(event);
}
// virtual
void AbstractGroupItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
{
if (event->modifiers() & Qt::ShiftModifier) {
// User want to do a rectangle selection, so ignore the event to pass it to the view
event->ignore();
} else QGraphicsItem::mousePressEvent(event);
}
......@@ -28,6 +28,7 @@
#include <QGraphicsSceneMouseEvent>
class CustomTrackScene;
class QGraphicsSceneMouseEvent;
class AbstractGroupItem : public QObject , public QGraphicsItemGroup
{
......@@ -46,6 +47,7 @@ protected:
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
private:
QPainterPath groupShape(QPointF);
......
......@@ -39,7 +39,6 @@
ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, bool generateThumbs) :
AbstractClipItem(info, QRectF(), fps),
m_clip(clip),
m_resizeMode(NONE),
m_startFade(0),
m_endFade(0),
m_audioOnly(false),
......@@ -1072,24 +1071,6 @@ void ClipItem::setFadeOut(int pos)
}
// virtual
void ClipItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
{
/*m_resizeMode = operationMode(event->pos());
if (m_resizeMode == MOVE) {
m_maxTrack = scene()->sceneRect().height();
m_grabPoint = (int) (event->pos().x() - rect().x());
}*/
QGraphicsRectItem::mousePressEvent(event);
}
// virtual
void ClipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
m_resizeMode = NONE;
QGraphicsRectItem::mouseReleaseEvent(event);
}
/*
//virtual
void ClipItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
......
......@@ -112,8 +112,6 @@ public:
protected:
//virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
......@@ -123,7 +121,6 @@ protected:
private:
DocClipBase *m_clip;
OPERATIONTYPE m_resizeMode;
QString m_producer;
CLIPTYPE m_clipType;
QString m_clipName;
......
......@@ -601,6 +601,18 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
return;
}
if (event->modifiers() & Qt::ShiftModifier) {
setDragMode(QGraphicsView::RubberBandDrag);
if (!(event->modifiers() & Qt::ControlModifier)) {
resetSelectionGroup();
scene()->clearSelection();
}
QGraphicsView::mousePressEvent(event);
m_blockRefresh = false;
m_operationMode = RUBBERSELECTION;
return;
}
m_blockRefresh = true;
m_dragItem = NULL;
m_dragGuide = NULL;
......@@ -624,18 +636,6 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
return;
}
if (event->modifiers() & Qt::ShiftModifier && collisionList.count() == 0) {
setDragMode(QGraphicsView::RubberBandDrag);
if (!(event->modifiers() & Qt::ControlModifier)) {
resetSelectionGroup();
scene()->clearSelection();
}
QGraphicsView::mousePressEvent(event);
m_blockRefresh = false;
m_operationMode = RUBBERSELECTION;
return;
}
// if a guide and a clip were pressed, just select the guide
for (int i = 0; i < collisionList.count(); ++i) {
if (collisionList.at(i)->type() == GUIDEITEM) {
......@@ -2819,10 +2819,12 @@ void CustomTrackView::deleteSelectedClips()
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
if (item->parentItem()) resetGroup = true;
//kDebug()<<"// DELETE CLP AT: "<<item->info().startPos.frames(25);
new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true, deleteSelected);
emit clipItemSelected(NULL);
} else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
Transition *item = static_cast <Transition *>(itemList.at(i));
//kDebug()<<"// DELETE TRANS AT: "<<item->info().startPos.frames(25);
if (item->parentItem()) resetGroup = true;
new AddTransitionCommand(this, item->info(), item->transitionEndTrack(), item->toXML(), true, true, deleteSelected);
emit transitionItemSelected(NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment