Show "move cursor".
--HG-- branch : feature
This commit is contained in:
parent
254d9b7b7a
commit
d5eded4eda
|
@ -300,6 +300,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
CancelTool();
|
CancelTool();
|
||||||
|
emit EnableItemMove(true);
|
||||||
tool = t;
|
tool = t;
|
||||||
QPixmap pixmap(cursor);
|
QPixmap pixmap(cursor);
|
||||||
QCursor cur(pixmap, 2, 3);
|
QCursor cur(pixmap, 2, 3);
|
||||||
|
@ -340,6 +341,7 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
CancelTool();
|
CancelTool();
|
||||||
|
emit EnableItemMove(false);
|
||||||
tool = t;
|
tool = t;
|
||||||
QPixmap pixmap(cursor);
|
QPixmap pixmap(cursor);
|
||||||
QCursor cur(pixmap, 2, 3);
|
QCursor cur(pixmap, 2, 3);
|
||||||
|
@ -1050,7 +1052,6 @@ void MainWindow::CancelTool()
|
||||||
ui->actionArrowTool->setChecked(false);
|
ui->actionArrowTool->setChecked(false);
|
||||||
helpLabel->setText("");
|
helpLabel->setText("");
|
||||||
ui->actionStopTool->setEnabled(true);
|
ui->actionStopTool->setEnabled(true);
|
||||||
emit EnableItemMove(false);
|
|
||||||
return;
|
return;
|
||||||
case Tool::SinglePoint:
|
case Tool::SinglePoint:
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
|
@ -1130,7 +1131,6 @@ void MainWindow::CancelTool()
|
||||||
}
|
}
|
||||||
currentScene->setFocus(Qt::OtherFocusReason);
|
currentScene->setFocus(Qt::OtherFocusReason);
|
||||||
currentScene->clearSelection();
|
currentScene->clearSelection();
|
||||||
emit EnableItemMove(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -55,7 +55,6 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QStr
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
//this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
|
|
||||||
|
@ -193,6 +192,7 @@ VToolSpline* VToolSpline::Create(const quint32 _id, const quint32 &p1, const qui
|
||||||
connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSpline::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSpline::SetFactor);
|
||||||
connect(scene, &VMainGraphicsScene::DisableItem, spl, &VToolSpline::Disable);
|
connect(scene, &VMainGraphicsScene::DisableItem, spl, &VToolSpline::Disable);
|
||||||
|
connect(scene, &VMainGraphicsScene::EnableToolMove, spl, &VToolSpline::EnableToolMove);
|
||||||
doc->AddTool(id, spl);
|
doc->AddTool(id, spl);
|
||||||
doc->IncrementReferens(p1);
|
doc->IncrementReferens(p1);
|
||||||
doc->IncrementReferens(p4);
|
doc->IncrementReferens(p4);
|
||||||
|
@ -283,6 +283,12 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp
|
||||||
qApp->getUndoStack()->push(moveSpl);
|
qApp->getUndoStack()->push(moveSpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSpline::EnableToolMove(bool move)
|
||||||
|
{
|
||||||
|
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief contextMenuEvent handle context menu events.
|
* @brief contextMenuEvent handle context menu events.
|
||||||
|
@ -361,14 +367,32 @@ void VToolSpline::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void VToolSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton)
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||||
{
|
{
|
||||||
oldPosition = event->scenePos();
|
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||||
event->accept();
|
{
|
||||||
|
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"), 1, 1);
|
||||||
|
oldPosition = event->scenePos();
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
VAbstractSpline::mousePressEvent(event);
|
VAbstractSpline::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||||
|
{
|
||||||
|
//Disable cursor-arrow-closehand
|
||||||
|
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VAbstractSpline::mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +444,29 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
|
MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene());
|
||||||
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree);
|
connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree);
|
||||||
qApp->getUndoStack()->push(moveSpl);
|
qApp->getUndoStack()->push(moveSpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||||
|
{
|
||||||
|
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"), 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
VAbstractSpline::hoverEnterEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
if (flags() & QGraphicsItem::ItemIsMovable)
|
||||||
|
{
|
||||||
|
//Disable cursor-arrow-openhand
|
||||||
|
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
VAbstractSpline::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -58,13 +58,17 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
|
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
|
||||||
const QPointF &pos);
|
const QPointF &pos);
|
||||||
|
virtual void EnableToolMove(bool move);
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
|
||||||
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
|
||||||
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolSpline)
|
Q_DISABLE_COPY(VToolSpline)
|
||||||
void RefreshGeometry ();
|
void RefreshGeometry ();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user