56 #include <QDialogButtonBox>
60 #include <QListWidget>
61 #include <QListWidgetItem>
63 #include <QPushButton>
64 #include <QSharedPointer>
70 #include "../../tools/vabstracttool.h"
71 #include "../../visualization/path/vistoolcubicbezierpath.h"
72 #include "../../visualization/visualization.h"
73 #include "../ifc/ifcdef.h"
74 #include "../vmisc/vabstractapplication.h"
75 #include "../vmisc/vmath.h"
76 #include "../vpatterndb/vcontainer.h"
77 #include "../vwidgets/vabstractmainwindow.h"
79 #include "ui_dialogcubicbezierpath.h"
91 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
92 setWindowIcon(QIcon(
":/toolicon/32x32/cubic_bezier_path.png"));
102 ui->lineType_ComboBox->removeItem(index);
105 index =
ui->lineColor_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineColor());
108 ui->lineColor_ComboBox->setCurrentIndex(index);
111 index =
ui->lineWeight_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineWeight());
114 ui->lineWeight_ComboBox->setCurrentIndex(index);
117 index =
ui->lineType_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineType());
120 ui->lineType_ComboBox->setCurrentIndex(index);
124 connect(
ui->comboBoxPoint,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
146 ui->listWidget->blockSignals(
true);
147 ui->listWidget->clear();
152 ui->listWidget->setFocus(Qt::OtherFocusReason);
153 ui->lineEditSplPathName->setText(
qApp->TrVars()->VarToUser(
path.
name()));
155 auto visPath = qobject_cast<VisToolCubicBezierPath *>(
vis);
157 visPath->setPath(
path);
158 ui->listWidget->blockSignals(
false);
160 if (
ui->listWidget->count() > 0)
162 ui->listWidget->setCurrentRow(0);
225 auto visPath = qobject_cast<VisToolCubicBezierPath *>(
vis);
227 visPath->setPath(
path);
238 visPath->RefreshGeometry();
269 AddVisualization<VisToolCubicBezierPath>();
279 auto visPath = qobject_cast<VisToolCubicBezierPath *>(
vis);
281 visPath->setPath(
path);
283 visPath->RefreshGeometry();
289 if (
ui->listWidget->count() == 0)
294 const auto p = qvariant_cast<VPointF>(
ui->listWidget->item(row)->data(Qt::UserRole));
301 const quint32
id = qvariant_cast<quint32>(
ui->comboBoxPoint->itemData(index));
302 QListWidgetItem *item =
ui->listWidget->item(
ui->listWidget->currentRow() );
305 item->setData(Qt::UserRole, QVariant::fromValue(*point));
313 ui->lineEditSplPathName->setText(tr(
"Invalid spline path"));
320 auto first = qvariant_cast<VPointF>(
ui->listWidget->item(0)->data(Qt::UserRole));
321 auto last = qvariant_cast<VPointF>(
ui->listWidget->item(
ui->listWidget->count()-1)->data(Qt::UserRole));
326 ui->lineEditSplPathName->setText(
qApp->TrVars()->VarToUser(
path.
name()));
338 ui->lineEditSplPathName->setText(
qApp->TrVars()->VarToUser(newPath.
name()));
349 auto item =
new QListWidgetItem(point.
name());
350 item->setData(Qt::UserRole, QVariant::fromValue(point));
352 ui->listWidget->addItem(item);
353 ui->listWidget->setCurrentItem(item);
354 if (
ui->listWidget->count() >= 7)
356 ok_Button =
ui->buttonBox->button(QDialogButtonBox::Ok);
366 ui->comboBoxPoint->blockSignals(
true);
368 ui->comboBoxPoint->blockSignals(
false);
382 for (qint32 i = 0; i <
ui->listWidget->count(); ++i)
384 points.append(qvariant_cast<VPointF>(
ui->listWidget->item(i)->data(Qt::UserRole)).id());
389 for (qint32 i = 1; i <= count; ++i)
392 ids.insert(points.at(base));
393 ids.insert(points.at(base + 3));
414 for (qint32 i = 0; i <
ui->listWidget->count(); ++i)
416 points.append(qvariant_cast<VPointF>(
ui->listWidget->item(i)->data(Qt::UserRole)));
void setPenStyle(const QString &value)
VCubicBezierPath ExtractPath() const
virtual void ShowVisualization() Q_DECL_OVERRIDE
QString getLineColor() const
void setLineWeight(const QString &value)
setLineWeight set weight of the lines
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
VCubicBezierPath path
path cubic bezier path
QString getPenStyle() const
void currentPointChanged(int index)
void SetPath(const VCubicBezierPath &value)
QSet< quint32 > AllPathBackboneIds() const
QString getLineWeight() const
getLineWeight return weight of the lines
virtual ~DialogCubicBezierPath()
void NewItem(const VPointF &point)
VCubicBezierPath GetPath() const
void setLineColor(const QString &value)
DialogCubicBezierPath(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE
void DataPoint(const VPointF &p)
void PointChanged(int row)
Ui::DialogCubicBezierPath * ui
void SetDuplicate(quint32 number)
quint32 GetDuplicate() const
virtual void ShowToolTip(const QString &toolTip)=0
The VContainer class container of all variables.
static bool IsUnique(const QString &name)
const QSharedPointer< T > GeometricObject(const quint32 &id) const
static qint32 SubSplPointsCount(qint32 countSubSpl)
virtual qint32 CountPoints() const Q_DECL_OVERRIDE
virtual qint32 CountSubSpl() const Q_DECL_OVERRIDE
const VPointF & at(int indx) const
virtual void Clear() Q_DECL_OVERRIDE
static qint32 SubSplOffset(qint32 subSplIndex)
virtual QString name() const
name return name graphical object.
quint32 id() const
id return id object.
The VPointF class keep data of point.
void ToolTip(const QString &toolTip)
const QString LineTypeSolidLine
const QString LineTypeNone