Use inline functions instead of plain old #define macros. QPen set width in
pixel, so need convert mm to pixel. --HG-- branch : develop
This commit is contained in:
parent
95e02fc043
commit
466bc98020
|
@ -34,10 +34,19 @@
|
||||||
|
|
||||||
#define SceneSize 50000
|
#define SceneSize 50000
|
||||||
|
|
||||||
#define PrintDPI 96
|
#define PrintDPI 96.0
|
||||||
#define toPixel(mm) ((mm / 25.4) * PrintDPI)
|
|
||||||
#define toMM(pix) ((pix / PrintDPI) * 25.4)
|
inline double toPixel(double mm)
|
||||||
#define widthMainLine 1.2
|
{
|
||||||
|
return (mm / 25.4) * PrintDPI;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double toMM(double pix)
|
||||||
|
{
|
||||||
|
return (pix / PrintDPI) * 25.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define widthMainLine 1.2 //mm
|
||||||
#define widthHairLine widthMainLine/3
|
#define widthHairLine widthMainLine/3
|
||||||
|
|
||||||
extern const QString translationsPath;
|
extern const QString translationsPath;
|
||||||
|
|
|
@ -81,7 +81,7 @@ void TableWindow::AddPaper()
|
||||||
shadowPaper->setBrush(QBrush(Qt::black));
|
shadowPaper->setBrush(QBrush(Qt::black));
|
||||||
tableScene->addItem(shadowPaper);
|
tableScene->addItem(shadowPaper);
|
||||||
paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2));
|
paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2));
|
||||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
paper->setBrush(QBrush(Qt::white));
|
paper->setBrush(QBrush(Qt::white));
|
||||||
tableScene->addItem(paper);
|
tableScene->addItem(paper);
|
||||||
qDebug()<<paper->rect().size().toSize();
|
qDebug()<<paper->rect().size().toSize();
|
||||||
|
@ -220,22 +220,22 @@ void TableWindow::saveScene()
|
||||||
case 1: //png
|
case 1: //png
|
||||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||||
PngFile(name);
|
PngFile(name);
|
||||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
break;
|
break;
|
||||||
case 2: //pdf
|
case 2: //pdf
|
||||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||||
PdfFile(name);
|
PdfFile(name);
|
||||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
break;
|
break;
|
||||||
case 3: //eps
|
case 3: //eps
|
||||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||||
EpsFile(name);
|
EpsFile(name);
|
||||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
break;
|
break;
|
||||||
case 4: //ps
|
case 4: //ps
|
||||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||||
PsFile(name);
|
PsFile(name);
|
||||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << "Bad file suffix"<<Q_FUNC_INFO;
|
qWarning() << "Bad file suffix"<<Q_FUNC_INFO;
|
||||||
|
@ -314,7 +314,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
||||||
{
|
{
|
||||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
|
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
|
||||||
Q_CHECK_PTR(bitem);
|
Q_CHECK_PTR(bitem);
|
||||||
bitem->setPen(QPen(Qt::black, widthMainLine));
|
bitem->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
listCollidingItems.removeAt(i);
|
listCollidingItems.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
||||||
{
|
{
|
||||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
|
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
|
||||||
Q_CHECK_PTR(bitem);
|
Q_CHECK_PTR(bitem);
|
||||||
bitem->setPen(QPen(Qt::black, widthMainLine));
|
bitem->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
listCollidingItems.clear();
|
listCollidingItems.clear();
|
||||||
collidingItems = true;
|
collidingItems = true;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ void TableWindow::PngFile(const QString &name) const
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
tableScene->render(&painter);
|
tableScene->render(&painter);
|
||||||
image.save(name);
|
image.save(name);
|
||||||
|
@ -474,7 +474,7 @@ void TableWindow::PdfFile(const QString &name) const
|
||||||
}
|
}
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter.setPen(QPen(Qt::black, widthMainLine, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(Qt::black, toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
tableScene->render(&painter);
|
tableScene->render(&painter);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
|
@ -196,7 +196,7 @@ protected:
|
||||||
{
|
{
|
||||||
currentColor = color;
|
currentColor = color;
|
||||||
}
|
}
|
||||||
item->setPen(QPen(currentColor, widthHairLine/factor));
|
item->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -42,7 +42,7 @@ VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::S
|
||||||
path.addPath(arc->GetPath());
|
path.addPath(arc->GetPath());
|
||||||
path.setFillRule( Qt::WindingFill );
|
path.setFillRule( Qt::WindingFill );
|
||||||
this->setPath(path);
|
this->setPath(path);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
|
@ -156,7 +156,7 @@ void VToolArc::ChangedActivDraw(const QString &newName)
|
||||||
selectable = false;
|
selectable = false;
|
||||||
currentColor = Qt::gray;
|
currentColor = Qt::gray;
|
||||||
}
|
}
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||||
this->setAcceptHoverEvents (selectable);
|
this->setAcceptHoverEvents (selectable);
|
||||||
VDrawTool::ChangedActivDraw(newName);
|
VDrawTool::ChangedActivDraw(newName);
|
||||||
|
@ -219,14 +219,14 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
//cppcheck-suppress unusedFunction
|
//cppcheck-suppress unusedFunction
|
||||||
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolArc::RemoveReferens()
|
void VToolArc::RemoveReferens()
|
||||||
|
@ -279,7 +279,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
|
||||||
|
|
||||||
void VToolArc::RefreshGeometry()
|
void VToolArc::RefreshGeometry()
|
||||||
{
|
{
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(id);
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addPath(arc->GetPath());
|
path.addPath(arc->GetPath());
|
||||||
|
|
|
@ -193,8 +193,8 @@ void VToolCutArc::ChangedActivDraw(const QString &newName)
|
||||||
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
secondArc->setAcceptHoverEvents(false);
|
secondArc->setAcceptHoverEvents(false);
|
||||||
}
|
}
|
||||||
firstArc->setPen(QPen(currentColor, widthHairLine/factor));
|
firstArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
secondArc->setPen(QPen(currentColor, widthHairLine/factor));
|
secondArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,8 +194,8 @@ void VToolCutSpline::ChangedActivDraw(const QString &newName)
|
||||||
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
secondSpline->setAcceptHoverEvents(false);
|
secondSpline->setAcceptHoverEvents(false);
|
||||||
}
|
}
|
||||||
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,8 +275,8 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
|
||||||
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
secondSpline->setAcceptHoverEvents(false);
|
secondSpline->setAcceptHoverEvents(false);
|
||||||
}
|
}
|
||||||
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firs
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine/factor, LineStyle()));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ void VToolLine::ChangedActivDraw(const QString &newName)
|
||||||
selectable = false;
|
selectable = false;
|
||||||
currentColor = Qt::gray;
|
currentColor = Qt::gray;
|
||||||
}
|
}
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
this->setAcceptHoverEvents (selectable);
|
this->setAcceptHoverEvents (selectable);
|
||||||
VDrawTool::ChangedActivDraw(newName);
|
VDrawTool::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
|
@ -178,13 +178,13 @@ void VToolLine::RefreshDataInFile()
|
||||||
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine/factor, LineStyle()));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor, LineStyle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolLine::RemoveReferens()
|
void VToolLine::RemoveReferens()
|
||||||
|
@ -246,5 +246,5 @@ void VToolLine::RefreshGeometry()
|
||||||
const VPointF *first = VAbstractTool::data.GeometricObject<const VPointF *>(firstPoint);
|
const VPointF *first = VAbstractTool::data.GeometricObject<const VPointF *>(firstPoint);
|
||||||
const VPointF *second = VAbstractTool::data.GeometricObject<const VPointF *>(secondPoint);
|
const VPointF *second = VAbstractTool::data.GeometricObject<const VPointF *>(secondPoint);
|
||||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64
|
||||||
QPointF point1 = data->GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
QPointF point1 = data->GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
||||||
QPointF point2 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
QPointF point2 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
||||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine/factor, LineStyle()));
|
mainLine->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
||||||
{
|
{
|
||||||
currentColor = Qt::gray;
|
currentColor = Qt::gray;
|
||||||
}
|
}
|
||||||
mainLine->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolLinePoint::RefreshGeometry()
|
void VToolLinePoint::RefreshGeometry()
|
||||||
{
|
{
|
||||||
mainLine->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||||
QPointF point = VDrawTool::data.GeometricObject<const VPointF *>(id)->toQPointF();
|
QPointF point = VDrawTool::data.GeometricObject<const VPointF *>(id)->toQPointF();
|
||||||
QPointF basePoint = VDrawTool::data.GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
QPointF basePoint = VDrawTool::data.GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
||||||
|
|
|
@ -84,7 +84,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
|
||||||
selectable = false;
|
selectable = false;
|
||||||
currentColor = Qt::gray;
|
currentColor = Qt::gray;
|
||||||
}
|
}
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||||
this->setAcceptHoverEvents (selectable);
|
this->setAcceptHoverEvents (selectable);
|
||||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable);
|
namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable);
|
||||||
|
@ -92,7 +92,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
|
||||||
namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable);
|
namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable);
|
||||||
namePoint->setBrush(QBrush(currentColor));
|
namePoint->setBrush(QBrush(currentColor));
|
||||||
namePoint->setAcceptHoverEvents(selectable);
|
namePoint->setAcceptHoverEvents(selectable);
|
||||||
lineName->setPen(QPen(currentColor, widthHairLine/factor));
|
lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
VDrawTool::ChangedActivDraw(newName);
|
VDrawTool::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,18 +124,18 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolPoint::RefreshPointGeometry(const VPointF &point)
|
void VToolPoint::RefreshPointGeometry(const VPointF &point)
|
||||||
{
|
{
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor);
|
QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor);
|
||||||
rec.translate(-rec.center().x(), -rec.center().y());
|
rec.translate(-rec.center().x(), -rec.center().y());
|
||||||
this->setRect(rec);
|
this->setRect(rec);
|
||||||
|
@ -161,11 +161,11 @@ void VToolPoint::RefreshLine()
|
||||||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
||||||
if (currentColor == Qt::gray)
|
if (currentColor == Qt::gray)
|
||||||
{
|
{
|
||||||
lineName->setPen(QPen(currentColor, widthHairLine/factor));
|
lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lineName->setPen(QPen(Qt::black, widthHairLine/factor));
|
lineName->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4))
|
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4))
|
||||||
{
|
{
|
||||||
|
|
|
@ -150,7 +150,7 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
|
||||||
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
|
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
|
||||||
{
|
{
|
||||||
namePoint->setBrush(color);
|
namePoint->setBrush(color);
|
||||||
lineName->setPen(QPen(color, widthHairLine/factor));
|
lineName->setPen(QPen(color, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
||||||
|
|
|
@ -44,7 +44,7 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, const T
|
||||||
path.addPath(spl->GetPath());
|
path.addPath(spl->GetPath());
|
||||||
path.setFillRule( Qt::WindingFill );
|
path.setFillRule( Qt::WindingFill );
|
||||||
this->setPath(path);
|
this->setPath(path);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
|
@ -227,13 +227,13 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolSpline::RemoveReferens()
|
void VToolSpline::RemoveReferens()
|
||||||
|
@ -309,7 +309,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
|
||||||
|
|
||||||
void VToolSpline::RefreshGeometry()
|
void VToolSpline::RefreshGeometry()
|
||||||
{
|
{
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(id);
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addPath(spl->GetPath());
|
path.addPath(spl->GetPath());
|
||||||
|
@ -348,7 +348,7 @@ void VToolSpline::ChangedActivDraw(const QString &newName)
|
||||||
selectable = false;
|
selectable = false;
|
||||||
currentColor = Qt::gray;
|
currentColor = Qt::gray;
|
||||||
}
|
}
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||||
this->setAcceptHoverEvents (selectable);
|
this->setAcceptHoverEvents (selectable);
|
||||||
emit setEnabledPoint(selectable);
|
emit setEnabledPoint(selectable);
|
||||||
|
|
|
@ -42,7 +42,7 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
||||||
path.addPath(splPath->GetPath());
|
path.addPath(splPath->GetPath());
|
||||||
path.setFillRule( Qt::WindingFill );
|
path.setFillRule( Qt::WindingFill );
|
||||||
this->setPath(path);
|
this->setPath(path);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
this->setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
|
@ -202,7 +202,7 @@ void VToolSplinePath::ChangedActivDraw(const QString &newName)
|
||||||
selectable = false;
|
selectable = false;
|
||||||
currentColor = Qt::gray;
|
currentColor = Qt::gray;
|
||||||
}
|
}
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||||
this->setAcceptHoverEvents (selectable);
|
this->setAcceptHoverEvents (selectable);
|
||||||
emit setEnabledPoint(selectable);
|
emit setEnabledPoint(selectable);
|
||||||
|
@ -299,13 +299,13 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolSplinePath::RemoveReferens()
|
void VToolSplinePath::RemoveReferens()
|
||||||
|
@ -382,7 +382,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
|
||||||
|
|
||||||
void VToolSplinePath::RefreshGeometry()
|
void VToolSplinePath::RefreshGeometry()
|
||||||
{
|
{
|
||||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(id);
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addPath(splPath->GetPath());
|
path.addPath(splPath->GetPath());
|
||||||
|
|
|
@ -38,7 +38,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
|
||||||
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
|
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
|
||||||
{
|
{
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
this->setPen(QPen(baseColor, widthHairLine));
|
this->setPen(QPen(baseColor, toPixel(widthHairLine)));
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -129,13 +129,13 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodeArc::RefreshGeometry()
|
void VNodeArc::RefreshGeometry()
|
||||||
|
|
|
@ -43,7 +43,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id
|
||||||
lineName = new QGraphicsLineItem(this);
|
lineName = new QGraphicsLineItem(this);
|
||||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
||||||
&VNodePoint::NameChangePosition);
|
&VNodePoint::NameChangePosition);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
this->setBrush(QBrush(Qt::NoBrush));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
|
@ -146,13 +146,13 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64
|
||||||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
||||||
{
|
{
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
this->setPen(QPen(baseColor, widthHairLine));
|
this->setPen(QPen(baseColor, toPixel(widthHairLine)));
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -132,13 +132,13 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodeSpline::RefreshGeometry()
|
void VNodeSpline::RefreshGeometry()
|
||||||
|
|
|
@ -39,7 +39,7 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
||||||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
||||||
{
|
{
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
this->setPen(QPen(baseColor, widthHairLine));
|
this->setPen(QPen(baseColor, toPixel(widthHairLine)));
|
||||||
|
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
|
@ -136,13 +136,13 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNodeSplinePath::RefreshGeometry()
|
void VNodeSplinePath::RefreshGeometry()
|
||||||
|
|
|
@ -40,7 +40,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint:
|
||||||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
||||||
rec.translate(-rec.center().x(), -rec.center().y());
|
rec.translate(-rec.center().x(), -rec.center().y());
|
||||||
this->setRect(rec);
|
this->setRect(rec);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||||
this->setBrush(QBrush(Qt::NoBrush));
|
this->setBrush(QBrush(Qt::NoBrush));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
|
@ -51,20 +51,20 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint:
|
||||||
QPointF p1, p2;
|
QPointF p1, p2;
|
||||||
VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2);
|
VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2);
|
||||||
controlLine = new QGraphicsLineItem(QLineF(splinePoint-controlPoint, p1), this);
|
controlLine = new QGraphicsLineItem(QLineF(splinePoint-controlPoint, p1), this);
|
||||||
controlLine->setPen(QPen(Qt::red, widthHairLine));
|
controlLine->setPen(QPen(Qt::red, toPixel(widthHairLine)));
|
||||||
controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(Qt::black, widthMainLine));
|
this->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||||
|
@ -93,14 +93,14 @@ void VControlPointSpline::setEnabledPoint(bool enable)
|
||||||
{
|
{
|
||||||
if (enable == true)
|
if (enable == true)
|
||||||
{
|
{
|
||||||
this->setPen(QPen(Qt::black, widthHairLine));
|
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||||
this->setAcceptHoverEvents(true);
|
this->setAcceptHoverEvents(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
this->setPen(QPen(Qt::gray, toPixel(widthHairLine)));
|
||||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, false);
|
this->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||||
this->setAcceptHoverEvents(false);
|
this->setAcceptHoverEvents(false);
|
||||||
|
|
|
@ -52,19 +52,19 @@ void VItem::checkItemChange()
|
||||||
QRectF myrect = sceneBoundingRect();
|
QRectF myrect = sceneBoundingRect();
|
||||||
if ( rect.contains( myrect )==true )
|
if ( rect.contains( myrect )==true )
|
||||||
{
|
{
|
||||||
setPen(QPen(Qt::black, widthMainLine));
|
setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||||
emit itemOut( numInOutList, false );
|
emit itemOut( numInOutList, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setPen(QPen(Qt::red, widthMainLine));
|
setPen(QPen(Qt::red, toPixel(widthMainLine)));
|
||||||
emit itemOut( numInOutList, true );
|
emit itemOut( numInOutList, true );
|
||||||
}
|
}
|
||||||
QList<QGraphicsItem *> list = QGraphicsItem::collidingItems ();
|
QList<QGraphicsItem *> list = QGraphicsItem::collidingItems ();
|
||||||
if ( list.size() - 2 > 0 )
|
if ( list.size() - 2 > 0 )
|
||||||
{
|
{
|
||||||
list.append( this );
|
list.append( this );
|
||||||
setPen(QPen(Qt::red, widthMainLine));
|
setPen(QPen(Qt::red, toPixel(widthMainLine)));
|
||||||
emit itemColliding( list, 1 );//Detail intersect with other details.
|
emit itemColliding( list, 1 );//Detail intersect with other details.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -33,11 +33,11 @@ VSimpleArc::VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor,
|
||||||
{
|
{
|
||||||
if (factor == 0)
|
if (factor == 0)
|
||||||
{
|
{
|
||||||
setPen(QPen(Qt::black, widthHairLine));
|
setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setPen(QPen(Qt::black, widthHairLine/ *factor));
|
setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor));
|
||||||
}
|
}
|
||||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
@ -57,11 +57,11 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
if (factor == 0)
|
if (factor == 0)
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthMainLine));
|
this->setPen(QPen(*currentColor, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthMainLine/ *factor));
|
this->setPen(QPen(*currentColor, toPixel(widthMainLine)/ *factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
if (factor == 0)
|
if (factor == 0)
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthHairLine));
|
this->setPen(QPen(*currentColor, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthHairLine/ *factor));
|
this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ VSimpleSpline::VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *fa
|
||||||
{
|
{
|
||||||
if (factor == 0)
|
if (factor == 0)
|
||||||
{
|
{
|
||||||
setPen(QPen(Qt::black, widthHairLine));
|
setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setPen(QPen(Qt::black, widthHairLine/ *factor));
|
setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor));
|
||||||
}
|
}
|
||||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
|
@ -58,11 +58,11 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
if (factor == 0)
|
if (factor == 0)
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthMainLine));
|
this->setPen(QPen(*currentColor, toPixel(widthMainLine)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthMainLine/ *factor));
|
this->setPen(QPen(*currentColor, toPixel(widthMainLine)/ *factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +71,10 @@ void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
if (factor == 0)
|
if (factor == 0)
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthHairLine));
|
this->setPen(QPen(*currentColor, toPixel(widthHairLine)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->setPen(QPen(*currentColor, widthHairLine/ *factor));
|
this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthMainLine/ *factor));
|
this->setPen(QPen(currentColor, toPixel(widthMainLine)/ *factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
this->setPen(QPen(currentColor, widthHairLine/ *factor));
|
this->setPen(QPen(currentColor, toPixel(widthHairLine)/ *factor));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user