Merge with develop
--HG-- branch : feature
This commit is contained in:
commit
1a2d1cbff8
|
@ -47,7 +47,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxBiasX"/>
|
||||
<widget class="QSpinBox" name="spinBoxBiasX">
|
||||
<property name="minimum">
|
||||
<number>-3000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -67,7 +74,14 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxBiasY"/>
|
||||
<widget class="QSpinBox" name="spinBoxBiasY">
|
||||
<property name="minimum">
|
||||
<number>-3000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -176,7 +190,11 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxSeams"/>
|
||||
<widget class="QSpinBox" name="spinBoxSeams">
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
|
@ -34,10 +34,19 @@
|
|||
|
||||
#define SceneSize 50000
|
||||
|
||||
#define PrintDPI 96
|
||||
#define toPixel(mm) ((mm / 25.4) * PrintDPI)
|
||||
#define toMM(pix) ((pix / PrintDPI) * 25.4)
|
||||
#define widthMainLine 1.2
|
||||
#define PrintDPI 96.0
|
||||
|
||||
inline double toPixel(double mm)
|
||||
{
|
||||
return (mm / 25.4) * PrintDPI;
|
||||
}
|
||||
|
||||
inline double toMM(double pix)
|
||||
{
|
||||
return (pix / PrintDPI) * 25.4;
|
||||
}
|
||||
|
||||
#define widthMainLine 1.2 //mm
|
||||
#define widthHairLine widthMainLine/3
|
||||
|
||||
extern const QString translationsPath;
|
||||
|
|
|
@ -81,7 +81,7 @@ void TableWindow::AddPaper()
|
|||
shadowPaper->setBrush(QBrush(Qt::black));
|
||||
tableScene->addItem(shadowPaper);
|
||||
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));
|
||||
tableScene->addItem(paper);
|
||||
qDebug()<<paper->rect().size().toSize();
|
||||
|
@ -93,10 +93,10 @@ void TableWindow::AddDetail()
|
|||
{
|
||||
tableScene->clearSelection();
|
||||
VItem* Detail = listDetails[indexDetail];
|
||||
QObject::connect(Detail, SIGNAL(itemOut(int, bool)), this, SLOT(itemOut(int, bool)));
|
||||
QObject::connect(Detail, SIGNAL(itemColliding(QList<QGraphicsItem*>, int)), this,
|
||||
SLOT(itemColliding(QList<QGraphicsItem*>, int)));
|
||||
QObject::connect(this, SIGNAL(LengthChanged()), Detail, SLOT(LengthChanged()));
|
||||
Q_CHECK_PTR(Detail);
|
||||
connect(Detail, &VItem::itemOut, this, &TableWindow::itemOut);
|
||||
connect(Detail, &VItem::itemColliding, this, &TableWindow::itemColliding);
|
||||
connect(this, &TableWindow::LengthChanged, Detail, &VItem::LengthChanged);
|
||||
Detail->setPen(QPen(Qt::black, 1));
|
||||
Detail->setBrush(QBrush(Qt::white));
|
||||
Detail->setPos(paper->boundingRect().center());
|
||||
|
@ -122,7 +122,16 @@ void TableWindow::ModelChosen(QVector<VItem*> listDetails, const QString &fileNa
|
|||
{
|
||||
this->description = description;
|
||||
|
||||
QFileInfo fi( fileName );
|
||||
QString file;
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
file = tr("untitled");
|
||||
}
|
||||
else
|
||||
{
|
||||
file = fileName;
|
||||
}
|
||||
QFileInfo fi( file );
|
||||
this->fileName = fi.baseName();
|
||||
|
||||
this->listDetails = listDetails;
|
||||
|
@ -220,22 +229,22 @@ void TableWindow::saveScene()
|
|||
case 1: //png
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
PngFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
break;
|
||||
case 2: //pdf
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
PdfFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
break;
|
||||
case 3: //eps
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
EpsFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
break;
|
||||
case 4: //ps
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
PsFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
paper->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Bad file suffix"<<Q_FUNC_INFO;
|
||||
|
@ -314,7 +323,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
|||
{
|
||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(i) );
|
||||
Q_CHECK_PTR(bitem);
|
||||
bitem->setPen(QPen(Qt::black, widthMainLine));
|
||||
bitem->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
listCollidingItems.removeAt(i);
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +332,7 @@ void TableWindow::itemColliding(QList<QGraphicsItem *> list, int number)
|
|||
{
|
||||
VItem * bitem = qgraphicsitem_cast<VItem *> ( listCollidingItems.at(0) );
|
||||
Q_CHECK_PTR(bitem);
|
||||
bitem->setPen(QPen(Qt::black, widthMainLine));
|
||||
bitem->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
listCollidingItems.clear();
|
||||
collidingItems = true;
|
||||
}
|
||||
|
@ -425,6 +434,7 @@ void TableWindow::SvgFile(const QString &name) const
|
|||
QSvgGenerator generator;
|
||||
generator.setFileName(name);
|
||||
generator.setSize(paper->rect().size().toSize());
|
||||
generator.setViewBox(paper->rect());
|
||||
generator.setTitle("Valentina pattern");
|
||||
generator.setDescription(description);
|
||||
generator.setResolution(PrintDPI);
|
||||
|
@ -432,7 +442,7 @@ void TableWindow::SvgFile(const QString &name) const
|
|||
painter.begin(&generator);
|
||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(QPen(Qt::black, 1.2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
painter.setPen(QPen(Qt::black, toPixel(widthHairLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||
tableScene->render(&painter);
|
||||
painter.end();
|
||||
|
@ -449,7 +459,7 @@ void TableWindow::PngFile(const QString &name) const
|
|||
QPainter painter(&image);
|
||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||
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 ) );
|
||||
tableScene->render(&painter);
|
||||
image.save(name);
|
||||
|
@ -473,7 +483,7 @@ void TableWindow::PdfFile(const QString &name) const
|
|||
}
|
||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||
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 ) );
|
||||
tableScene->render(&painter);
|
||||
painter.end();
|
||||
|
@ -509,31 +519,26 @@ void TableWindow::PsFile(const QString &name) const
|
|||
|
||||
//TODO delete parametr name and use last parameter in string list instead.
|
||||
void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const
|
||||
{
|
||||
QProcess proc;
|
||||
QString program;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
program = "pdftops.exe";
|
||||
#else
|
||||
program = "pdftops";
|
||||
#endif
|
||||
|
||||
{
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
proc.start(program, params);
|
||||
QProcess proc;
|
||||
#ifdef Q_OS_WIN
|
||||
proc.start("pdftops.exe", params);
|
||||
#else
|
||||
proc.start("pdftops", params);
|
||||
#endif
|
||||
proc.waitForFinished(15000);
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
qDebug() << proc.errorString();
|
||||
|
||||
QFile f(name);
|
||||
if (f.exists() == false)
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Critical, "Critical error!", "Creating file '"+name+"' failed!",
|
||||
QMessageBox::Ok | QMessageBox::Default);
|
||||
QString msg = QString(tr("Creating file '%1' failed! %2")).arg(name).arg(proc.errorString());
|
||||
QMessageBox msgBox(QMessageBox::Critical, tr("Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default);
|
||||
msgBox.exec();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ protected:
|
|||
{
|
||||
currentColor = color;
|
||||
}
|
||||
item->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
item->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
}
|
||||
private:
|
||||
|
|
|
@ -42,7 +42,7 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sour
|
|||
path.addPath(arc->GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
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::ItemIsFocusable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
@ -156,7 +156,7 @@ void VToolArc::ChangedActivDraw(const QString &newName)
|
|||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
|
@ -219,14 +219,14 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
//cppcheck-suppress unusedFunction
|
||||
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
void VToolArc::RemoveReferens()
|
||||
|
@ -279,7 +279,7 @@ void VToolArc::SaveDialog(QDomElement &domElement)
|
|||
|
||||
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);
|
||||
QPainterPath path;
|
||||
path.addPath(arc->GetPath());
|
||||
|
|
|
@ -193,8 +193,8 @@ void VToolCutArc::ChangedActivDraw(const QString &newName)
|
|||
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
secondArc->setAcceptHoverEvents(false);
|
||||
}
|
||||
firstArc->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
secondArc->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
firstArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
secondArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
|
|
|
@ -194,8 +194,8 @@ void VToolCutSpline::ChangedActivDraw(const QString &newName)
|
|||
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
secondSpline->setAcceptHoverEvents(false);
|
||||
}
|
||||
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
|
|
|
@ -275,8 +275,8 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
|
|||
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
secondSpline->setAcceptHoverEvents(false);
|
||||
}
|
||||
firstSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
secondSpline->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP
|
|||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsFocusable, 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)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ void VToolLine::ChangedActivDraw(const QString &newName)
|
|||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
@ -178,13 +178,13 @@ void VToolLine::RefreshDataInFile()
|
|||
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor, LineStyle()));
|
||||
}
|
||||
|
||||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||
}
|
||||
|
||||
void VToolLine::RemoveReferens()
|
||||
|
@ -246,5 +246,5 @@ void VToolLine::RefreshGeometry()
|
|||
const VPointF *first = VAbstractTool::data.GeometricObject<const VPointF *>(firstPoint);
|
||||
const VPointF *second = VAbstractTool::data.GeometricObject<const VPointF *>(secondPoint);
|
||||
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(VPattern *doc, VContainer *data, const quint32 &i
|
|||
QPointF point1 = data->GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
||||
QPointF point2 = data->GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
|||
{
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
mainLine->setPen(QPen(currentColor, widthHairLine/factor, LineStyle()));
|
||||
mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle()));
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
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));
|
||||
QPointF point = VDrawTool::data.GeometricObject<const VPointF *>(id)->toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GeometricObject<const VPointF *>(basePointId)->toQPointF();
|
||||
|
|
|
@ -84,7 +84,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
|
|||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable);
|
||||
|
@ -92,7 +92,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
|
|||
namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable);
|
||||
namePoint->setBrush(QBrush(currentColor));
|
||||
namePoint->setAcceptHoverEvents(selectable);
|
||||
lineName->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
|
@ -124,18 +124,18 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
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);
|
||||
rec.translate(-rec.center().x(), -rec.center().y());
|
||||
this->setRect(rec);
|
||||
|
@ -161,11 +161,11 @@ void VToolPoint::RefreshLine()
|
|||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
||||
if (currentColor == Qt::gray)
|
||||
{
|
||||
lineName->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
lineName->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4))
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement)
|
|||
void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color)
|
||||
{
|
||||
namePoint->setBrush(color);
|
||||
lineName->setPen(QPen(color, widthHairLine/factor));
|
||||
lineName->setPen(QPen(color, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
||||
|
|
|
@ -44,7 +44,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Tool
|
|||
path.addPath(spl->GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
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::ItemIsFocusable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
@ -227,13 +227,13 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSpline::RemoveReferens()
|
||||
|
@ -309,7 +309,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement)
|
|||
|
||||
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);
|
||||
QPainterPath path;
|
||||
path.addPath(spl->GetPath());
|
||||
|
@ -348,7 +348,7 @@ void VToolSpline::ChangedActivDraw(const QString &newName)
|
|||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
emit setEnabledPoint(selectable);
|
||||
|
|
|
@ -42,7 +42,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co
|
|||
path.addPath(splPath->GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
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::ItemIsFocusable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
@ -202,7 +202,7 @@ void VToolSplinePath::ChangedActivDraw(const QString &newName)
|
|||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, selectable);
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
emit setEnabledPoint(selectable);
|
||||
|
@ -299,13 +299,13 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
|
||||
}
|
||||
|
||||
void VToolSplinePath::RemoveReferens()
|
||||
|
@ -382,7 +382,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement)
|
|||
|
||||
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);
|
||||
QPainterPath path;
|
||||
path.addPath(splPath->GetPath());
|
||||
|
|
|
@ -38,7 +38,7 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, c
|
|||
:VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent)
|
||||
{
|
||||
RefreshGeometry();
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, toPixel(widthHairLine)));
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
|
@ -129,13 +129,13 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||
}
|
||||
|
||||
void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||
}
|
||||
|
||||
void VNodeArc::RefreshGeometry()
|
||||
|
|
|
@ -43,7 +43,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo
|
|||
lineName = new QGraphicsLineItem(this);
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
||||
&VNodePoint::NameChangePosition);
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||
this->setBrush(QBrush(Qt::NoBrush));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
@ -146,13 +146,13 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||
}
|
||||
|
||||
void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id
|
|||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
||||
{
|
||||
RefreshGeometry();
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, toPixel(widthHairLine)));
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
|
@ -132,13 +132,13 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||
}
|
||||
|
||||
void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||
}
|
||||
|
||||
void VNodeSpline::RefreshGeometry()
|
||||
|
|
|
@ -39,7 +39,7 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu
|
|||
:VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent)
|
||||
{
|
||||
RefreshGeometry();
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, toPixel(widthHairLine)));
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
|
@ -136,13 +136,13 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)));
|
||||
}
|
||||
|
||||
void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, toPixel(widthHairLine)));
|
||||
}
|
||||
|
||||
void VNodeSplinePath::RefreshGeometry()
|
||||
|
|
|
@ -41,7 +41,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint:
|
|||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
||||
rec.translate(-rec.center().x(), -rec.center().y());
|
||||
this->setRect(rec);
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||
this->setBrush(QBrush(Qt::NoBrush));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
|
@ -52,20 +52,20 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint:
|
|||
QPointF p1, p2;
|
||||
VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2);
|
||||
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);
|
||||
}
|
||||
|
||||
void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(Qt::black, widthMainLine));
|
||||
this->setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
}
|
||||
|
||||
void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *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)
|
||||
|
@ -94,14 +94,14 @@ void VControlPointSpline::setEnabledPoint(bool enable)
|
|||
{
|
||||
if (enable == true)
|
||||
{
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
||||
this->setPen(QPen(Qt::gray, toPixel(widthHairLine)));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
this->setAcceptHoverEvents(false);
|
||||
|
|
|
@ -63,19 +63,19 @@ void VItem::checkItemChange()
|
|||
QRectF myrect = sceneBoundingRect();
|
||||
if ( rect.contains( myrect )==true )
|
||||
{
|
||||
setPen(QPen(Qt::black, widthMainLine));
|
||||
setPen(QPen(Qt::black, toPixel(widthMainLine)));
|
||||
emit itemOut( numInOutList, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
setPen(QPen(Qt::red, widthMainLine));
|
||||
setPen(QPen(Qt::red, toPixel(widthMainLine)));
|
||||
emit itemOut( numInOutList, true );
|
||||
}
|
||||
QList<QGraphicsItem *> list = QGraphicsItem::collidingItems ();
|
||||
if ( list.size() - 2 > 0 )
|
||||
{
|
||||
list.append( this );
|
||||
setPen(QPen(Qt::red, widthMainLine));
|
||||
setPen(QPen(Qt::red, toPixel(widthMainLine)));
|
||||
emit itemColliding( list, 1 );//Detail intersect with other details.
|
||||
}
|
||||
else
|
||||
|
|
|
@ -33,11 +33,11 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor,
|
|||
{
|
||||
if (factor == nullptr)
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine));
|
||||
setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||
}
|
||||
else
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine/ *factor));
|
||||
setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor));
|
||||
}
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setAcceptHoverEvents(true);
|
||||
|
@ -57,11 +57,11 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|||
Q_UNUSED(event);
|
||||
if (factor == nullptr)
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthMainLine));
|
||||
this->setPen(QPen(*currentColor, toPixel(widthMainLine)));
|
||||
}
|
||||
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);
|
||||
if (factor == nullptr)
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthHairLine));
|
||||
this->setPen(QPen(*currentColor, toPixel(widthHairLine)));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthHairLine/ *factor));
|
||||
this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *f
|
|||
{
|
||||
if (factor == nullptr)
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine));
|
||||
setPen(QPen(Qt::black, toPixel(widthHairLine)));
|
||||
}
|
||||
else
|
||||
{
|
||||
setPen(QPen(Qt::black, widthHairLine/ *factor));
|
||||
setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor));
|
||||
}
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
setAcceptHoverEvents(true);
|
||||
|
@ -58,11 +58,11 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|||
Q_UNUSED(event);
|
||||
if (factor == nullptr)
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthMainLine));
|
||||
this->setPen(QPen(*currentColor, toPixel(widthMainLine)));
|
||||
}
|
||||
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);
|
||||
if (factor == nullptr)
|
||||
{
|
||||
this->setPen(QPen(*currentColor, widthHairLine));
|
||||
this->setPen(QPen(*currentColor, toPixel(widthHairLine)));
|
||||
}
|
||||
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)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine/ *factor));
|
||||
this->setPen(QPen(currentColor, toPixel(widthMainLine)/ *factor));
|
||||
}
|
||||
|
||||
void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *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