stopmotion/capturehandler.cpp
blackmagic/capture.cpp
blackmagic/devices.cpp
- onmonitoritems/abstractonmonitoritem.cpp
onmonitoritems/onmonitorrectitem.cpp
onmonitoritems/onmonitorcornersitem.cpp
cornerswidget.cpp
install(FILES kdenlive.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
kde4_install_icons(${ICON_INSTALL_DIR})
install(FILES kdenlive_titles.knsrc kdenlive_wipes.knsrc kdenlive_renderprofiles.knsrc kdenlive_projectprofiles.knsrc kdenlivetranscodingrc DESTINATION ${CONFIG_INSTALL_DIR})
-kde4_install_icons(${ICON_INSTALL_DIR})
+kde4_install_icons(${ICON_INSTALL_DIR})
\ No newline at end of file
edit->showVisibilityButton(true);
m_scene = edit->getScene();
- m_item = new OnMonitorCornersItem(m_scene);
+ m_item = new OnMonitorCornersItem();
m_scene->addItem(m_item);
// TODO: Better Icons
- QToolButton *buttonShowControls = new QToolButton();
- buttonShowControls->setIcon(KIcon("transform-move"));
- buttonShowControls->setToolTip(i18n("Show additional controls"));
- buttonShowControls->setCheckable(true);
- buttonShowControls->setAutoRaise(true);
- buttonShowControls->setChecked(KdenliveSettings::onmonitoreffects_cornersshowcontrols());
- connect(buttonShowControls, SIGNAL(toggled(bool)), this, SLOT(slotShowControls(bool)));
- edit->addCustomControl(buttonShowControls);
-
- QToolButton *buttonShowLines = new QToolButton();
- buttonShowLines->setIcon(KIcon("insert-horizontal-rule"));
- buttonShowLines->setToolTip(i18n("Show/Hide the lines connecting the corners"));
- buttonShowLines->setCheckable(true);
- buttonShowControls->setAutoRaise(true);
- buttonShowLines->setChecked(KdenliveSettings::onmonitoreffects_cornersshowlines());
- connect(buttonShowLines, SIGNAL(toggled(bool)), this, SLOT(slotShowLines(bool)));
- edit->addCustomControl(buttonShowLines);
+ edit->addCustomButton(KIcon("transform-move"), i18n("Show additional controls"), this, SLOT(slotShowControls(bool)),
+ true, KdenliveSettings::onmonitoreffects_cornersshowcontrols());
+ edit->addCustomButton(KIcon("insert-horizontal-rule"), i18n("Show/Hide the lines connecting the corners"), this, SLOT(slotShowLines(bool)),
+ true, KdenliveSettings::onmonitoreffects_cornersshowlines());
connect(edit, SIGNAL(showEdit(bool)), this, SLOT(slotShowScene(bool)));
connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
- connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateProperties()));
+ connect(m_item, SIGNAL(changed()), this, SLOT(slotUpdateProperties()));
connect(m_scene, SIGNAL(addKeyframe()), this, SLOT(slotInsertKeyframe()));
connect(keyframe_list, SIGNAL(cellChanged(int, int)), this, SLOT(slotUpdateItem()));
connect(edit, SIGNAL(showEdit(bool)), this, SLOT(slotShowScene(bool)));
- connect(m_scene, SIGNAL(actionFinished()), this, SLOT(slotUpdateGeometry()));
connect(m_scene, SIGNAL(addKeyframe()), this, SLOT(slotAddKeyframe()));
connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties()));
m_geometry->fetch(&item, 0);
delete m_rect;
- m_rect = new OnMonitorRectItem(QRectF(0, 0, item.w(), item.h()), m_monitor->render->dar(), m_scene);
+ m_rect = new OnMonitorRectItem(QRectF(0, 0, item.w(), item.h()), m_monitor->render->dar());
m_rect->setPos(item.x(), item.y());
m_rect->setZValue(0);
m_scene->addItem(m_rect);
+ connect(m_rect, SIGNAL(changed()), this, SLOT(slotUpdateGeometry()));
slotPositionChanged(0, false);
slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
#include <QGraphicsView>
#include <QVBoxLayout>
#include <QAction>
+#include <QToolButton>
#include <KIcon>
((QVBoxLayout*)m_ui.frameVideo->layout())->addWidget(m_view);
- m_customControlsLayout = static_cast<QVBoxLayout *>(m_ui.frameCustomControls->layout());
+ m_customControlsLayout = new QVBoxLayout(m_ui.frameCustomControls);
+ m_customControlsLayout->setContentsMargins(0, 4, 0, 4);
+ m_customControlsLayout->setSpacing(0);
m_visibilityAction = new QAction(KIcon("video-display"), i18n("Show/Hide edit mode"), this);
m_visibilityAction->setCheckable(true);
m_customControlsLayout->addWidget(widget);
}
+void MonitorEditWidget::addCustomButton(const QIcon& icon, const QString& text, const QObject* receiver, const char* member, bool checkable, bool checked)
+{
+ QToolButton *button = new QToolButton(m_ui.frameCustomControls);
+ button->setIcon(icon);
+ button->setToolTip(text);
+ button->setCheckable(checkable);
+ button->setChecked(checked);
+ button->setAutoRaise(true);
+ if (checkable)
+ connect(button, SIGNAL(toggled(bool)), receiver, member);
+ else
+ connect(button, SIGNAL(clicked()), receiver, member);
+ m_customControlsLayout->addWidget(button);
+}
+
void MonitorEditWidget::removeCustomControls()
{
QLayoutItem *child;
#include <QWidget>
+class QIcon;
class MonitorScene;
class Render;
class QGraphicsView;
/** @brief Adds a custom widget to the controls. */
void addCustomControl(QWidget *widget);
+ void addCustomButton(const QIcon &icon, const QString &text, const QObject *receiver, const char *member, bool checkable = true, bool checked = true);
/** @brief Empties the list of custom controls. */
void removeCustomControls();
#include "monitorscene.h"
#include "renderer.h"
-#include "onmonitoritems/onmonitorrectitem.h"
#include "kdenlivesettings.h"
#include <QGraphicsView>
void MonitorScene::slotUpdateBackground()
{
if (m_view && m_view->isVisible()) {
- if (m_lastUpdate.msecsTo(QTime::currentTime()) > 100) {
+ if (m_lastUpdate.msecsTo(QTime::currentTime()) > 50) {
m_background->setPixmap(QPixmap::fromImage(m_backgroundImage));
m_lastUpdate = QTime::currentTime();
}
slotZoom(qMin(300, (int)(m_zoom * 100 + by + 0.5)));
}
-void MonitorScene::slotSetCursor(const QCursor &cursor)
-{
- if (m_view)
- m_view->setCursor(cursor);
-}
-
-
-void MonitorScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- emit mousePressed(event);
-
- if (!event->isAccepted())
- QGraphicsScene::mousePressEvent(event);
-}
-
void MonitorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- emit mouseMoved(event);
-
- if (!event->isAccepted())
- QGraphicsScene::mouseMoveEvent(event);
-}
-
-void MonitorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- emit mouseReleased(event);
-
- if (!event->isAccepted())
- QGraphicsScene::mouseReleaseEvent(event);
+ QGraphicsScene::mouseMoveEvent(event);
}
void MonitorScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
void resetProfile();
protected:
- /** @brief Emits signal mousePressed to be used in onmonitor items. */
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
- /** @brief Emits signal mouseMoveEvent to be used in onmonitor items. */
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- /** @brief Emits signal mouseReleaseEvent to be used in onmonitor items. */
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
/** @brief Adds a keyframe if scene is disabled. */
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
/** @brief Reimplemented to allow zooming using ctrl + mouse wheel. */
private slots:
/** @brief Sets m_backgroundImage to @param image and requests updating the background item. */
void slotSetBackgroundImage(const QImage &image);
- /** @brief Sets the mouse curors to @param cursor for the scene. */
- void slotSetCursor(const QCursor &cursor);
private:
Render *m_renderer;
qreal m_zoom;
signals:
- void actionFinished();
void zoomChanged(int);
void addKeyframe();
- void mouseMoved(QGraphicsSceneMouseEvent *event);
- void mousePressed(QGraphicsSceneMouseEvent *event);
- void mouseReleased(QGraphicsSceneMouseEvent *event);
};
#endif
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2010 by Till Theato (root@ttill.de) *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#include "abstractonmonitoritem.h"
-#include "monitorscene.h"
-
-#include <QGraphicsSceneMouseEvent>
-
-
-AbstractOnMonitorItem::AbstractOnMonitorItem(MonitorScene* scene) :
- m_modified(false)
-{
- connect(scene, SIGNAL(mousePressed(QGraphicsSceneMouseEvent*)), this, SLOT(slotMousePressed(QGraphicsSceneMouseEvent*)));
- connect(scene, SIGNAL(mouseReleased(QGraphicsSceneMouseEvent*)), this, SLOT(slotMouseReleased(QGraphicsSceneMouseEvent*)));
- connect(scene, SIGNAL(mouseMoved(QGraphicsSceneMouseEvent*)), this, SLOT(slotMouseMoved(QGraphicsSceneMouseEvent*)));
- connect(this, SIGNAL(actionFinished()), scene, SIGNAL(actionFinished()));
- connect(this, SIGNAL(requestCursor(const QCursor &)), scene, SLOT(slotSetCursor(const QCursor &)));
-}
-
-void AbstractOnMonitorItem::slotMouseReleased(QGraphicsSceneMouseEvent* event)
-{
- if (m_modified) {
- m_modified = false;
- emit actionFinished();
- }
- event->accept();
-}
-
-#include "abstractonmonitoritem.moc"
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2010 by Till Theato (root@ttill.de) *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-
-#ifndef ABSTRACTONMONITORITEM_H
-#define ABSTRACTONMONITORITEM_H
-
-#include <QtCore>
-#include <QGraphicsItem>
-
-
-class MonitorScene;
-
-class AbstractOnMonitorItem : public QObject
-{
- Q_OBJECT
-public:
- AbstractOnMonitorItem(MonitorScene *scene);
- virtual ~AbstractOnMonitorItem() {};
-
-protected slots:
- virtual void slotMousePressed(QGraphicsSceneMouseEvent *event) = 0;
- /** @brief emits actionFinished signal if item was modified. */
- virtual void slotMouseReleased(QGraphicsSceneMouseEvent *event);
- virtual void slotMouseMoved(QGraphicsSceneMouseEvent *event) = 0;
-
-protected:
- bool m_modified;
-
-signals:
- void actionFinished();
- void requestCursor(const QCursor &);
-};
-
-#endif
#include <QStyleOptionGraphicsItem>
#include <QCursor>
-OnMonitorCornersItem::OnMonitorCornersItem(MonitorScene* scene, QGraphicsItem* parent) :
- AbstractOnMonitorItem(scene),
+OnMonitorCornersItem::OnMonitorCornersItem(QGraphicsItem* parent) :
QGraphicsPolygonItem(parent),
- m_selectedCorner(-1)
+ m_selectedCorner(-1),
+ m_modified(false)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
framepen.setColor(Qt::yellow);
setPen(framepen);
setBrush(Qt::NoBrush);
+ setAcceptHoverEvents(true);
}
OnMonitorCornersItem::cornersActions OnMonitorCornersItem::getMode(QPointF pos, int *corner)
return NoAction;
QPainterPath mouseArea;
- pos = mapFromScene(pos);
mouseArea.addRect(pos.x() - 6, pos.y() - 6, 12, 12);
for (int i = 0; i < 4; ++i) {
if (mouseArea.contains(polygon().at(i))) {
return NoAction;
}
-void OnMonitorCornersItem::slotMousePressed(QGraphicsSceneMouseEvent* event)
+void OnMonitorCornersItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
- event->accept();
-
- if (!isEnabled())
- return;
-
- m_mode = getMode(event->scenePos(), &m_selectedCorner);
+ m_mode = getMode(event->pos(), &m_selectedCorner);
m_lastPoint = event->scenePos();
+
+ if (m_mode == NoAction)
+ event->ignore();
}
-void OnMonitorCornersItem::slotMouseMoved(QGraphicsSceneMouseEvent* event)
+void OnMonitorCornersItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
- event->accept();
-
- if (!isEnabled()) {
- emit requestCursor(QCursor(Qt::ArrowCursor));
- return;
- }
-
/*if (event->buttons() != Qt::NoButton && (event->screenPos() - m_screenClickPoint).manhattanLength() < QApplication::startDragDistance()) {
* event->accept();
* return;
}
m_lastPoint = mousePos;
setPolygon(p);
- } else {
- int corner;
- switch (getMode(event->scenePos(), &corner)) {
- case NoAction:
- emit requestCursor(QCursor(Qt::ArrowCursor));
- break;
- case Move:
- emit requestCursor(QCursor(Qt::SizeAllCursor));
- break;
- default:
- emit requestCursor(QCursor(Qt::OpenHandCursor));
- break;
+ }
+
+ if (m_modified) {
+ event->accept();
+ if (KdenliveSettings::monitorscene_directupdate()) {
+ emit changed();
+ m_modified = false;
}
+ } else {
+ event->ignore();
}
- if (m_modified && KdenliveSettings::monitorscene_directupdate()) {
- emit actionFinished();
+}
+
+void OnMonitorCornersItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
+{
+ if (m_modified) {
m_modified = false;
+ emit changed();
+ }
+ event->accept();
+}
+
+void OnMonitorCornersItem::hoverMoveEvent(QGraphicsSceneHoverEvent* event)
+{
+ int corner;
+ switch (getMode(event->pos(), &corner)) {
+ case NoAction:
+ unsetCursor();
+ break;
+ case Move:
+ setCursor(QCursor(Qt::SizeAllCursor));
+ break;
+ default:
+ setCursor(QCursor(Qt::OpenHandCursor));
+ break;
}
}
#ifndef ONMONITORCORNERSITEM_H
#define ONMONITORCORNERSITEM_H
-#include "abstractonmonitoritem.h"
#include <QtCore>
#include <QGraphicsPolygonItem>
-class OnMonitorCornersItem : public AbstractOnMonitorItem, public QGraphicsPolygonItem
+class OnMonitorCornersItem : public QObject, public QGraphicsPolygonItem
{
Q_OBJECT
public:
- OnMonitorCornersItem(MonitorScene *scene, QGraphicsItem *parent = 0);
+ OnMonitorCornersItem(QGraphicsItem *parent = 0);
enum cornersActions { Corner, Move, MoveSide, NoAction };
/** @brief Gets The action mode for the area @param pos +- 4. */
/** @brief Reimplemented to draw the handles. */
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
-public slots:
- /** @brief Saves current mouse position and mode. */
- void slotMousePressed(QGraphicsSceneMouseEvent *event);
- /** @brief Modifies item according to mouse position and mode. */
- void slotMouseMoved(QGraphicsSceneMouseEvent *event);
+protected:
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
/** @brief Returns the centroid (= 'center of mass') of this polygon. */
/** Number of the selected corner or if in MoveSide mode number of the first corner on this side */
int m_selectedCorner;
QPointF m_lastPoint;
+ bool m_modified;
+
+signals:
+ void changed();
};
#endif
#include <QStyleOptionGraphicsItem>
#include <QCursor>
-OnMonitorRectItem::OnMonitorRectItem(const QRectF &rect, double dar, MonitorScene *scene, QGraphicsItem* parent) :
- AbstractOnMonitorItem(scene),
+OnMonitorRectItem::OnMonitorRectItem(const QRectF &rect, double dar, QGraphicsItem* parent) :
QGraphicsRectItem(rect, parent),
- m_dar(dar)
+ m_dar(dar),
+ m_modified(false)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
framepen.setColor(Qt::yellow);
setPen(framepen);
setBrush(Qt::transparent);
+ setAcceptHoverEvents(true);
}
-rectActions OnMonitorRectItem::getMode(QPoint pos)
+rectActions OnMonitorRectItem::getMode(QPointF pos)
{
- pos = mapFromScene(pos).toPoint();
// Item mapped coordinates
- QPolygon pol(rect().normalized().toRect());
+ QPolygonF pol(rect().normalized());
- QPainterPath top(pol.point(0));
- top.lineTo(pol.point(1));
- QPainterPath bottom(pol.point(2));
- bottom.lineTo(pol.point(3));
- QPainterPath left(pol.point(0));
- left.lineTo(pol.point(3));
- QPainterPath right(pol.point(1));
- right.lineTo(pol.point(2));
+ QPainterPath top(pol.at(0));
+ top.lineTo(pol.at(1));
+ QPainterPath bottom(pol.at(2));
+ bottom.lineTo(pol.at(3));
+ QPainterPath left(pol.at(0));
+ left.lineTo(pol.at(3));
+ QPainterPath right(pol.at(1));
+ right.lineTo(pol.at(2));
QPainterPath mouseArea;
mouseArea.addRect(pos.x() - 4, pos.y() - 4, 8, 8);
// Check for collisions between the mouse and the borders
- if (mouseArea.contains(pol.point(0)))
+ if (mouseArea.contains(pol.at(0)))
return ResizeTopLeft;
- else if (mouseArea.contains(pol.point(2)))
+ else if (mouseArea.contains(pol.at(2)))
return ResizeBottomRight;
- else if (mouseArea.contains(pol.point(1)))
+ else if (mouseArea.contains(pol.at(1)))
return ResizeTopRight;
- else if (mouseArea.contains(pol.point(3)))
+ else if (mouseArea.contains(pol.at(3)))
return ResizeBottomLeft;
else if (top.intersects(mouseArea))
return ResizeTop;
return NoAction;
}
-/*int OnMonitorRectItem::type() const
-{
- return Type;
-}*/
-
-void OnMonitorRectItem::slotMousePressed(QGraphicsSceneMouseEvent* event)
+void OnMonitorRectItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
event->accept();
- if (!isEnabled())
- return;
-
m_lastPoint = event->scenePos();
m_oldRect = rect().normalized();
- m_mode = getMode(m_lastPoint.toPoint());
+ m_mode = getMode(event->pos());
}
-void OnMonitorRectItem::slotMouseMoved(QGraphicsSceneMouseEvent* event)
+void OnMonitorRectItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
- event->accept();
-
- if (!isEnabled()) {
- emit requestCursor(QCursor(Qt::ArrowCursor));
- return;
- }
-
/*if (event->buttons() != Qt::NoButton && (event->screenPos() - m_screenClickPoint).manhattanLength() < QApplication::startDragDistance()) {
* event->accept();
* return;
QRectF r = rect().normalized();
QPointF p = pos();
QPointF mousePos = event->scenePos();
- QPointF mousePosInRect = mapFromScene(mousePos);
+ QPointF mousePosInRect = event->pos();
QPointF diff = mousePos - m_lastPoint;
m_lastPoint = mousePos;
}
setRect(r);
- } else {
- switch (getMode(event->scenePos().toPoint())) {
- case ResizeTopLeft:
- case ResizeBottomRight:
- emit requestCursor(QCursor(Qt::SizeFDiagCursor));
- break;
- case ResizeTopRight:
- case ResizeBottomLeft:
- emit requestCursor(QCursor(Qt::SizeBDiagCursor));
- break;
- case ResizeTop:
- case ResizeBottom:
- emit requestCursor(QCursor(Qt::SizeVerCursor));
- break;
- case ResizeLeft:
- case ResizeRight:
- emit requestCursor(QCursor(Qt::SizeHorCursor));
- break;
- case Move:
- emit requestCursor(QCursor(Qt::OpenHandCursor));
- break;
- default:
- emit requestCursor(QCursor(Qt::ArrowCursor));
- break;
+ }
+
+ if (m_modified) {
+ event->accept();
+ if (KdenliveSettings::monitorscene_directupdate()) {
+ emit changed();
+ m_modified = false;
}
+ } else {
+ event->ignore();
}
+}
- if (m_modified && KdenliveSettings::monitorscene_directupdate()) {
- emit actionFinished();
+void OnMonitorRectItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
+{
+ if (m_modified) {
m_modified = false;
+ emit changed();
+ }
+ event->accept();
+}
+
+void OnMonitorRectItem::hoverMoveEvent(QGraphicsSceneHoverEvent* event)
+{
+ switch (getMode(event->pos())) {
+ case ResizeTopLeft:
+ case ResizeBottomRight:
+ setCursor(QCursor(Qt::SizeFDiagCursor));
+ break;
+ case ResizeTopRight:
+ case ResizeBottomLeft:
+ setCursor(QCursor(Qt::SizeBDiagCursor));
+ break;
+ case ResizeTop:
+ case ResizeBottom:
+ setCursor(QCursor(Qt::SizeVerCursor));
+ break;
+ case ResizeLeft:
+ case ResizeRight:
+ setCursor(QCursor(Qt::SizeHorCursor));
+ break;
+ case Move:
+ setCursor(QCursor(Qt::OpenHandCursor));
+ break;
+ default:
+ unsetCursor();
+ break;
}
}
#ifndef ONMONITORRECTITEM_H
#define ONMONITORRECTITEM_H
-#include "abstractonmonitoritem.h"
#include <QtCore>
#include <QGraphicsRectItem>
enum rectActions { Move, ResizeTopLeft, ResizeBottomLeft, ResizeTopRight, ResizeBottomRight, ResizeLeft, ResizeRight, ResizeTop, ResizeBottom, NoAction };
-class OnMonitorRectItem : public AbstractOnMonitorItem, public QGraphicsRectItem
+class OnMonitorRectItem : public QObject, public QGraphicsRectItem
{
Q_OBJECT
public:
- OnMonitorRectItem(const QRectF &rect, double dar, MonitorScene *scene, QGraphicsItem *parent = 0);
+ OnMonitorRectItem(const QRectF &rect, double dar, QGraphicsItem *parent = 0);
/** @brief Gets The action mode for the area @param pos +- 4.
* e.g. pos(0,0) returns ResizeTopLeft */
- rectActions getMode(QPoint pos);
-
- /*enum { Type = UserType + 1};
- / ** @brief Reimplemented to make sure casting works. * /
- int type() const;*/
+ rectActions getMode(QPointF pos);
/** @brief Reimplemented to draw the handles. */
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
-public slots:
- /** @brief Saves current mouse position and mode. */
- void slotMousePressed(QGraphicsSceneMouseEvent *event);
- /** @brief Modifies item according to mouse position and mode. */
- void slotMouseMoved(QGraphicsSceneMouseEvent *event);
+protected:
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
private:
double m_dar;
rectActions m_mode;
QRectF m_oldRect;
QPointF m_lastPoint;
+ bool m_modified;
+
+signals:
+ void changed();
};
#endif
<height>290</height>
</rect>
</property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
<number>0</number>
</property>
<item>
- <widget class="QFrame" name="frameCustomControls">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- </layout>
- </widget>
+ <widget class="QFrame" name="frameCustomControls"/>
</item>
<item>
<widget class="QToolButton" name="buttonDirectUpdate">