Avoid declaring the same literal in multiple places.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-12 13:55:35 +02:00
parent d5eded4eda
commit d6069c9201
6 changed files with 24 additions and 16 deletions

View File

@ -37,6 +37,9 @@ const QString nameRegExp = QStringLiteral("^([^0-9-*/^+=\\s\\(\\)%:;!.,`'\"]){1,
// furthermore blows up the binary sizes.
const QString degreeSymbol = QStringLiteral("°");
const QString cursorArrowOpenHand = QStringLiteral("://cursor/cursor-arrow-openhand.png");
const QString cursorArrowCloseHand = QStringLiteral("://cursor/cursor-arrow-closehand.png");
// Keep synchronize all names with initialization in VApllication class!!!!!
//measurements
//head and neck

View File

@ -50,6 +50,9 @@ class QStringList;
extern const QString nameRegExp;
extern const QString degreeSymbol;
extern const QString cursorArrowOpenHand;
extern const QString cursorArrowCloseHand;
enum class SceneObject : char { Point, Line, Spline, Arc, SplinePath, Detail, Unknown };
enum class Tool : unsigned char
{

View File

@ -33,6 +33,7 @@
#include "../../undocommands/addpatternpiece.h"
#include "../../undocommands/deletepatternpiece.h"
#include "../../geometry/vpointf.h"
#include "../../options.h"
#include <QMessageBox>
@ -207,7 +208,7 @@ void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
if (flags() & QGraphicsItem::ItemIsMovable)
{
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowOpenHand, 1, 1);
}
}
@ -219,7 +220,7 @@ void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
if (flags() & QGraphicsItem::ItemIsMovable)
{
//Disable cursor-arrow-openhand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"));
VApplication::restoreOverrideCursor(cursorArrowOpenHand);
}
}
@ -230,7 +231,7 @@ void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowCloseHand, 1, 1);
}
}
VToolPoint::mousePressEvent(event);
@ -244,7 +245,7 @@ void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
//Disable cursor-arrow-closehand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"));
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
}
}
VToolPoint::mouseReleaseEvent(event);

View File

@ -31,6 +31,7 @@
#include "../../dialogs/tools/dialogspline.h"
#include "../../undocommands/movespline.h"
#include "../../visualization/vistoolspline.h"
#include "../../options.h"
#include <QtMath>
const QString VToolSpline::ToolType = QStringLiteral("simple");
@ -371,7 +372,7 @@ void VToolSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowCloseHand, 1, 1);
oldPosition = event->scenePos();
event->accept();
}
@ -387,7 +388,7 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
//Disable cursor-arrow-closehand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"));
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
}
}
VAbstractSpline::mouseReleaseEvent(event);
@ -451,7 +452,7 @@ void VToolSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
if (flags() & QGraphicsItem::ItemIsMovable)
{
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowOpenHand, 1, 1);
}
VAbstractSpline::hoverEnterEvent(event);
@ -463,7 +464,7 @@ void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
if (flags() & QGraphicsItem::ItemIsMovable)
{
//Disable cursor-arrow-openhand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"));
VApplication::restoreOverrideCursor(cursorArrowOpenHand);
}
VAbstractSpline::hoverLeaveEvent(event);

View File

@ -90,7 +90,7 @@ void VControlPointSpline::paint(QPainter *painter, const QStyleOptionGraphicsIte
void VControlPointSpline::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine())));
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowOpenHand, 1, 1);
QGraphicsEllipseItem::hoverEnterEvent(event);
}
@ -99,7 +99,7 @@ void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())));
//Disable cursor-arrow-openhand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"));
VApplication::restoreOverrideCursor(cursorArrowOpenHand);
QGraphicsEllipseItem::hoverLeaveEvent(event);
}
@ -126,7 +126,7 @@ void VControlPointSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowCloseHand, 1, 1);
}
QGraphicsEllipseItem::mousePressEvent(event);
}
@ -137,7 +137,7 @@ void VControlPointSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
//Disable cursor-arrow-closehand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"));
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
}
QGraphicsEllipseItem::mouseReleaseEvent(event);
}

View File

@ -124,7 +124,7 @@ void VGraphicsSimpleTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
this->setBrush(Qt::green);
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowOpenHand, 1, 1);
QGraphicsSimpleTextItem::hoverEnterEvent(event);
}
@ -139,7 +139,7 @@ void VGraphicsSimpleTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
this->setBrush(Qt::black);
//Disable cursor-arrow-openhand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-openhand.png"));
VApplication::restoreOverrideCursor(cursorArrowOpenHand);
QGraphicsSimpleTextItem::hoverLeaveEvent(event);
}
@ -158,7 +158,7 @@ void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
VApplication::setOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"), 1, 1);
VApplication::setOverrideCursor(cursorArrowCloseHand, 1, 1);
}
QGraphicsSimpleTextItem::mousePressEvent(event);
}
@ -169,7 +169,7 @@ void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
//Disable cursor-arrow-closehand
VApplication::restoreOverrideCursor(QStringLiteral("://cursor/cursor-arrow-closehand.png"));
VApplication::restoreOverrideCursor(cursorArrowCloseHand);
}
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
}