Show cursor if item can move.
--HG-- branch : develop
This commit is contained in:
parent
2bdc5f3771
commit
4e1742ded5
|
@ -19,5 +19,7 @@
|
||||||
<file>cursor/splinepath_cut_point_cursor.png</file>
|
<file>cursor/splinepath_cut_point_cursor.png</file>
|
||||||
<file>cursor/union_cursor.png</file>
|
<file>cursor/union_cursor.png</file>
|
||||||
<file>cursor/arc_cut_cursor.png</file>
|
<file>cursor/arc_cut_cursor.png</file>
|
||||||
|
<file>cursor/cursor-arrow-closehand.png</file>
|
||||||
|
<file>cursor/cursor-arrow-openhand.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -34,7 +34,7 @@ const QString VAbstractSpline::TagName = QStringLiteral("spline");
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent)
|
||||||
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>()),
|
:VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector<VControlPointSpline *>()),
|
||||||
sceneType(SceneObject::Unknown)
|
sceneType(SceneObject::Unknown), isHovered(false)
|
||||||
{
|
{
|
||||||
ignoreFullUpdate = true;
|
ignoreFullUpdate = true;
|
||||||
}
|
}
|
||||||
|
@ -117,15 +117,17 @@ void VAbstractSpline::SetFactor(qreal factor)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
* @brief hoverEnterEvent handle hover enter events.
|
||||||
* @param event hover move event.
|
* @param event hover enter event.
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VAbstractSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, Qt::SolidLine, Qt::RoundCap));
|
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, Qt::SolidLine, Qt::RoundCap));
|
||||||
this->setPath(ToolPath(PathDirection::Show));
|
this->setPath(ToolPath(PathDirection::Show));
|
||||||
|
isHovered = true;
|
||||||
|
QGraphicsPathItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -139,6 +141,8 @@ void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||||
this->setPath(ToolPath());
|
this->setPath(ToolPath());
|
||||||
|
isHovered = false;
|
||||||
|
QGraphicsPathItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -64,6 +64,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
QVector<VControlPointSpline *> controlPoints;
|
QVector<VControlPointSpline *> controlPoints;
|
||||||
SceneObject sceneType;
|
SceneObject sceneType;
|
||||||
|
bool isHovered;
|
||||||
/**
|
/**
|
||||||
* @brief RefreshGeometry refresh item on scene.
|
* @brief RefreshGeometry refresh item on scene.
|
||||||
*/
|
*/
|
||||||
|
@ -71,7 +72,7 @@ protected:
|
||||||
virtual void ChangedActivDraw ( const QString &newName );
|
virtual void ChangedActivDraw ( const QString &newName );
|
||||||
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable);
|
||||||
virtual void SetFactor(qreal factor);
|
virtual void SetFactor(qreal factor);
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||||
virtual void keyReleaseEvent(QKeyEvent * event);
|
virtual void keyReleaseEvent(QKeyEvent * event);
|
||||||
|
|
|
@ -279,10 +279,10 @@ void VToolLine::RefreshDataInFile()
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
* @brief hoverEnterEvent handle hover enter events.
|
||||||
* @param event hover move event.
|
* @param event hover enter event.
|
||||||
*/
|
*/
|
||||||
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle(typeLine)));
|
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle(typeLine)));
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
virtual void RefreshDataInFile();
|
virtual void RefreshDataInFile();
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void RemoveReferens();
|
virtual void RemoveReferens();
|
||||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||||
|
|
|
@ -185,18 +185,19 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
emit ChoosedTool(id, SceneObject::Point);
|
emit ChoosedTool(id, SceneObject::Point);
|
||||||
}
|
}
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
* @brief hoverEnterEvent handle hover enter events.
|
||||||
* @param event hover move event.
|
* @param event hover enter event.
|
||||||
*/
|
*/
|
||||||
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolPoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor));
|
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor));
|
||||||
|
QGraphicsEllipseItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -314,5 +315,5 @@ void VToolPoint::keyReleaseEvent(QKeyEvent *event)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QGraphicsItem::keyReleaseEvent ( event );
|
QGraphicsEllipseItem::keyReleaseEvent ( event );
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
||||||
|
|
||||||
virtual void UpdateNamePosition(qreal mx, qreal my);
|
virtual void UpdateNamePosition(qreal mx, qreal my);
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void RefreshPointGeometry(const VPointF &point);
|
virtual void RefreshPointGeometry(const VPointF &point);
|
||||||
void RefreshLine();
|
void RefreshLine();
|
||||||
|
|
|
@ -215,6 +215,54 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
|
||||||
doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y())));
|
doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
VToolPoint::hoverEnterEvent(event);
|
||||||
|
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap pixmap(QLatin1String("://cursor/cursor-arrow-openhand.png"));
|
||||||
|
QApplication::setOverrideCursor(QCursor(pixmap, 1, 1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
VToolPoint::hoverLeaveEvent(event);
|
||||||
|
|
||||||
|
//Disable cursor-arrow-openhand
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap pixmap(QLatin1String("://cursor/cursor-arrow-closehand.png"));
|
||||||
|
QApplication::setOverrideCursor(QCursor(pixmap, 1, 1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
VToolPoint::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
//Disable cursor-arrow-closehand
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
VToolPoint::mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief setColorLabel change color for label and label line.
|
* @brief setColorLabel change color for label and label line.
|
||||||
|
@ -233,6 +281,10 @@ void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
|
||||||
*/
|
*/
|
||||||
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
|
||||||
quint32 ref = _referens; // store referens
|
quint32 ref = _referens; // store referens
|
||||||
_referens = 1; // make available delete pattern piece
|
_referens = 1; // make available delete pattern piece
|
||||||
if (doc->CountPP() > 1)
|
if (doc->CountPP() > 1)
|
||||||
|
|
|
@ -61,6 +61,10 @@ protected:
|
||||||
virtual void decrementReferens();
|
virtual void decrementReferens();
|
||||||
virtual void DeleteTool(bool ask = true);
|
virtual void DeleteTool(bool ask = true);
|
||||||
virtual void SaveDialog(QDomElement &domElement);
|
virtual void SaveDialog(QDomElement &domElement);
|
||||||
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
|
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
|
||||||
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
private:
|
private:
|
||||||
QString namePP;
|
QString namePP;
|
||||||
QString mPath;
|
QString mPath;
|
||||||
|
|
|
@ -319,8 +319,15 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
|
||||||
*/
|
*/
|
||||||
void VToolSpline::RefreshGeometry()
|
void VToolSpline::RefreshGeometry()
|
||||||
{
|
{
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
//this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||||
this->setPath(ToolPath());
|
if(isHovered)
|
||||||
|
{
|
||||||
|
this->setPath(ToolPath(PathDirection::Show));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->setPath(ToolPath());
|
||||||
|
}
|
||||||
|
|
||||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||||
QPointF splinePoint = VAbstractTool::data.GeometricObject<const VPointF *>(spl->GetP1().id())->toQPointF();
|
QPointF splinePoint = VAbstractTool::data.GeometricObject<const VPointF *>(spl->GetP1().id())->toQPointF();
|
||||||
|
|
|
@ -358,8 +358,14 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
|
||||||
*/
|
*/
|
||||||
void VToolSplinePath::RefreshGeometry()
|
void VToolSplinePath::RefreshGeometry()
|
||||||
{
|
{
|
||||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
if(isHovered)
|
||||||
this->setPath(ToolPath());
|
{
|
||||||
|
this->setPath(ToolPath(PathDirection::Show));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->setPath(ToolPath());
|
||||||
|
}
|
||||||
|
|
||||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||||
for (qint32 i = 1; i<=splPath->Count(); ++i)
|
for (qint32 i = 1; i<=splPath->Count(); ++i)
|
||||||
|
|
|
@ -82,20 +82,28 @@ void VControlPointSpline::paint(QPainter *painter, const QStyleOptionGraphicsIte
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
* @brief hoverEnterEvent handle hover enter events.
|
||||||
* @param event hover move event.
|
* @param event hover move event.
|
||||||
*/
|
*/
|
||||||
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VControlPointSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap pixmap(QLatin1String("://cursor/cursor-arrow-openhand.png"));
|
||||||
|
QApplication::setOverrideCursor(QCursor(pixmap, 1, 1));
|
||||||
|
#endif
|
||||||
|
QGraphicsEllipseItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())));
|
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())));
|
||||||
|
//Disable cursor-arrow-openhand
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
QGraphicsEllipseItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -116,6 +124,32 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang
|
||||||
return QGraphicsItem::itemChange(change, value);
|
return QGraphicsItem::itemChange(change, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VControlPointSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap pixmap(QLatin1String("://cursor/cursor-arrow-closehand.png"));
|
||||||
|
QApplication::setOverrideCursor(QCursor(pixmap, 1, 1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
QGraphicsEllipseItem::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VControlPointSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
//Disable cursor-arrow-closehand
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief RefreshLine refresh line control point.
|
* @brief RefreshLine refresh line control point.
|
||||||
|
|
|
@ -63,9 +63,11 @@ protected:
|
||||||
/** @brief controlLine pointer to line control point. */
|
/** @brief controlLine pointer to line control point. */
|
||||||
QGraphicsLineItem *controlLine;
|
QGraphicsLineItem *controlLine;
|
||||||
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||||
|
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
|
||||||
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VControlPointSpline)
|
Q_DISABLE_COPY(VControlPointSpline)
|
||||||
/** @brief indexSpline index spline in list.. */
|
/** @brief indexSpline index spline in list.. */
|
||||||
|
|
|
@ -97,13 +97,18 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief hoverMoveEvent handle hover move events.
|
* @brief hoverEnterEvent handle hover enter events.
|
||||||
* @param event hover move event.
|
* @param event hover enter event.
|
||||||
*/
|
*/
|
||||||
void VGraphicsSimpleTextItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
|
||||||
this->setBrush(Qt::green);
|
this->setBrush(Qt::green);
|
||||||
|
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap pixmap(QLatin1String("://cursor/cursor-arrow-openhand.png"));
|
||||||
|
QApplication::setOverrideCursor(QCursor(pixmap, 1, 1));
|
||||||
|
#endif
|
||||||
|
QGraphicsSimpleTextItem::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -115,6 +120,12 @@ void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setBrush(Qt::black);
|
this->setBrush(Qt::black);
|
||||||
|
|
||||||
|
//Disable cursor-arrow-openhand
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
QGraphicsSimpleTextItem::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -126,3 +137,29 @@ void VGraphicsSimpleTextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e
|
||||||
{
|
{
|
||||||
emit ShowContextMenu(event);
|
emit ShowContextMenu(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QPixmap pixmap(QLatin1String("://cursor/cursor-arrow-closehand.png"));
|
||||||
|
QApplication::setOverrideCursor(QCursor(pixmap, 1, 1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
QGraphicsSimpleTextItem::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
//Disable cursor-arrow-closehand
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
|
|
|
@ -57,9 +57,11 @@ signals:
|
||||||
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent *event );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent *event );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent *event );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent *event );
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent *event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent *event );
|
||||||
|
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
|
||||||
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
private:
|
private:
|
||||||
/** @brief fontSize label font size. */
|
/** @brief fontSize label font size. */
|
||||||
qint32 fontSize;
|
qint32 fontSize;
|
||||||
|
|
|
@ -227,7 +227,6 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
|
||||||
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
bool ok = false;
|
|
||||||
QString parametr;
|
QString parametr;
|
||||||
bool val = true;
|
bool val = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user