Zooming points, line and label of points after zooming scene.
--HG-- branch : develop
This commit is contained in:
parent
eb03e8165e
commit
2fffdecc86
|
@ -62,6 +62,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
view = new VMainGraphicsView();
|
||||
ui->LayoutView->addWidget(view);
|
||||
view->setScene(currentScene);
|
||||
connect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
policy.setHorizontalStretch(12);
|
||||
view->setSizePolicy(policy);
|
||||
|
@ -162,6 +163,7 @@ void MainWindow::ActionNewDraw(){
|
|||
VToolSinglePoint *spoint = new VToolSinglePoint(doc, data, id, Tool::FromGui);
|
||||
sceneDraw->addItem(spoint);
|
||||
connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||
QHash<qint64, VDataTool*>* tools = doc->getTools();
|
||||
tools->insert(id, spoint);
|
||||
VDrawTool::AddRecord(id, Tool::SinglePointTool, doc);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define PaperSize 50000
|
||||
#define toPixel(mm) ((mm / 25.4) * PrintDPI)
|
||||
#define toMM(pix) ((pix / PrintDPI) * 25.4)
|
||||
#define widthMainLine toPixel(0.8)
|
||||
#define widthMainLine toPixel(1.2)
|
||||
#define widthHairLine widthMainLine/3
|
||||
|
||||
namespace Scene{
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "vdrawtool.h"
|
||||
#include <QDebug>
|
||||
|
||||
qreal VDrawTool::factor = 1;
|
||||
|
||||
VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) :
|
||||
VAbstractTool(doc, data, id, parent), ignoreContextMenuEvent(false),
|
||||
nameActivDraw(doc->GetNameActivDraw()){
|
||||
|
@ -78,6 +80,12 @@ void VDrawTool::ChangedNameDraw(const QString oldName, const QString newName){
|
|||
}
|
||||
}
|
||||
|
||||
void VDrawTool::SetFactor(qreal factor){
|
||||
if(factor <= 2 && factor >= 0.5){
|
||||
this->factor = factor;
|
||||
}
|
||||
}
|
||||
|
||||
void VDrawTool::AddToCalculation(const QDomElement &domElement){
|
||||
QDomElement calcElement;
|
||||
bool ok = doc->GetActivCalculationElement(calcElement);
|
||||
|
|
|
@ -38,11 +38,13 @@ public slots:
|
|||
virtual void ChangedActivDraw(const QString newName);
|
||||
void ChangedNameDraw(const QString oldName, const QString newName);
|
||||
virtual void FullUpdateFromGui(int result)=0;
|
||||
virtual void SetFactor(qreal factor);
|
||||
signals:
|
||||
void RemoveTool(QGraphicsItem *tool);
|
||||
protected:
|
||||
bool ignoreContextMenuEvent;
|
||||
QString nameActivDraw;
|
||||
static qreal factor;
|
||||
void AddToCalculation(const QDomElement &domElement);
|
||||
template <typename Dialog, typename Tool>
|
||||
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
|
||||
|
|
|
@ -63,6 +63,11 @@ void VToolAlongLine::FullUpdateFromGui(int result){
|
|||
dialogAlongLine.clear();
|
||||
}
|
||||
|
||||
void VToolAlongLine::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogAlongLine, this, event);
|
||||
}
|
||||
|
@ -145,6 +150,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolAlongLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolAlongLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolAlongLine::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -30,7 +30,7 @@ VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources
|
|||
path.addPath(arc.GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
this->setPath(path);
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
|
@ -126,14 +126,16 @@ void VToolArc::FullUpdateFromGui(int result){
|
|||
|
||||
void VToolArc::ChangedActivDraw(const QString newName){
|
||||
if(nameActivDraw == newName){
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
currentColor = Qt::black;
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
} else {
|
||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
||||
this->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
this->setAcceptHoverEvents (false);
|
||||
currentColor = Qt::gray;
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
}
|
||||
|
@ -141,15 +143,20 @@ void VToolArc::ChangedActivDraw(const QString newName){
|
|||
void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
||||
if(id == this->id){
|
||||
if(enable == false){
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, widthHairLine/factor));
|
||||
currentColor = baseColor;
|
||||
} else {
|
||||
this->setPen(QPen(color, widthHairLine));
|
||||
this->setPen(QPen(color, widthHairLine/factor));
|
||||
currentColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VToolArc::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogArc, this, event);
|
||||
}
|
||||
|
@ -177,12 +184,12 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
|
|||
|
||||
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
}
|
||||
|
||||
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
|
||||
void VToolArc::RemoveReferens(){
|
||||
|
@ -191,6 +198,7 @@ void VToolArc::RemoveReferens(){
|
|||
}
|
||||
|
||||
void VToolArc::RefreshGeometry(){
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
VArc arc = VAbstractTool::data.GetArc(id);
|
||||
QPainterPath path;
|
||||
path.addPath(arc.GetPath());
|
||||
|
|
|
@ -30,21 +30,20 @@
|
|||
class VToolArc :public VDrawTool, public QGraphicsPathItem{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolArc(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
static void Create(QSharedPointer<DialogArc> &dialog, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc,
|
||||
static void Create(QSharedPointer<DialogArc> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data);
|
||||
static void Create(const qint64 _id, const qint64 ¢er, const QString &radius,
|
||||
const QString &f1, const QString &f2, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1,
|
||||
const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void ChangedActivDraw(const QString newName);
|
||||
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -109,6 +109,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolBisector::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolBisector::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolBisector::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
@ -145,6 +146,11 @@ void VToolBisector::FullUpdateFromGui(int result){
|
|||
dialogBisector.clear();
|
||||
}
|
||||
|
||||
void VToolBisector::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogBisector, this, event);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -69,7 +69,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
|
|||
QString errorMsg;
|
||||
qreal result = cal.eval(formula, &errorMsg);
|
||||
if(errorMsg.isEmpty()){
|
||||
line.setLength(result*PrintDPI/25.4);
|
||||
line.setLength(toPixel(result));
|
||||
line.setAngle(angle);
|
||||
qint64 id = _id;
|
||||
if(typeCreation == Tool::FromGui){
|
||||
|
@ -89,6 +89,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(basePointId);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firs
|
|||
this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
|
||||
if(typeCreation == Tool::FromGui){
|
||||
AddToFile();
|
||||
|
@ -74,6 +75,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
|
|||
scene->addItem(line);
|
||||
connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(line, &VToolLine::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor);
|
||||
doc->AddTool(id, line);
|
||||
doc->IncrementReferens(firstPoint);
|
||||
doc->IncrementReferens(secondPoint);
|
||||
|
@ -81,14 +83,7 @@ void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64
|
|||
}
|
||||
|
||||
void VToolLine::FullUpdateFromFile(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
firstPoint = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPoint = domElement.attribute("secondPoint", "").toLongLong();
|
||||
}
|
||||
VPointF first = VAbstractTool::data.GetPoint(firstPoint);
|
||||
VPointF second = VAbstractTool::data.GetPoint(secondPoint);
|
||||
this->setLine(QLineF(first.toQPointF(), second.toQPointF()));
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolLine::FullUpdateFromGui(int result){
|
||||
|
@ -106,23 +101,30 @@ void VToolLine::FullUpdateFromGui(int result){
|
|||
void VToolLine::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
||||
if(id == this->id){
|
||||
if(enable == false){
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, widthHairLine/factor));
|
||||
currentColor = baseColor;
|
||||
} else {
|
||||
this->setPen(QPen(color, widthHairLine));
|
||||
this->setPen(QPen(color, widthHairLine/factor));
|
||||
currentColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLine::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolLine::ChangedActivDraw(const QString newName){
|
||||
if(nameActivDraw == newName){
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setAcceptHoverEvents (true);
|
||||
currentColor = Qt::black;
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
} else {
|
||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
||||
this->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
this->setAcceptHoverEvents (false);
|
||||
currentColor = Qt::gray;
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
}
|
||||
|
@ -143,12 +145,12 @@ void VToolLine::AddToFile(){
|
|||
|
||||
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
}
|
||||
|
||||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
|
||||
void VToolLine::RemoveReferens(){
|
||||
|
@ -156,3 +158,15 @@ void VToolLine::RemoveReferens(){
|
|||
doc->DecrementReferens(secondPoint);
|
||||
}
|
||||
|
||||
void VToolLine::RefreshGeometry(){
|
||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||
if(domElement.isElement()){
|
||||
firstPoint = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPoint = domElement.attribute("secondPoint", "").toLongLong();
|
||||
}
|
||||
VPointF first = VAbstractTool::data.GetPoint(firstPoint);
|
||||
VPointF second = VAbstractTool::data.GetPoint(secondPoint);
|
||||
this->setLine(QLineF(first.toQPointF(), second.toQPointF()));
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ public:
|
|||
VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint,
|
||||
qint64 secondPoint, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
static void Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data);
|
||||
static void Create(QSharedPointer<DialogLine> &dialog, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data);
|
||||
static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
|
@ -42,6 +42,7 @@ public slots:
|
|||
virtual void ChangedActivDraw(const QString newName);
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
@ -52,6 +53,7 @@ private:
|
|||
qint64 firstPoint;
|
||||
qint64 secondPoint;
|
||||
QSharedPointer<DialogLine> dialogLine;
|
||||
void RefreshGeometry();
|
||||
};
|
||||
|
||||
#endif // VTOOLLINE_H
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
|
||||
const qint64 &p2Line2, Tool::Sources typeCreation, QGraphicsItem *parent):
|
||||
const qint64 &p2Line2, Tool::Sources typeCreation,
|
||||
QGraphicsItem *parent):
|
||||
VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2),
|
||||
p2Line2(p2Line2), dialogLineIntersect(QSharedPointer<DialogLineIntersect>()){
|
||||
if(typeCreation == Tool::FromGui){
|
||||
|
@ -57,8 +58,9 @@ void VToolLineIntersect::Create(QSharedPointer<DialogLineIntersect> &dialog, VMa
|
|||
|
||||
void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
|
||||
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation){
|
||||
VPointF p1Line1 = data->GetPoint(p1Line1Id);
|
||||
VPointF p2Line1 = data->GetPoint(p2Line1Id);
|
||||
VPointF p1Line2 = data->GetPoint(p1Line2Id);
|
||||
|
@ -94,6 +96,7 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolLineIntersect::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolLineIntersect::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolLineIntersect::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(p1Line1Id);
|
||||
doc->IncrementReferens(p2Line1Id);
|
||||
|
@ -129,6 +132,11 @@ void VToolLineIntersect::FullUpdateFromGui(int result){
|
|||
dialogLineIntersect.clear();
|
||||
}
|
||||
|
||||
void VToolLineIntersect::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
|
||||
}
|
||||
|
||||
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogLineIntersect, this, event);
|
||||
}
|
||||
|
@ -140,8 +148,8 @@ void VToolLineIntersect::AddToFile(){
|
|||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "lineIntersect");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "my", point.my()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "p1Line1", p1Line1);
|
||||
AddAttribute(domElement, "p2Line1", p2Line1);
|
||||
|
|
|
@ -28,25 +28,21 @@
|
|||
class VToolLineIntersect:public VToolPoint{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolLineIntersect(VDomDocument *doc, VContainer *data,
|
||||
const qint64 &id,
|
||||
const qint64 &p1Line1,
|
||||
const qint64 &p2Line1, const qint64 &p1Line2,
|
||||
VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
|
||||
const qint64 &p2Line2, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
static void Create(QSharedPointer<DialogLineIntersect> &dialog,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data);
|
||||
static void Create(const qint64 _id, const qint64 &p1Line1Id,
|
||||
const qint64 &p2Line1Id, const qint64 &p1Line2Id,
|
||||
const qint64 &p2Line2Id, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static void Create(QSharedPointer<DialogLineIntersect> &dialog, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data);
|
||||
static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id,
|
||||
const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -30,7 +30,7 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64
|
|||
QPointF point1 = data->GetPoint(basePointId).toQPointF();
|
||||
QPointF point2 = data->GetPoint(id).toQPointF();
|
||||
mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this);
|
||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
||||
mainLine->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
if(typeLine == "none"){
|
||||
mainLine->setVisible(false);
|
||||
|
@ -41,15 +41,18 @@ VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64
|
|||
|
||||
void VToolLinePoint::ChangedActivDraw(const QString newName){
|
||||
if(nameActivDraw == newName){
|
||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
||||
mainLine->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
currentColor = Qt::black;
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
} else {
|
||||
mainLine->setPen(QPen(Qt::gray, widthHairLine));
|
||||
mainLine->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
currentColor = Qt::gray;
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolLinePoint::RefreshGeometry(){
|
||||
mainLine->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
VToolPoint::RefreshPointGeometry(VDrawTool::data.GetPoint(id));
|
||||
QPointF point = VDrawTool::data.GetPoint(id).toQPointF();
|
||||
QPointF basePoint = VDrawTool::data.GetPoint(basePointId).toQPointF();
|
||||
|
@ -64,3 +67,8 @@ void VToolLinePoint::RefreshGeometry(){
|
|||
void VToolLinePoint::RemoveReferens(){
|
||||
doc->DecrementReferens(basePointId);
|
||||
}
|
||||
|
||||
void VToolLinePoint::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0);
|
||||
public slots:
|
||||
virtual void ChangedActivDraw(const QString newName);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
QString typeLine;
|
||||
QString formula;
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
|
||||
#include "vtoolnormal.h"
|
||||
|
||||
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine,
|
||||
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||
const QString &formula, const qreal &angle, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem *parent):
|
||||
VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent),
|
||||
|
@ -62,7 +61,8 @@ void VToolNormal::Create(QSharedPointer<DialogNormal> &dialog, VMainGraphicsScen
|
|||
void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, const QString typeLine, const QString pointName,
|
||||
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation){
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation){
|
||||
VPointF firstPoint = data->GetPoint(firstPointId);
|
||||
VPointF secondPoint = data->GetPoint(secondPointId);
|
||||
Calculator cal(data);
|
||||
|
@ -70,7 +70,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64
|
|||
qreal result = cal.eval(formula, &errorMsg);
|
||||
if(errorMsg.isEmpty()){
|
||||
QPointF fPoint = VToolNormal::FindPoint(firstPoint.toQPointF(), secondPoint.toQPointF(),
|
||||
result*PrintDPI/25.4, angle);
|
||||
toPixel(result), angle);
|
||||
qint64 id = _id;
|
||||
if(typeCreation == Tool::FromGui){
|
||||
id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, mx, my));
|
||||
|
@ -89,6 +89,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolNormal::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolNormal::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolNormal::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
doc->IncrementReferens(secondPointId);
|
||||
|
@ -112,7 +113,7 @@ void VToolNormal::FullUpdateFromFile(){
|
|||
formula = domElement.attribute("length", "");
|
||||
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||
angle = domElement.attribute("angle", "").toInt();
|
||||
angle = domElement.attribute("angle", "").toDouble();
|
||||
}
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -133,6 +134,11 @@ void VToolNormal::FullUpdateFromGui(int result){
|
|||
dialogNormal.clear();
|
||||
}
|
||||
|
||||
void VToolNormal::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogNormal, this, event);
|
||||
}
|
||||
|
@ -144,8 +150,8 @@ void VToolNormal::AddToFile(){
|
|||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "normal");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "my", point.my()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
|
|
|
@ -29,9 +29,8 @@ class VToolNormal : public VToolLinePoint
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula,
|
||||
const qreal &angle, const qint64 &firstPointId,
|
||||
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||
const QString &formula, const qreal &angle, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
|
@ -40,12 +39,14 @@ public:
|
|||
static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, const QString typeLine, const QString pointName,
|
||||
const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint,
|
||||
const qreal &length, const qreal &angle = 0);
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
static QPointF FindPoint(const QPointF &firstPoint, const QPointF &secondPoint, const qreal &length,
|
||||
const qreal &angle = 0);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -28,12 +28,11 @@
|
|||
|
||||
VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
QGraphicsItem *parent):VDrawTool(doc, data, id),
|
||||
QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0){
|
||||
QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0){
|
||||
namePoint = new VGraphicsSimpleTextItem(this);
|
||||
lineName = new QGraphicsLineItem(this);
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
||||
&VToolPoint::NameChangePosition);
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setBrush(QBrush(Qt::NoBrush));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
@ -61,7 +60,7 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my){
|
|||
|
||||
void VToolPoint::ChangedActivDraw(const QString newName){
|
||||
if(nameActivDraw == newName){
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
|
@ -69,10 +68,11 @@ void VToolPoint::ChangedActivDraw(const QString newName){
|
|||
namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
namePoint->setBrush(QBrush(Qt::black));
|
||||
namePoint->setAcceptHoverEvents(true);
|
||||
lineName->setPen(QPen(Qt::black, widthHairLine));
|
||||
lineName->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
currentColor = Qt::black;
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
} else {
|
||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
||||
this->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
this->setAcceptHoverEvents (false);
|
||||
namePoint->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
|
@ -80,7 +80,8 @@ void VToolPoint::ChangedActivDraw(const QString newName){
|
|||
namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||
namePoint->setBrush(QBrush(Qt::gray));
|
||||
namePoint->setAcceptHoverEvents(false);
|
||||
lineName->setPen(QPen(Qt::gray, widthHairLine));
|
||||
lineName->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
currentColor = Qt::gray;
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
}
|
||||
|
@ -88,15 +89,20 @@ void VToolPoint::ChangedActivDraw(const QString newName){
|
|||
void VToolPoint::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
||||
if(id == this->id){
|
||||
if(enable == false){
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, widthHairLine/factor));
|
||||
currentColor = baseColor;
|
||||
} else {
|
||||
this->setPen(QPen(color, widthHairLine));
|
||||
this->setPen(QPen(color, widthHairLine/factor));
|
||||
currentColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VToolPoint::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
|
||||
}
|
||||
|
||||
void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
|
||||
if(event->button() == Qt::LeftButton){
|
||||
emit ChoosedTool(id, Scene::Point);
|
||||
|
@ -106,21 +112,25 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
|
|||
|
||||
void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
}
|
||||
|
||||
void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
|
||||
void VToolPoint::RefreshPointGeometry(const VPointF &point){
|
||||
QRectF rec = QRectF(0, 0, radius*2, radius*2);
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor);
|
||||
rec.translate(-rec.center().x(), -rec.center().y());
|
||||
this->setRect(rec);
|
||||
this->setPos(point.toQPointF());
|
||||
disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
||||
&VToolPoint::NameChangePosition);
|
||||
QFont font = namePoint->font();
|
||||
font.setPointSize(static_cast<qint32>(namePoint->FontSize()/factor));
|
||||
namePoint->setFont(font);
|
||||
namePoint->setText(point.name());
|
||||
namePoint->setPos(QPointF(point.mx(), point.my()));
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this,
|
||||
|
@ -131,9 +141,10 @@ void VToolPoint::RefreshPointGeometry(const VPointF &point){
|
|||
void VToolPoint::RefreshLine(){
|
||||
QRectF nameRec = namePoint->sceneBoundingRect();
|
||||
QPointF p1, p2;
|
||||
LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
|
||||
LineIntersectCircle(QPointF(), radius/factor, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
|
||||
QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
|
||||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
||||
lineName->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
if(QLineF(p1, pRec - scenePos()).length() <= toPixel(4)){
|
||||
lineName->setVisible(false);
|
||||
} else {
|
||||
|
|
|
@ -36,6 +36,7 @@ public slots:
|
|||
virtual void ChangedActivDraw(const QString newName);
|
||||
virtual void FullUpdateFromGui(int result) = 0;
|
||||
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
qreal radius;
|
||||
VGraphicsSimpleTextItem *namePoint;
|
||||
|
|
|
@ -91,7 +91,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
|
|||
QString errorMsg;
|
||||
qreal result = cal.eval(radius, &errorMsg);
|
||||
if(errorMsg.isEmpty()){
|
||||
QPointF fPoint = VToolPointOfContact::FindPoint(result*PrintDPI/25.4, centerP.toQPointF(),
|
||||
QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP.toQPointF(),
|
||||
firstP.toQPointF(), secondP.toQPointF());
|
||||
qint64 id = _id;
|
||||
if(typeCreation == Tool::FromGui){
|
||||
|
@ -115,6 +115,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolPointOfContact::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolPointOfContact::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfContact::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(center);
|
||||
doc->IncrementReferens(firstPointId);
|
||||
|
@ -149,6 +150,11 @@ void VToolPointOfContact::FullUpdateFromGui(int result){
|
|||
dialogPointOfContact.clear();
|
||||
}
|
||||
|
||||
void VToolPointOfContact::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
|
||||
}
|
||||
|
||||
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogPointOfContact, this, event);
|
||||
}
|
||||
|
@ -160,8 +166,8 @@ void VToolPointOfContact::AddToFile(){
|
|||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "pointOfContact");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "my", point.my()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "radius", radius);
|
||||
AddAttribute(domElement, "center", center);
|
||||
|
|
|
@ -29,20 +29,22 @@ class VToolPointOfContact : public VToolPoint
|
|||
{
|
||||
public:
|
||||
VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &radius, const qint64 ¢er, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
const QString &radius, const qint64 ¢er,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
static QPointF FindPoint(const qreal &radius, const QPointF ¢er, const QPointF &firstPoint,
|
||||
const QPointF &secondPoint);
|
||||
static void Create(QSharedPointer<DialogPointOfContact> &dialog, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data);
|
||||
static void Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId,
|
||||
const qint64 &secondPointId, const QString &pointName,
|
||||
static void Create(const qint64 _id, const QString &radius, const qint64 ¢er,
|
||||
const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -117,6 +117,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const
|
|||
scene->addItem(point);
|
||||
connect(point, &VToolShoulderPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(point, &VToolShoulderPoint::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolShoulderPoint::SetFactor);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(p1Line);
|
||||
doc->IncrementReferens(p2Line);
|
||||
|
@ -153,6 +154,11 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
|
|||
dialogShoulderPoint.clear();
|
||||
}
|
||||
|
||||
void VToolShoulderPoint::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogShoulderPoint, this, event);
|
||||
}
|
||||
|
@ -164,8 +170,8 @@ void VToolShoulderPoint::AddToFile(){
|
|||
AddAttribute(domElement, "id", id);
|
||||
AddAttribute(domElement, "type", "shoulder");
|
||||
AddAttribute(domElement, "name", point.name());
|
||||
AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "my", point.my()/PrintDPI*25.4);
|
||||
AddAttribute(domElement, "mx", toMM(point.mx()));
|
||||
AddAttribute(domElement, "my", toMM(point.my()));
|
||||
|
||||
AddAttribute(domElement, "typeLine", typeLine);
|
||||
AddAttribute(domElement, "length", formula);
|
||||
|
|
|
@ -25,25 +25,26 @@
|
|||
#include "vtoollinepoint.h"
|
||||
#include "dialogs/dialogshoulderpoint.h"
|
||||
|
||||
class VToolShoulderPoint : public VToolLinePoint
|
||||
{
|
||||
class VToolShoulderPoint : public VToolLinePoint{
|
||||
public:
|
||||
VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||
const QString &typeLine, const QString &formula, const qint64 &p1Line,
|
||||
const qint64 &p2Line, const qint64 &pShoulder, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0);
|
||||
const qint64 &p2Line, const qint64 &pShoulder,
|
||||
Tool::Sources typeCreation, QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
static QPointF FindPoint(const QPointF &p1Line, const QPointF &p2Line, const QPointF &pShoulder,
|
||||
const qreal &length);
|
||||
static void Create(QSharedPointer<DialogShoulderPoint> &dialog, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data);
|
||||
static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line,
|
||||
const qint64 &pShoulder, const QString &typeLine, const QString &pointName,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data, const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line,
|
||||
const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine,
|
||||
const QString &pointName, const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
|
|
@ -124,3 +124,8 @@ void VToolSinglePoint::ChangedActivDraw(const QString newName){
|
|||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSinglePoint::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshPointGeometry(VAbstractTool::data.GetPoint(id));
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public slots:
|
|||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
virtual void ChangedActivDraw(const QString newName);
|
||||
virtual void SetFactor(qreal factor);
|
||||
signals:
|
||||
void FullUpdateTree();
|
||||
protected:
|
||||
|
|
|
@ -34,7 +34,7 @@ VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id,
|
|||
path.addPath(spl.GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
this->setPath(path);
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
|
@ -108,6 +108,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c
|
|||
scene->addItem(spl);
|
||||
connect(spl, &VToolSpline::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(spl, &VToolSpline::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSpline::SetFactor);
|
||||
doc->AddTool(id, spl);
|
||||
doc->IncrementReferens(p1);
|
||||
doc->IncrementReferens(p4);
|
||||
|
@ -202,12 +203,12 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
|
|||
|
||||
void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
}
|
||||
|
||||
void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
|
||||
void VToolSpline::RemoveReferens(){
|
||||
|
@ -217,6 +218,7 @@ void VToolSpline::RemoveReferens(){
|
|||
}
|
||||
|
||||
void VToolSpline::RefreshGeometry(){
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
VSpline spl = VAbstractTool::data.GetSpline(id);
|
||||
QPainterPath path;
|
||||
path.addPath(spl.GetPath());
|
||||
|
@ -244,15 +246,17 @@ void VToolSpline::RefreshGeometry(){
|
|||
|
||||
void VToolSpline::ChangedActivDraw(const QString newName){
|
||||
if(nameActivDraw == newName){
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
currentColor = Qt::black;
|
||||
emit setEnabledPoint(true);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
} else {
|
||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
||||
this->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
this->setAcceptHoverEvents (false);
|
||||
currentColor = Qt::gray;
|
||||
emit setEnabledPoint(false);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
@ -261,11 +265,16 @@ void VToolSpline::ChangedActivDraw(const QString newName){
|
|||
void VToolSpline::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
||||
if(id == this->id){
|
||||
if(enable == false){
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, widthHairLine/factor));
|
||||
currentColor = baseColor;
|
||||
} else {
|
||||
this->setPen(QPen(color, widthHairLine));
|
||||
this->setPen(QPen(color, widthHairLine/factor));
|
||||
currentColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSpline::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -28,19 +28,18 @@
|
|||
#include "widgets/vcontrolpointspline.h"
|
||||
#include "geometry/vsplinepath.h"
|
||||
|
||||
class VToolSpline:public VDrawTool, public QGraphicsPathItem
|
||||
{
|
||||
class VToolSpline:public VDrawTool, public QGraphicsPathItem{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolSpline (VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation, QGraphicsItem * parent = 0 );
|
||||
VToolSpline (VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0 );
|
||||
virtual void setDialog();
|
||||
static void Create(QSharedPointer<DialogSpline> &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
|
||||
VContainer *data);
|
||||
static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1,
|
||||
const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
signals:
|
||||
void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint );
|
||||
|
@ -48,11 +47,11 @@ signals:
|
|||
public slots:
|
||||
virtual void FullUpdateFromFile ();
|
||||
virtual void FullUpdateFromGui ( int result );
|
||||
void ControlPointChangePosition ( const qint32 &indexSpline,
|
||||
SplinePoint::Position position,
|
||||
void ControlPointChangePosition ( const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF pos);
|
||||
virtual void ChangedActivDraw ( const QString newName );
|
||||
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile ();
|
||||
|
|
|
@ -32,7 +32,7 @@ VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
|||
path.addPath(splPath.GetPath());
|
||||
path.setFillRule( Qt::WindingFill );
|
||||
this->setPath(path);
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
|
@ -96,6 +96,7 @@ void VToolSplinePath::Create(const qint64 _id, const VSplinePath &path, VMainGra
|
|||
scene->addItem(spl);
|
||||
connect(spl, &VToolSplinePath::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(spl, &VToolSplinePath::RemoveTool, scene, &VMainGraphicsScene::RemoveTool);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, spl, &VToolSplinePath::SetFactor);
|
||||
doc->AddTool(id, spl);
|
||||
}
|
||||
}
|
||||
|
@ -187,15 +188,17 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path){
|
|||
|
||||
void VToolSplinePath::ChangedActivDraw(const QString newName){
|
||||
if(nameActivDraw == newName){
|
||||
this->setPen(QPen(Qt::black, widthHairLine));
|
||||
this->setPen(QPen(Qt::black, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
currentColor = Qt::black;
|
||||
emit setEnabledPoint(true);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
} else {
|
||||
this->setPen(QPen(Qt::gray, widthHairLine));
|
||||
this->setPen(QPen(Qt::gray, widthHairLine/factor));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
this->setAcceptHoverEvents (false);
|
||||
currentColor = Qt::gray;
|
||||
emit setEnabledPoint(false);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
@ -204,15 +207,20 @@ void VToolSplinePath::ChangedActivDraw(const QString newName){
|
|||
void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable){
|
||||
if(id == this->id){
|
||||
if(enable == false){
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setPen(QPen(baseColor, widthHairLine/factor));
|
||||
currentColor = baseColor;
|
||||
} else {
|
||||
this->setPen(QPen(color, widthHairLine));
|
||||
this->setPen(QPen(color, widthHairLine/factor));
|
||||
currentColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VToolSplinePath::SetFactor(qreal factor){
|
||||
VDrawTool::SetFactor(factor);
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||
ContextMenu(dialogSplinePath, this, event);
|
||||
}
|
||||
|
@ -252,12 +260,12 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
|
|||
|
||||
void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthMainLine));
|
||||
this->setPen(QPen(currentColor, widthMainLine/factor));
|
||||
}
|
||||
|
||||
void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, widthHairLine));
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
}
|
||||
|
||||
void VToolSplinePath::RemoveReferens(){
|
||||
|
@ -268,6 +276,7 @@ void VToolSplinePath::RemoveReferens(){
|
|||
}
|
||||
|
||||
void VToolSplinePath::RefreshGeometry(){
|
||||
this->setPen(QPen(currentColor, widthHairLine/factor));
|
||||
VSplinePath splPath = VAbstractTool::data.GetSplinePath(id);
|
||||
QPainterPath path;
|
||||
path.addPath(splPath.GetPath());
|
||||
|
|
|
@ -30,15 +30,14 @@
|
|||
class VToolSplinePath:public VDrawTool, public QGraphicsPathItem{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
||||
Tool::Sources typeCreation,
|
||||
VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, Tool::Sources typeCreation,
|
||||
QGraphicsItem * parent = 0);
|
||||
virtual void setDialog();
|
||||
static void Create(QSharedPointer<DialogSplinePath> &dialog,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data);
|
||||
static void Create(const qint64 _id, const VSplinePath &path,
|
||||
VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data,
|
||||
const Document::Documents &parse, Tool::Sources typeCreation);
|
||||
static void Create(QSharedPointer<DialogSplinePath> &dialog, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data);
|
||||
static void Create(const qint64 _id, const VSplinePath &path, VMainGraphicsScene *scene,
|
||||
VDomDocument *doc, VContainer *data, const Document::Documents &parse,
|
||||
Tool::Sources typeCreation);
|
||||
signals:
|
||||
void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos,
|
||||
const QPointF &controlPoint, const QPointF &splinePoint);
|
||||
|
@ -46,11 +45,11 @@ signals:
|
|||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void FullUpdateFromGui(int result);
|
||||
void ControlPointChangePosition(const qint32 &indexSpline,
|
||||
SplinePoint::Position position,
|
||||
void ControlPointChangePosition(const qint32 &indexSpline, SplinePoint::Position position,
|
||||
const QPointF pos);
|
||||
virtual void ChangedActivDraw(const QString newName);
|
||||
virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
|
||||
virtual void SetFactor(qreal factor);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void AddToFile();
|
||||
|
@ -64,8 +63,7 @@ private:
|
|||
void RefreshGeometry();
|
||||
void AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint);
|
||||
void UpdatePathPoint(QDomNode& node, VSplinePath &path);
|
||||
void CorectControlPoints(const VSpline &spl, VSplinePath &splPath,
|
||||
const qint32 &indexSpline);
|
||||
void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline);
|
||||
};
|
||||
|
||||
#endif // VTOOLSPLINEPATH_H
|
||||
|
|
|
@ -22,16 +22,22 @@
|
|||
#include "vgraphicssimpletextitem.h"
|
||||
#include <QGraphicsScene>
|
||||
#include <QEvent>
|
||||
#include <QDebug>
|
||||
|
||||
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent){
|
||||
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent):QGraphicsSimpleTextItem(parent),
|
||||
fontSize(0){
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
QFont font = this->font();
|
||||
font.setPointSize(font.pointSize()+3);
|
||||
fontSize = font.pointSize();
|
||||
this->setFont(font);
|
||||
}
|
||||
|
||||
VGraphicsSimpleTextItem::VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent )
|
||||
:QGraphicsSimpleTextItem(text, parent){
|
||||
:QGraphicsSimpleTextItem(text, parent), fontSize(0){
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
|
|
|
@ -24,18 +24,20 @@
|
|||
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
|
||||
class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem
|
||||
{
|
||||
class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VGraphicsSimpleTextItem(QGraphicsItem * parent = 0);
|
||||
VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = 0 );
|
||||
qint32 FontSize()const {return fontSize;}
|
||||
signals:
|
||||
void NameChangePosition(const QPointF pos);
|
||||
protected:
|
||||
QVariant itemChange ( GraphicsItemChange change, const QVariant &value );
|
||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||
private:
|
||||
qint32 fontSize;
|
||||
};
|
||||
|
||||
#endif // VGRAPHICSSIMPLETEXTITEM_H
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include <QScrollBar>
|
||||
#include <QGraphicsItem>
|
||||
|
||||
VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene(), horScrollBar(0), verScrollBar(0){
|
||||
VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene(), horScrollBar(0), verScrollBar(0), scaleFactor(1){
|
||||
}
|
||||
|
||||
VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent):
|
||||
QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0){
|
||||
QGraphicsScene ( sceneRect, parent ), horScrollBar(0), verScrollBar(0), scaleFactor(1){
|
||||
}
|
||||
|
||||
void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event){
|
||||
|
@ -50,6 +50,11 @@ void VMainGraphicsScene::RemoveTool(QGraphicsItem *tool){
|
|||
this->removeItem(tool);
|
||||
}
|
||||
|
||||
void VMainGraphicsScene::SetFactor(qreal factor){
|
||||
scaleFactor=scaleFactor*factor;
|
||||
emit NewFactor(scaleFactor);
|
||||
}
|
||||
|
||||
qint32 VMainGraphicsScene::getVerScrollBar() const{
|
||||
return verScrollBar;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
public slots:
|
||||
void ChoosedItem(qint64 id, Scene::Scenes type);
|
||||
void RemoveTool(QGraphicsItem *tool);
|
||||
void SetFactor(qreal factor);
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
@ -49,9 +50,11 @@ signals:
|
|||
void mouseMove(QPointF scenePos);
|
||||
void mousePress(QPointF scenePos);
|
||||
void ChoosedObject(qint64 id, Scene::Scenes type);
|
||||
void NewFactor(qreal factor);
|
||||
private:
|
||||
qint32 horScrollBar;
|
||||
qint32 verScrollBar;
|
||||
qreal scaleFactor;
|
||||
};
|
||||
|
||||
#endif // VMAINGRAPHICSSCENE_H
|
||||
|
|
|
@ -60,6 +60,7 @@ void VMainGraphicsView::scalingTime(qreal x){
|
|||
verticalScrollBar()->setValue(qRound(verticalScrollBar()->value() - factor*3.5));
|
||||
}
|
||||
}
|
||||
emit NewFactor(factor);
|
||||
}
|
||||
|
||||
void VMainGraphicsView::animFinished(){
|
||||
|
|
|
@ -29,6 +29,7 @@ class VMainGraphicsView : public QGraphicsView{
|
|||
public:
|
||||
explicit VMainGraphicsView(QWidget *parent = 0);
|
||||
signals:
|
||||
void NewFactor(qreal factor);
|
||||
public slots:
|
||||
void scalingTime(qreal x);
|
||||
void animFinished();
|
||||
|
|
|
@ -584,6 +584,7 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
|||
Q_ASSERT(spoint != 0);
|
||||
scene->addItem(spoint);
|
||||
connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor);
|
||||
tools[id] = spoint;
|
||||
}
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user