Apply button for dialog line.
--HG-- branch : develop
This commit is contained in:
parent
356209abfa
commit
ad01fe75bd
|
@ -34,6 +34,7 @@
|
|||
#include "../../visualization/vgraphicslineitem.h"
|
||||
#include "../../widgets/vapplication.h"
|
||||
#include "../../widgets/vmaingraphicsscene.h"
|
||||
#include "../../tools/vabstracttool.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -46,7 +47,7 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
|
|||
line(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancel(ui);
|
||||
InitOkCancelApply(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxFirstPoint);
|
||||
FillComboBoxPoints(ui->comboBoxSecondPoint);
|
||||
|
@ -58,6 +59,8 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent)
|
|||
this, &DialogLine::PointNameChanged);
|
||||
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogLine::PointNameChanged);
|
||||
|
||||
line = new VGraphicsLineItem(data);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -75,6 +78,7 @@ DialogLine::~DialogLine()
|
|||
void DialogLine::setSecondPoint(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxSecondPoint, secondPoint, value, 0);
|
||||
line->setPoint2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -86,6 +90,7 @@ void DialogLine::setTypeLine(const QString &value)
|
|||
{
|
||||
typeLine = value;
|
||||
SetupTypeLine(ui->comboBoxLineType, value);
|
||||
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -96,6 +101,7 @@ void DialogLine::setTypeLine(const QString &value)
|
|||
void DialogLine::setFirstPoint(const quint32 &value)
|
||||
{
|
||||
setPointId(ui->comboBoxFirstPoint, firstPoint, value, 0);
|
||||
line->setPoint1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -104,15 +110,19 @@ void DialogLine::setFirstPoint(const quint32 &value)
|
|||
*/
|
||||
void DialogLine::DialogAccepted()
|
||||
{
|
||||
//TODO check if points different
|
||||
qint32 index = ui->comboBoxFirstPoint->currentIndex();
|
||||
firstPoint = qvariant_cast<quint32>(ui->comboBoxFirstPoint->itemData(index));
|
||||
index = ui->comboBoxSecondPoint->currentIndex();
|
||||
secondPoint = qvariant_cast<quint32>(ui->comboBoxSecondPoint->itemData(index));
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
this->SaveData();
|
||||
DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLine::DialogApply()
|
||||
{
|
||||
this->SaveData();
|
||||
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
line->RefreshGeometry();
|
||||
emit DialogApplied();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLine::PointNameChanged()
|
||||
{
|
||||
|
@ -136,7 +146,7 @@ void DialogLine::PointNameChanged()
|
|||
void DialogLine::UpdateList()
|
||||
{
|
||||
/*
|
||||
* Does nothing. We redefine this slot because it is only one now way block update list of variable.
|
||||
* Does nothing. We redefine this slot because it is only one now way block update list of variables.
|
||||
* This dialog doesn't work with formula. Don't delete. Help avoid crash.
|
||||
*/
|
||||
}
|
||||
|
@ -145,10 +155,19 @@ void DialogLine::UpdateList()
|
|||
void DialogLine::ShowVisualization()
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
line = new VGraphicsLineItem(data, getCurrentObjectId(ui->comboBoxFirstPoint),
|
||||
getCurrentObjectId(ui->comboBoxSecondPoint));
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VGraphicsLineItem::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogLine::SaveData()
|
||||
{
|
||||
qint32 index = ui->comboBoxFirstPoint->currentIndex();
|
||||
firstPoint = qvariant_cast<quint32>(ui->comboBoxFirstPoint->itemData(index));
|
||||
index = ui->comboBoxSecondPoint->currentIndex();
|
||||
secondPoint = qvariant_cast<quint32>(ui->comboBoxSecondPoint->itemData(index));
|
||||
typeLine = GetTypeLine(ui->comboBoxLineType);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -59,10 +59,10 @@ public:
|
|||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void DialogAccepted();
|
||||
/** TODO ISSUE 79 : create real function
|
||||
/**
|
||||
* @brief DialogApply apply data and emit signal about applied dialog.
|
||||
*/
|
||||
virtual void DialogApply(){}
|
||||
virtual void DialogApply();
|
||||
virtual void PointNameChanged();
|
||||
virtual void UpdateList();
|
||||
protected:
|
||||
|
@ -85,6 +85,10 @@ private:
|
|||
/** @brief typeLine type of line */
|
||||
QString typeLine;
|
||||
VGraphicsLineItem *line;
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
void SaveData();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -9,20 +9,20 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>267</width>
|
||||
<height>154</height>
|
||||
<width>286</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>267</width>
|
||||
<height>154</height>
|
||||
<width>286</width>
|
||||
<height>151</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>267</width>
|
||||
<height>154</height>
|
||||
<width>286</width>
|
||||
<height>151</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -43,7 +43,7 @@
|
|||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>255</width>
|
||||
<width>269</width>
|
||||
<height>134</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -156,7 +156,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -423,8 +423,8 @@ void MainWindow::ClosedDialogEndLine(int result)
|
|||
*/
|
||||
void MainWindow::ToolLine(bool checked)
|
||||
{
|
||||
SetToolButton<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
|
||||
&MainWindow::ClosedDialogLine);
|
||||
SetToolButtonWithApply<DialogLine>(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"),
|
||||
&MainWindow::ClosedDialogLine, &MainWindow::ApplyDialogLine);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -434,7 +434,14 @@ void MainWindow::ToolLine(bool checked)
|
|||
*/
|
||||
void MainWindow::ClosedDialogLine(int result)
|
||||
{
|
||||
ClosedDialog<VToolLine>(result);
|
||||
ClosedDialogWithApply<VToolLine>(result);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ApplyDialogLine()
|
||||
{
|
||||
ApplyDialog<VToolLine>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -445,7 +452,8 @@ void MainWindow::ClosedDialogLine(int result)
|
|||
void MainWindow::ToolAlongLine(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png",
|
||||
tr("Select point"), &MainWindow::ClosedDialogAlongLine, &MainWindow::ApplyDialogAlongLine);
|
||||
tr("Select point"), &MainWindow::ClosedDialogAlongLine,
|
||||
&MainWindow::ApplyDialogAlongLine);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -108,6 +108,7 @@ public slots:
|
|||
void ClosedDialogEndLine(int result);
|
||||
void ApplyDialogEndLine();
|
||||
void ClosedDialogLine(int result);
|
||||
void ApplyDialogLine();
|
||||
void ClosedDialogAlongLine(int result);
|
||||
void ApplyDialogAlongLine();
|
||||
void ClosedDialogShoulderPoint(int result);
|
||||
|
|
|
@ -60,7 +60,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, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
|
@ -94,7 +94,7 @@ void VToolLine::setDialog()
|
|||
* @param doc dom document container.
|
||||
* @param data container with variables.
|
||||
*/
|
||||
void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
VToolLine *VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogLine *dialogTool = qobject_cast<DialogLine*>(dialog);
|
||||
|
@ -102,7 +102,14 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *
|
|||
const quint32 firstPoint = dialogTool->getFirstPoint();
|
||||
const quint32 secondPoint = dialogTool->getSecondPoint();
|
||||
const QString typeLine = dialogTool->getTypeLine();
|
||||
Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
|
||||
VToolLine *line = nullptr;
|
||||
line = Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Source::FromGui);
|
||||
if (line != nullptr)
|
||||
{
|
||||
line->dialog=dialogTool;
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -118,7 +125,7 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *
|
|||
* @param parse parser file mode.
|
||||
* @param typeCreation way we create this tool.
|
||||
*/
|
||||
void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
|
||||
VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
|
||||
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation)
|
||||
{
|
||||
|
@ -151,7 +158,9 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin
|
|||
doc->AddTool(id, line);
|
||||
doc->IncrementReferens(firstPoint);
|
||||
doc->IncrementReferens(secondPoint);
|
||||
return line;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -210,7 +219,7 @@ void VToolLine::ChangedActivDraw(const QString &newName)
|
|||
selectable = false;
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
this->setAcceptHoverEvents (selectable);
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
}
|
||||
|
@ -263,7 +272,7 @@ void VToolLine::RefreshDataInFile()
|
|||
void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle(typeLine)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -274,7 +283,7 @@ void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|||
void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -360,5 +369,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, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public:
|
|||
VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
|
||||
const QString &typeLine, const Source &typeCreation, QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
|
||||
static VToolLine *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
||||
static VToolLine *Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
|
||||
const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||
const Document &parse, const Source &typeCreation);
|
||||
static const QString TagName;
|
||||
|
|
|
@ -52,7 +52,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, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
mainLine->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
|||
{
|
||||
currentColor = Qt::gray;
|
||||
}
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
VToolPoint::ChangedActivDraw(newName);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
|
|||
*/
|
||||
void VToolLinePoint::RefreshGeometry()
|
||||
{
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle()));
|
||||
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle(typeLine)));
|
||||
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();
|
||||
|
|
|
@ -261,7 +261,7 @@ void VAbstractTool::DeleteTool(bool ask)
|
|||
* @brief LineStyle return pen style for current line style.
|
||||
* @return pen style.
|
||||
*/
|
||||
Qt::PenStyle VAbstractTool::LineStyle()
|
||||
Qt::PenStyle VAbstractTool::LineStyle(const QString &typeLine)
|
||||
{
|
||||
QStringList styles = Styles();
|
||||
switch (styles.indexOf(typeLine))
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
static const QString TypeLineDashDotDotLine;
|
||||
static const QStringList Styles();
|
||||
static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc);
|
||||
static Qt::PenStyle LineStyle(const QString &typeLine);
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
@ -147,7 +148,6 @@ protected:
|
|||
*/
|
||||
virtual void RemoveReferens(){}
|
||||
virtual void DeleteTool(bool ask = true);
|
||||
Qt::PenStyle LineStyle();
|
||||
static int ConfirmDeletion();
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractTool)
|
||||
|
|
|
@ -33,15 +33,12 @@
|
|||
VUndoCommand::VUndoCommand(const QDomElement &xml, VPattern *doc, QUndoCommand *parent)
|
||||
:QObject(), QUndoCommand(parent), xml(xml), doc(doc), nodeId(0), redoFlag(false)
|
||||
{
|
||||
SCASSERT(xml.isNull() == false);
|
||||
SCASSERT(doc != nullptr);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VUndoCommand::~VUndoCommand()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VUndoCommand::RedoFullParsing()
|
||||
|
|
|
@ -32,20 +32,17 @@
|
|||
#include "../widgets/vapplication.h"
|
||||
#include "../tools/drawTools/vdrawtool.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VGraphicsLineItem::VGraphicsLineItem(const VContainer *data, QGraphicsItem *parent)
|
||||
:QObject(), QGraphicsLineItem(parent), data(data), point1Id(0), point2Id(0), factor(VDrawTool::factor),
|
||||
scenePos(QPointF()), color(Qt::red), lineStyle(Qt::SolidLine)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VGraphicsLineItem::VGraphicsLineItem(const VContainer *data, const quint32 &pointId, const QPointF &scenePos,
|
||||
QGraphicsItem *parent)
|
||||
:QObject(), QGraphicsLineItem(parent), data(data), point1Id(pointId), point2Id(0), factor(VDrawTool::factor),
|
||||
scenePos(scenePos), color(Qt::black)
|
||||
{
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VGraphicsLineItem::VGraphicsLineItem(const VContainer *data, const quint32 &p1Id, const quint32 &p2Id,
|
||||
QGraphicsItem *parent)
|
||||
:QObject(), QGraphicsLineItem(parent), data(data), point1Id(p1Id), point2Id(p2Id), factor(VDrawTool::factor),
|
||||
scenePos(QPointF()), color(Qt::red)
|
||||
scenePos(scenePos), color(Qt::black), lineStyle(Qt::SolidLine)
|
||||
{
|
||||
RefreshGeometry();
|
||||
}
|
||||
|
@ -74,6 +71,24 @@ void VGraphicsLineItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
QGraphicsLineItem::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsLineItem::setPoint2Id(const quint32 &value)
|
||||
{
|
||||
point2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsLineItem::setPoint1Id(const quint32 &value)
|
||||
{
|
||||
point1Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsLineItem::setLineStyle(const Qt::PenStyle &value)
|
||||
{
|
||||
lineStyle = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsLineItem::RefreshGeometry()
|
||||
{
|
||||
|
@ -87,5 +102,5 @@ void VGraphicsLineItem::RefreshGeometry()
|
|||
const VPointF *second = data->GeometricObject<const VPointF *>(point2Id);
|
||||
this->setLine(QLineF(first->toQPointF(), second->toQPointF()));
|
||||
}
|
||||
this->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor, Qt::SolidLine));
|
||||
this->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor, lineStyle));
|
||||
}
|
||||
|
|
|
@ -36,10 +36,15 @@ class VGraphicsLineItem : public QObject, public QGraphicsLineItem
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VGraphicsLineItem(const VContainer *data, QGraphicsItem * parent = 0);
|
||||
VGraphicsLineItem(const VContainer *data, const quint32 &pointId, const QPointF &scenePos,
|
||||
QGraphicsItem * parent = 0);
|
||||
VGraphicsLineItem(const VContainer *data, const quint32 &p1Id, const quint32 &p2Id, QGraphicsItem * parent = 0);
|
||||
virtual ~VGraphicsLineItem();
|
||||
|
||||
void setLineStyle(const Qt::PenStyle &value);
|
||||
void setPoint1Id(const quint32 &value);
|
||||
void setPoint2Id(const quint32 &value);
|
||||
void RefreshGeometry();
|
||||
public slots:
|
||||
void SetFactor(qreal factor);
|
||||
void MousePos(const QPointF &scenePos);
|
||||
|
@ -48,12 +53,12 @@ protected:
|
|||
private:
|
||||
Q_DISABLE_COPY(VGraphicsLineItem)
|
||||
const VContainer *data;
|
||||
const quint32 point1Id;
|
||||
const quint32 point2Id;
|
||||
quint32 point1Id;
|
||||
quint32 point2Id;
|
||||
qreal factor;
|
||||
QPointF scenePos;
|
||||
const QColor color;
|
||||
void RefreshGeometry();
|
||||
Qt::PenStyle lineStyle;
|
||||
};
|
||||
|
||||
#endif // VGRAPHICSLINEITEM_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user