Fix filling piece label data.

This commit is contained in:
Roman Telezhynskyi 2023-10-07 12:47:43 +03:00
parent a103108799
commit 8f23d057f4
94 changed files with 522 additions and 531 deletions

View File

@ -41,7 +41,8 @@
- New option: Use Tool Groups.
- Redesign notch context menu to allow quick selection of the notch type.
- Redesign standard path system.
- New option: Translate formula
- New option: Translate formula.
- Fix filling piece label data.
# Valentina 0.7.52 September 12, 2022
- Fix crash when default locale is ru.

View File

@ -27,19 +27,19 @@
*************************************************************************/
#include "dialoghistory.h"
#include "ui_dialoghistory.h"
#include "../vgeometry/varc.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vcubicbezier.h"
#include "../vgeometry/vsplinepath.h"
#include "../vgeometry/vcubicbezierpath.h"
#include "../vgeometry/vellipticalarc.h"
#include "../vgeometry/vpointf.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
#include "../xml/vpattern.h"
#include "../vgeometry/vsplinepath.h"
#include "../vmisc/vtablesearch.h"
#include "../vmisc/vvalentinasettings.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
#include "../xml/vpattern.h"
#include "ui_dialoghistory.h"
#include <QDebug>
#include <QtConcurrent>
@ -62,10 +62,9 @@ auto AttrUInt(const QDomElement &domElement, const QString &name) -> quint32
* @param parent parent widget
*/
DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
:DialogTool(data, 0, parent),
ui(new Ui::DialogHistory),
m_doc(doc),
m_searchHistory(new QMenu(this))
: DialogTool(data, doc, NULL_ID, parent),
ui(new Ui::DialogHistory),
m_searchHistory(new QMenu(this))
{
ui->setupUi(this);
@ -76,10 +75,8 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
FillTable();
InitialTable();
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
connect(this, &DialogHistory::ShowHistoryTool, doc, [doc](quint32 id, bool enable)
{
emit doc->ShowTool(id, enable);
});
connect(this, &DialogHistory::ShowHistoryTool, doc,
[doc](quint32 id, bool enable) { emit doc->ShowTool(id, enable); });
connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory);
ShowPoint();
@ -127,7 +124,7 @@ void DialogHistory::cellClicked(int row, int column)
item->setIcon(QIcon("://icon/32x32/put_after.png"));
const auto id = qvariant_cast<quint32>(item->data(Qt::UserRole));
m_doc->blockSignals(true);
row == ui->tableWidget->rowCount()-1 ? m_doc->setCursor(0) : m_doc->setCursor(id);
row == ui->tableWidget->rowCount() - 1 ? m_doc->setCursor(0) : m_doc->setCursor(id);
m_doc->blockSignals(false);
}
else
@ -150,7 +147,7 @@ void DialogHistory::cellClicked(int row, int column)
*/
void DialogHistory::ChangedCursor(quint32 id)
{
for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i)
for (qint32 i = 0; i < ui->tableWidget->rowCount(); ++i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
auto rId = qvariant_cast<quint32>(item->data(Qt::UserRole));
@ -186,12 +183,10 @@ void DialogHistory::FillTable()
QVector<VToolRecord> history = m_doc->getLocalHistory();
qint32 currentRow = -1;
qint32 count = 0;
ui->tableWidget->setRowCount(static_cast<int>(history.size()));//Make row count max possible number
ui->tableWidget->setRowCount(static_cast<int>(history.size())); // Make row count max possible number
std::function<HistoryRecord (const VToolRecord &tool)> CreateRecord = [this](const VToolRecord &tool)
{
return Record(tool);
};
std::function<HistoryRecord(const VToolRecord &tool)> CreateRecord = [this](const VToolRecord &tool)
{ return Record(tool); };
QVector<HistoryRecord> historyRecords = QtConcurrent::blockingMapped(history, CreateRecord);
@ -216,8 +211,8 @@ void DialogHistory::FillTable()
++count;
}
}
ui->tableWidget->setRowCount(count);//Real row count
if (count>0)
ui->tableWidget->setRowCount(count); // Real row count
if (count > 0)
{
m_cursorRow = CursorRow();
QTableWidgetItem *item = ui->tableWidget->item(m_cursorRow, 0);
@ -247,7 +242,7 @@ auto DialogHistory::Record(const VToolRecord &tool) const -> HistoryRecord
const QDomElement domElem = m_doc->elementById(tool.getId(), QString(), updateCache);
if (not domElem.isElement())
{
qDebug()<<"Can't find element by id" << record.id << Q_FUNC_INFO;
qDebug() << "Can't find element by id" << record.id << Q_FUNC_INFO;
return record;
}
@ -257,21 +252,21 @@ auto DialogHistory::Record(const VToolRecord &tool) const -> HistoryRecord
}
catch (const VExceptionBadId &e)
{
qDebug()<<e.ErrorMessage()<<Q_FUNC_INFO;
qDebug() << e.ErrorMessage() << Q_FUNC_INFO;
return record;
}
qDebug()<<"Can't create history record for the tool" << record.id;
qDebug() << "Can't create history record for the tool" << record.id;
return record;
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord record,
const QDomElement &domElem) const -> HistoryRecord
auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord record, const QDomElement &domElem) const
-> HistoryRecord
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Not all tools were used in history.");
switch ( tool.getTypeTool() )
switch (tool.getTypeTool())
{
case Tool::Arrow:
case Tool::SinglePoint:
@ -279,8 +274,8 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
case Tool::LinePoint:
case Tool::AbstractSpline:
case Tool::Cut:
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
case Tool::ArcIntersectAxis:// Same as Tool::CurveIntersectAxis, but tool will never has such type
case Tool::Midpoint: // Same as Tool::AlongLine, but tool will never has such type
case Tool::ArcIntersectAxis: // Same as Tool::CurveIntersectAxis, but tool will never has such type
case Tool::BackgroundImage:
case Tool::BackgroundImageControls:
case Tool::BackgroundPixmapImage:
@ -296,9 +291,9 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
.arg(PointName(AttrUInt(domElem, AttrBasePoint)), PointName(tool.getId()));
return record;
case Tool::Line:
record.description = tr("%1_%2 - Line from point %1 to point %2")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)));
record.description =
tr("%1_%2 - Line from point %1 to point %2")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)), PointName(AttrUInt(domElem, AttrSecondPoint)));
return record;
case Tool::AlongLine:
record.description = tr("%3 - Point along line %1_%2")
@ -314,18 +309,17 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
PointName(AttrUInt(domElem, AttrSecondPoint)), PointName(tool.getId()));
return record;
case Tool::Bisector:
record.description = tr("%4 - bisector of angle %1_%2_%3")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)),
PointName(AttrUInt(domElem, AttrThirdPoint)), PointName(tool.getId()));
record.description =
tr("%4 - bisector of angle %1_%2_%3")
.arg(PointName(AttrUInt(domElem, AttrFirstPoint)), PointName(AttrUInt(domElem, AttrSecondPoint)),
PointName(AttrUInt(domElem, AttrThirdPoint)), PointName(tool.getId()));
return record;
case Tool::LineIntersect:
record.description = tr("%5 - intersection of lines %1_%2 and %3_%4")
.arg(PointName(AttrUInt(domElem, AttrP1Line1)),
PointName(AttrUInt(domElem, AttrP2Line1)),
PointName(AttrUInt(domElem, AttrP1Line2)),
PointName(AttrUInt(domElem, AttrP2Line2)),
PointName(tool.getId()));
record.description =
tr("%5 - intersection of lines %1_%2 and %3_%4")
.arg(PointName(AttrUInt(domElem, AttrP1Line1)), PointName(AttrUInt(domElem, AttrP2Line1)),
PointName(AttrUInt(domElem, AttrP1Line2)), PointName(AttrUInt(domElem, AttrP2Line2)),
PointName(tool.getId()));
return record;
case Tool::Spline:
{
@ -348,9 +342,7 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
case Tool::ArcWithLength:
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
record.description = tr("%1 with length %2")
.arg(arc->NameForHistory(tr("Arc")))
.arg(arc->GetLength());
record.description = tr("%1 with length %2").arg(arc->NameForHistory(tr("Arc"))).arg(arc->GetLength());
return record;
}
case Tool::SplinePath:
@ -366,44 +358,39 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
return record;
}
case Tool::PointOfContact:
record.description = tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")
.arg(PointName(AttrUInt(domElem, AttrCenter)),
PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)),
PointName(tool.getId()));
record.description =
tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")
.arg(PointName(AttrUInt(domElem, AttrCenter)), PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)), PointName(tool.getId()));
return record;
case Tool::Height:
record.description = tr("Point of perpendicular from point %1 to line %2_%3")
.arg(PointName(AttrUInt(domElem, AttrBasePoint)),
PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)));
record.description =
tr("Point of perpendicular from point %1 to line %2_%3")
.arg(PointName(AttrUInt(domElem, AttrBasePoint)), PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)));
return record;
case Tool::Triangle:
record.description = tr("Triangle: axis %1_%2, points %3 and %4")
.arg(PointName(AttrUInt(domElem, AttrAxisP1)),
PointName(AttrUInt(domElem, AttrAxisP2)),
PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)));
record.description =
tr("Triangle: axis %1_%2, points %3 and %4")
.arg(PointName(AttrUInt(domElem, AttrAxisP1)), PointName(AttrUInt(domElem, AttrAxisP2)),
PointName(AttrUInt(domElem, AttrFirstPoint)), PointName(AttrUInt(domElem, AttrSecondPoint)));
return record;
case Tool::PointOfIntersection:
record.description = tr("%1 - point of intersection %2 and %3")
.arg(PointName(tool.getId()),
PointName(AttrUInt(domElem, AttrFirstPoint)),
.arg(PointName(tool.getId()), PointName(AttrUInt(domElem, AttrFirstPoint)),
PointName(AttrUInt(domElem, AttrSecondPoint)));
return record;
case Tool::CutArc:
{
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
record.description = tr("%1 - cut %2")
.arg(PointName(tool.getId()), arc->NameForHistory(tr("arc")));
record.description = tr("%1 - cut %2").arg(PointName(tool.getId()), arc->NameForHistory(tr("arc")));
return record;
}
case Tool::CutSpline:
{
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId);
record.description = tr("%1 - cut %2")
.arg(PointName(tool.getId()), spl->NameForHistory(tr("curve")));
record.description = tr("%1 - cut %2").arg(PointName(tool.getId()), spl->NameForHistory(tr("curve")));
return record;
}
case Tool::CutSplinePath:
@ -411,16 +398,15 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
const QSharedPointer<VAbstractCubicBezierPath> splPath =
data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
record.description = tr("%1 - cut %2")
.arg(PointName(tool.getId()), splPath->NameForHistory(tr("curve path")));
record.description =
tr("%1 - cut %2").arg(PointName(tool.getId()), splPath->NameForHistory(tr("curve path")));
return record;
}
case Tool::LineIntersectAxis:
record.description = tr("%1 - point of intersection line %2_%3 and axis through point %4")
.arg(PointName(tool.getId()),
PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)),
PointName(AttrUInt(domElem, AttrBasePoint)));
record.description =
tr("%1 - point of intersection line %2_%3 and axis through point %4")
.arg(PointName(tool.getId()), PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)), PointName(AttrUInt(domElem, AttrBasePoint)));
return record;
case Tool::CurveIntersectAxis:
record.description = tr("%1 - point of intersection curve and axis through point %2")
@ -442,17 +428,16 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
record.description = tr("%1 - point from arc and tangent").arg(PointName(tool.getId()));
return record;
case Tool::TrueDarts:
record.description = tr("Correction the dart %1_%2_%3")
.arg(PointName(AttrUInt(domElem, AttrDartP1)),
PointName(AttrUInt(domElem, AttrDartP2)),
PointName(AttrUInt(domElem, AttrDartP2)));
record.description =
tr("Correction the dart %1_%2_%3")
.arg(PointName(AttrUInt(domElem, AttrDartP1)), PointName(AttrUInt(domElem, AttrDartP2)),
PointName(AttrUInt(domElem, AttrDartP2)));
return record;
case Tool::EllipticalArc:
{
const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId());
record.description = tr("%1 with length %2")
.arg(elArc->NameForHistory(tr("Elliptical arc")))
.arg(elArc->GetLength());
record.description =
tr("%1 with length %2").arg(elArc->NameForHistory(tr("Elliptical arc"))).arg(elArc->GetLength());
return record;
}
case Tool::Rotation:
@ -461,10 +446,10 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
VDomDocument::GetParametrString(domElem, AttrSuffix, QString()));
return record;
case Tool::FlippingByLine:
record.description = tr("Flipping by line %1_%2. Suffix '%3'")
.arg(PointName(AttrUInt(domElem, AttrP1Line)),
PointName(AttrUInt(domElem, AttrP2Line)),
VDomDocument::GetParametrString(domElem, AttrSuffix, QString()));
record.description =
tr("Flipping by line %1_%2. Suffix '%3'")
.arg(PointName(AttrUInt(domElem, AttrP1Line)), PointName(AttrUInt(domElem, AttrP2Line)),
VDomDocument::GetParametrString(domElem, AttrSuffix, QString()));
return record;
case Tool::FlippingByAxis:
record.description = tr("Flipping by axis through %1 point. Suffix '%2'")
@ -472,11 +457,11 @@ auto DialogHistory::RecordDescription(const VToolRecord &tool, HistoryRecord rec
VDomDocument::GetParametrString(domElem, AttrSuffix, QString()));
return record;
case Tool::Move:
record.description = tr("Move objects. Suffix '%1'")
.arg(VDomDocument::GetParametrString(domElem, AttrSuffix, QString()));
record.description =
tr("Move objects. Suffix '%1'").arg(VDomDocument::GetParametrString(domElem, AttrSuffix, QString()));
return record;
//Because "history" not only show history of pattern, but help restore current data for each pattern's
//piece, we need add record about details and nodes, but don't show them.
// Because "history" not only show history of pattern, but help restore current data for each pattern's
// piece, we need add record about details and nodes, but don't show them.
case Tool::Piece:
case Tool::UnionDetails:
case Tool::NodeArc:
@ -577,7 +562,7 @@ void DialogHistory::changeEvent(QEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::showEvent(QShowEvent *event)
{
QDialog::showEvent( event ); // return default behavior NOLINT(bugprone-parent-virtual-call)
QDialog::showEvent(event); // return default behavior NOLINT(bugprone-parent-virtual-call)
}
//---------------------------------------------------------------------------------------------------------------------
@ -602,7 +587,7 @@ auto DialogHistory::CursorRow() const -> int
const quint32 cursor = m_doc->getCursor();
if (cursor == 0)
{
return ui->tableWidget->rowCount()-1;
return ui->tableWidget->rowCount() - 1;
}
for (int i = 0; i < ui->tableWidget->rowCount(); ++i)
@ -614,7 +599,7 @@ auto DialogHistory::CursorRow() const -> int
return i;
}
}
return ui->tableWidget->rowCount()-1;
return ui->tableWidget->rowCount() - 1;
}
//---------------------------------------------------------------------------------------------------------------------
@ -632,105 +617,115 @@ void DialogHistory::InitSearch()
UpdateSearchControlsTooltips();
connect(ui->lineEditFind, &QLineEdit::textEdited, this, [this](const QString &term){m_search->Find(term);});
connect(ui->lineEditFind, &QLineEdit::editingFinished, this, [this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->Find(ui->lineEditFind->text());
});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->FindPrevious();
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
});
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->FindNext();
ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
});
connect(ui->lineEditFind, &QLineEdit::textEdited, this, [this](const QString &term) { m_search->Find(term); });
connect(ui->lineEditFind, &QLineEdit::editingFinished, this,
[this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->Find(ui->lineEditFind->text());
});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this,
[this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->FindPrevious();
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
});
connect(ui->toolButtonFindNext, &QToolButton::clicked, this,
[this]()
{
SaveSearchRequest();
InitSearchHistory();
m_search->FindNext();
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
});
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
{
ui->toolButtonFindPrevious->setEnabled(state);
ui->toolButtonFindNext->setEnabled(state);
connect(m_search.data(), &VTableSearch::HasResult, this,
[this](bool state)
{
ui->toolButtonFindPrevious->setEnabled(state);
ui->toolButtonFindNext->setEnabled(state);
if (state)
{
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
}
else
{
ui->labelResults->setText(tr("0 results"));
}
if (state)
{
ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex() + 1).arg(m_search->MatchCount()));
}
else
{
ui->labelResults->setText(tr("0 results"));
}
QPalette palette;
QPalette palette;
if (not state && not ui->lineEditFind->text().isEmpty())
{
palette.setColor(QPalette::Text, Qt::red);
ui->lineEditFind->setPalette(palette);
if (not state && not ui->lineEditFind->text().isEmpty())
{
palette.setColor(QPalette::Text, Qt::red);
ui->lineEditFind->setPalette(palette);
palette.setColor(QPalette::Active, ui->labelResults->foregroundRole(), Qt::red);
palette.setColor(QPalette::Inactive, ui->labelResults->foregroundRole(), Qt::red);
ui->labelResults->setPalette(palette);
}
else
{
ui->lineEditFind->setPalette(palette);
ui->labelResults->setPalette(palette);
}
});
palette.setColor(QPalette::Active, ui->labelResults->foregroundRole(), Qt::red);
palette.setColor(QPalette::Inactive, ui->labelResults->foregroundRole(), Qt::red);
ui->labelResults->setPalette(palette);
}
else
{
ui->lineEditFind->setPalette(palette);
ui->labelResults->setPalette(palette);
}
});
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this, [this](bool checked)
{
m_search->SetMatchCase(checked);
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonCaseSensitive, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetMatchCase(checked);
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this, [this](bool checked)
{
m_search->SetMatchWord(checked);
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonWholeWord, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetMatchWord(checked);
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonRegexp, &QToolButton::toggled, this, [this](bool checked)
{
m_search->SetMatchRegexp(checked);
connect(ui->toolButtonRegexp, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetMatchRegexp(checked);
if (checked)
{
ui->toolButtonWholeWord->blockSignals(true);
ui->toolButtonWholeWord->setChecked(false);
ui->toolButtonWholeWord->blockSignals(false);
ui->toolButtonWholeWord->setEnabled(false);
if (checked)
{
ui->toolButtonWholeWord->blockSignals(true);
ui->toolButtonWholeWord->setChecked(false);
ui->toolButtonWholeWord->blockSignals(false);
ui->toolButtonWholeWord->setEnabled(false);
ui->toolButtonUseUnicodeProperties->setEnabled(true);
}
else
{
ui->toolButtonWholeWord->setEnabled(true);
ui->toolButtonUseUnicodeProperties->blockSignals(true);
ui->toolButtonUseUnicodeProperties->setChecked(false);
ui->toolButtonUseUnicodeProperties->blockSignals(false);
ui->toolButtonUseUnicodeProperties->setEnabled(false);
}
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
ui->toolButtonUseUnicodeProperties->setEnabled(true);
}
else
{
ui->toolButtonWholeWord->setEnabled(true);
ui->toolButtonUseUnicodeProperties->blockSignals(true);
ui->toolButtonUseUnicodeProperties->setChecked(false);
ui->toolButtonUseUnicodeProperties->blockSignals(false);
ui->toolButtonUseUnicodeProperties->setEnabled(false);
}
m_search->Find(ui->lineEditFind->text());
ui->lineEditFind->setPlaceholderText(m_search->SearchPlaceholder());
});
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this, [this](bool checked)
{
m_search->SetUseUnicodePreperties(checked);
m_search->Find(ui->lineEditFind->text());
});
connect(ui->toolButtonUseUnicodeProperties, &QToolButton::toggled, this,
[this](bool checked)
{
m_search->SetUseUnicodePreperties(checked);
m_search->Find(ui->lineEditFind->text());
});
m_searchHistory->setStyleSheet(QStringLiteral("QMenu { menu-scrollable: 1; }"));
InitSearchHistory();
@ -742,21 +737,22 @@ void DialogHistory::InitSearchHistory()
{
QStringList searchHistory = VAbstractValApplication::VApp()->ValentinaSettings()->GetHistorySearchHistory();
m_searchHistory->clear();
for (const auto& term : searchHistory)
for (const auto &term : searchHistory)
{
QAction *action = m_searchHistory->addAction(term);
action->setData(term);
connect(action, &QAction::triggered, this, [this]()
{
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
}
});
connect(action, &QAction::triggered, this,
[this]()
{
auto *action = qobject_cast<QAction *>(sender());
if (action != nullptr)
{
QString term = action->data().toString();
ui->lineEditFind->setText(term);
m_search->Find(term);
ui->lineEditFind->setFocus();
}
});
}
}

View File

@ -44,7 +44,7 @@ struct HistoryRecord
namespace Ui
{
class DialogHistory;
class DialogHistory;
}
/**
@ -53,14 +53,15 @@ namespace Ui
class DialogHistory : public DialogTool
{
Q_OBJECT // NOLINT
public:
DialogHistory(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
~DialogHistory() override;
public slots:
void DialogAccepted() override;
/** TODO ISSUE 79 : create real function
* @brief DialogApply apply data and emit signal about applied dialog.
*/
* @brief DialogApply apply data and emit signal about applied dialog.
*/
void DialogApply() override {}
void cellClicked(int row, int column);
void ChangedCursor(quint32 id);
@ -71,12 +72,14 @@ signals:
* @param id id of tool
* @param enable true enable selection, false disable selection
*/
void ShowHistoryTool(quint32 id, bool enable);
void ShowHistoryTool(quint32 id, bool enable);
protected:
void closeEvent ( QCloseEvent * event ) override;
void changeEvent(QEvent* event) override;
auto IsValid() const -> bool final {return true;}
void showEvent( QShowEvent *event ) override;
void closeEvent(QCloseEvent *event) override;
void changeEvent(QEvent *event) override;
auto IsValid() const -> bool final { return true; }
void showEvent(QShowEvent *event) override;
private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogHistory) // NOLINT
@ -84,9 +87,6 @@ private:
/** @brief ui keeps information about user interface */
Ui::DialogHistory *ui;
/** @brief doc dom document container */
VPattern *m_doc;
/** @brief cursorRow save number of row where is cursor */
qint32 m_cursorRow{0};
@ -98,8 +98,8 @@ private:
void FillTable();
auto Record(const VToolRecord &tool) const -> HistoryRecord;
auto RecordDescription(const VToolRecord &tool, HistoryRecord record,
const QDomElement &domElem) const -> HistoryRecord;
auto RecordDescription(const VToolRecord &tool, HistoryRecord record, const QDomElement &domElem) const
-> HistoryRecord;
void InitialTable();
void ShowPoint();
auto PointName(quint32 pointId) const -> QString;

View File

@ -75,7 +75,7 @@ enum class IncrUnits : qint8
* @param parent parent widget
*/
DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent)
: DialogTool(data, NULL_ID, parent),
: DialogTool(data, doc, NULL_ID, parent),
ui(new Ui::DialogIncrements),
m_data(data),
m_doc(doc),

View File

@ -167,7 +167,7 @@ void VWidgetGroups::ActionPreferences(quint32 id)
QScopedPointer<VContainer> fackeContainer(new VContainer(VAbstractApplication::VApp()->TrVars(),
VAbstractValApplication::VApp()->patternUnitsP(),
VContainer::UniqueNamespace()));
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), NULL_ID, this));
QScopedPointer<DialogGroup> dialog(new DialogGroup(fackeContainer.data(), m_doc, NULL_ID, this));
dialog->SetName(m_doc->GetGroupName(id));
dialog->SetTags(m_doc->GetGroupTags(id));
dialog->SetGroupCategories(m_doc->GetGroupCategories());

View File

@ -865,7 +865,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
m_statusLabel->setText(toolTip);
ui->view->setShowToolOptions(false);
m_dialogTool = new Dialog(pattern, 0, this);
m_dialogTool = new Dialog(pattern, doc, 0, this);
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Check if need to extend.");

View File

@ -63,8 +63,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogAlongLine::DialogAlongLine(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogAlongLine::DialogAlongLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogAlongLine),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogAlongLine final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogAlongLine(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogAlongLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogAlongLine() override;
auto GetPointName() const -> QString;

View File

@ -57,8 +57,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogArc::DialogArc(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogArc::DialogArc(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogArc),
m_timerRadius(new QTimer(this)),
m_timerF1(new QTimer(this)),

View File

@ -50,7 +50,7 @@ class DialogArc final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogArc(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogArc(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogArc() override;
auto GetCenter() const -> quint32;

View File

@ -52,8 +52,8 @@
#include "ui_dialogarcwithlength.h"
//---------------------------------------------------------------------------------------------------------------------
DialogArcWithLength::DialogArcWithLength(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogArcWithLength::DialogArcWithLength(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogArcWithLength),
m_timerRadius(new QTimer(this)),
m_timerF1(new QTimer(this)),

View File

@ -47,7 +47,7 @@ class DialogArcWithLength final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogArcWithLength(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogArcWithLength(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogArcWithLength() override;
auto GetCenter() const -> quint32;

View File

@ -60,8 +60,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogBisector::DialogBisector(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogBisector::DialogBisector(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogBisector),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogBisector final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogBisector(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogBisector(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogBisector() override;
auto GetPointName() const -> QString;

View File

@ -44,8 +44,8 @@
#include "ui_dialogcubicbezier.h"
//---------------------------------------------------------------------------------------------------------------------
DialogCubicBezier::DialogCubicBezier(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogCubicBezier::DialogCubicBezier(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogCubicBezier),
spl(),
newDuplicate(-1),

View File

@ -49,7 +49,7 @@ class DialogCubicBezier : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogCubicBezier(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogCubicBezier(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogCubicBezier() override;
auto GetSpline() const -> VCubicBezier;

View File

@ -59,8 +59,9 @@
class QWidget;
//---------------------------------------------------------------------------------------------------------------------
DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogCubicBezierPath::DialogCubicBezierPath(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogCubicBezierPath),
path(),
newDuplicate(-1),

View File

@ -50,7 +50,7 @@ class DialogCubicBezierPath : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogCubicBezierPath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogCubicBezierPath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogCubicBezierPath() override;
auto GetPath() const -> VCubicBezierPath;

View File

@ -58,8 +58,9 @@
#include "ui_dialogcurveintersectaxis.h"
//---------------------------------------------------------------------------------------------------------------------
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogCurveIntersectAxis),
formulaAngle(),
formulaBaseHeightAngle(0),

View File

@ -47,7 +47,7 @@ class DialogCurveIntersectAxis final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogCurveIntersectAxis(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogCurveIntersectAxis(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogCurveIntersectAxis() override;
auto GetPointName() const -> QString;

View File

@ -56,8 +56,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogCutArc::DialogCutArc(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogCutArc::DialogCutArc(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogCutArc),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogCutArc final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogCutArc(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogCutArc(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogCutArc() override;
auto GetPointName() const -> QString;

View File

@ -56,8 +56,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogCutSpline::DialogCutSpline(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogCutSpline::DialogCutSpline(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogCutSpline),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogCutSpline final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogCutSpline(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogCutSpline(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogCutSpline() override;
auto GetPointName() const -> QString;

View File

@ -56,8 +56,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogCutSplinePath),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogCutSplinePath final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogCutSplinePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogCutSplinePath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogCutSplinePath() override;
auto GetPointName() const -> QString;

View File

@ -57,8 +57,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogEllipticalArc::DialogEllipticalArc(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogEllipticalArc),
m_timerRadius1(new QTimer(this)),
m_timerRadius2(new QTimer(this)),

View File

@ -47,7 +47,7 @@ class DialogEllipticalArc : public DialogTool
Q_OBJECT // NOLINT
public:
DialogEllipticalArc(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogEllipticalArc(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogEllipticalArc() override;
auto GetCenter() const -> quint32;

View File

@ -61,8 +61,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogEndLine::DialogEndLine(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogEndLine::DialogEndLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogEndLine),
formulaLength(),
formulaAngle(),

View File

@ -50,7 +50,7 @@ class DialogEndLine : public DialogTool
Q_OBJECT // NOLINT
public:
DialogEndLine(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogEndLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogEndLine() override;
auto GetPointName() const -> QString;

View File

@ -59,8 +59,9 @@
#include "ui_dialogflippingbyaxis.h"
//---------------------------------------------------------------------------------------------------------------------
DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogFlippingByAxis),
stage1(true),
m_suffix(),

View File

@ -51,7 +51,7 @@ class DialogFlippingByAxis : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogFlippingByAxis(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogFlippingByAxis(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogFlippingByAxis() override;
auto GetOriginPointId() const -> quint32;

View File

@ -58,8 +58,9 @@
#include "ui_dialogflippingbyline.h"
//---------------------------------------------------------------------------------------------------------------------
DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogFlippingByLine),
stage1(true),
m_suffix(),

View File

@ -51,7 +51,7 @@ class DialogFlippingByLine : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogFlippingByLine(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogFlippingByLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogFlippingByLine() override;
auto GetFirstLinePointId() const -> quint32;

View File

@ -34,11 +34,11 @@
#include "ui_dialoggroup.h"
//---------------------------------------------------------------------------------------------------------------------
DialogGroup::DialogGroup(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogGroup),
group(),
flagName(false)
DialogGroup::DialogGroup(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogGroup),
group(),
flagName(false)
{
ui->setupUi(this);
InitOkCancel(ui);

View File

@ -47,7 +47,7 @@ class DialogGroup : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogGroup(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogGroup(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogGroup() override;
void SetName(const QString &name);

View File

@ -56,8 +56,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogHeight::DialogHeight(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogHeight::DialogHeight(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogHeight)
{
ui->setupUi(this);

View File

@ -50,7 +50,7 @@ class DialogHeight final : public DialogTool
Q_OBJECT // NOLINT
public:
DialogHeight(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogHeight(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogHeight() override;
auto GetPointName() const -> QString;

View File

@ -48,8 +48,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogLine::DialogLine(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogLine::DialogLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogLine),
flagError(true)
{

View File

@ -50,7 +50,7 @@ class DialogLine : public DialogTool
Q_OBJECT // NOLINT
public:
DialogLine(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogLine(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogLine() override;
auto GetFirstPoint() const -> quint32;

View File

@ -41,8 +41,8 @@
#include <QSharedPointer>
#include <new>
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoollineintersect.h"
#include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/compatibility.h"
@ -59,13 +59,13 @@
* @param data container with data
* @param parent parent widget
*/
DialogLineIntersect::DialogLineIntersect(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogLineIntersect),
pointName(),
flagError(true),
flagPoint(true),
flagName(true)
DialogLineIntersect::DialogLineIntersect(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogLineIntersect),
pointName(),
flagError(true),
flagPoint(true),
flagName(true)
{
ui->setupUi(this);
@ -74,26 +74,23 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, quint32 toolId,
number = 0;
InitOkCancelApply(ui);
ui->lineEditNamePoint->setText(
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
FillComboBoxPoints(ui->comboBoxP1Line1);
FillComboBoxPoints(ui->comboBoxP2Line1);
FillComboBoxPoints(ui->comboBoxP1Line2);
FillComboBoxPoints(ui->comboBoxP2Line2);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxP1Line1, &QComboBox::currentTextChanged,
this, &DialogLineIntersect::PointNameChanged);
connect(ui->comboBoxP2Line1, &QComboBox::currentTextChanged,
this, &DialogLineIntersect::PointNameChanged);
connect(ui->comboBoxP1Line2, &QComboBox::currentTextChanged,
this, &DialogLineIntersect::PointNameChanged);
connect(ui->comboBoxP2Line2, &QComboBox::currentTextChanged,
this, &DialogLineIntersect::PointNameChanged);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxP1Line1, &QComboBox::currentTextChanged, this, &DialogLineIntersect::PointNameChanged);
connect(ui->comboBoxP2Line1, &QComboBox::currentTextChanged, this, &DialogLineIntersect::PointNameChanged);
connect(ui->comboBoxP1Line2, &QComboBox::currentTextChanged, this, &DialogLineIntersect::PointNameChanged);
connect(ui->comboBoxP2Line2, &QComboBox::currentTextChanged, this, &DialogLineIntersect::PointNameChanged);
vis = new VisToolLineIntersect(data);
@ -115,7 +112,7 @@ DialogLineIntersect::~DialogLineIntersect()
*/
void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Point)
{
@ -187,7 +184,7 @@ void DialogLineIntersect::ChosenObject(quint32 id, const SceneObject &type)
}
}
}
break;
break;
default:
break;
}
@ -248,8 +245,7 @@ void DialogLineIntersect::PointNameChanged()
QPointF fPoint;
QLineF::IntersectType intersect = Intersects(line1, line2, &fPoint);
flagError = not (set.size() < 3 || intersect == QLineF::NoIntersection);
flagError = not(set.size() < 3 || intersect == QLineF::NoIntersection);
color = flagError ? OkColor(this) : errorColor;
}
catch (const VExceptionBadId &)
@ -308,7 +304,7 @@ void DialogLineIntersect::SetP2Line2(quint32 value)
VisToolLineIntersect *line = qobject_cast<VisToolLineIntersect *>(vis);
SCASSERT(line != nullptr)
line->SetLine2P2Id(value);
line->SetLine2P2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -50,7 +50,7 @@ class DialogLineIntersect : public DialogTool
Q_OBJECT // NOLINT
public:
DialogLineIntersect(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogLineIntersect(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogLineIntersect() override;
auto GetP1Line1() const -> quint32;

View File

@ -60,8 +60,9 @@
#include "ui_dialoglineintersectaxis.h"
//---------------------------------------------------------------------------------------------------------------------
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogLineIntersectAxis),
formulaAngle(),
formulaBaseHeightAngle(0),

View File

@ -47,7 +47,7 @@ class DialogLineIntersectAxis : public DialogTool
Q_OBJECT // NOLINT
public:
DialogLineIntersectAxis(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogLineIntersectAxis(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogLineIntersectAxis() override;
auto GetPointName() const -> QString;

View File

@ -68,8 +68,8 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
//---------------------------------------------------------------------------------------------------------------------
DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogMove::DialogMove(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogMove),
timerAngle(new QTimer(this)),
timerRotationAngle(new QTimer(this)),

View File

@ -50,7 +50,7 @@ class DialogMove : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogMove(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogMove(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogMove() override;
auto GetAngle() const -> QString;

View File

@ -60,8 +60,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogNormal::DialogNormal(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogNormal::DialogNormal(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogNormal),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogNormal : public DialogTool
Q_OBJECT // NOLINT
public:
DialogNormal(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogNormal(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogNormal() override;
auto GetPointName() const -> QString;

View File

@ -32,24 +32,25 @@
#include <QLineEdit>
#include <QPointer>
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolpointfromarcandtangent.h"
#include "../../visualization/visualization.h"
#include "dialogtool.h"
#include "ui_dialogpointfromarcandtangent.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogPointFromArcAndTangent),
pointName(),
flagName(true)
DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *data, VAbstractPattern *doc,
quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointFromArcAndTangent),
pointName(),
flagName(true)
{
ui->setupUi(this);
ui->lineEditNamePoint->setClearButtonEnabled(true);
ui->lineEditNamePoint->setText(
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
@ -57,11 +58,12 @@ DialogPointFromArcAndTangent::DialogPointFromArcAndTangent(const VContainer *dat
FillComboBoxArcs(ui->comboBoxArc);
FillComboBoxCrossCirclesPoints(ui->comboBoxResult);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
vis = new VisToolPointFromArcAndTangent(data);
@ -143,7 +145,7 @@ void DialogPointFromArcAndTangent::SetCrossCirclesPoint(CrossCirclesPoint p)
//---------------------------------------------------------------------------------------------------------------------
void DialogPointFromArcAndTangent::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Point || type == SceneObject::Arc)
{

View File

@ -48,7 +48,8 @@ class DialogPointFromArcAndTangent : public DialogTool
Q_OBJECT // NOLINT
public:
DialogPointFromArcAndTangent(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogPointFromArcAndTangent(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent = nullptr);
~DialogPointFromArcAndTangent() override;
auto GetPointName() const -> QString;

View File

@ -53,9 +53,9 @@
#include "ui_dialogpointfromcircleandtangent.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContainer *data, quint32 toolId,
QWidget *parent)
: DialogTool(data, toolId, parent),
DialogPointFromCircleAndTangent::DialogPointFromCircleAndTangent(const VContainer *data, VAbstractPattern *doc,
quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointFromCircleAndTangent)
{
ui->setupUi(this);

View File

@ -48,7 +48,7 @@ class DialogPointFromCircleAndTangent : public DialogTool
Q_OBJECT // NOLINT
public:
DialogPointFromCircleAndTangent(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogPointFromCircleAndTangent(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogPointFromCircleAndTangent() override;
auto GetPointName() const -> QString;

View File

@ -59,8 +59,9 @@
* @param data container with data
* @param parent parent widget
*/
DialogPointOfContact::DialogPointOfContact(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogPointOfContact::DialogPointOfContact(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointOfContact),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogPointOfContact : public DialogTool
Q_OBJECT // NOLINT
public:
DialogPointOfContact(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogPointOfContact(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogPointOfContact() override;
auto GetPointName() const -> QString;

View File

@ -34,8 +34,8 @@
#include <QLineEdit>
#include <QPointer>
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolpointofintersection.h"
#include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h"
#include "dialogtool.h"
#include "ui_dialogpointofintersection.h"
@ -46,37 +46,38 @@
* @param data container with data
* @param parent parent widget
*/
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogPointOfIntersection),
pointName(),
flagName(true),
flagError(true)
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointOfIntersection),
pointName(),
flagName(true),
flagError(true)
{
ui->setupUi(this);
ui->lineEditNamePoint->setClearButtonEnabled(true);
ui->lineEditNamePoint->setText(
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxFirstPoint, &QComboBox::currentTextChanged,
this, &DialogPointOfIntersection::PointNameChanged);
connect(ui->comboBoxSecondPoint, &QComboBox::currentTextChanged,
this, &DialogPointOfIntersection::PointNameChanged);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxFirstPoint, &QComboBox::currentTextChanged, this, &DialogPointOfIntersection::PointNameChanged);
connect(ui->comboBoxSecondPoint, &QComboBox::currentTextChanged, this,
&DialogPointOfIntersection::PointNameChanged);
vis = new VisToolPointOfIntersection(data);
vis->VisualMode(NULL_ID);//Show vertical axis
vis->VisualMode(NULL_ID); // Show vertical axis
ui->tabWidget->setCurrentIndex(0);
SetTabStopDistance(ui->plainTextEditToolNotes);
@ -116,7 +117,7 @@ void DialogPointOfIntersection::SetSecondPointId(quint32 value)
*/
void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Point)
{

View File

@ -50,7 +50,7 @@ class DialogPointOfIntersection : public DialogTool
Q_OBJECT // NOLINT
public:
DialogPointOfIntersection(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogPointOfIntersection(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogPointOfIntersection() override;
auto GetPointName() const -> QString;

View File

@ -34,26 +34,26 @@
#include <QLineEdit>
#include <QPointer>
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistoolpointofintersectionarcs.h"
#include "../vmisc/vabstractapplication.h"
#include "../../visualization/visualization.h"
#include "dialogtool.h"
#include "ui_dialogpointofintersectionarcs.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogPointOfIntersectionArcs),
pointName(),
flagName(true),
flagError(true)
DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *data, VAbstractPattern *doc,
quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointOfIntersectionArcs),
pointName(),
flagName(true),
flagError(true)
{
ui->setupUi(this);
ui->lineEditNamePoint->setClearButtonEnabled(true);
ui->lineEditNamePoint->setText(
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
@ -61,15 +61,14 @@ DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *d
FillComboBoxArcs(ui->comboBoxArc2);
FillComboBoxCrossCirclesPoints(ui->comboBoxResult);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxArc1, &QComboBox::currentTextChanged,
this, &DialogPointOfIntersectionArcs::ArcChanged);
connect(ui->comboBoxArc1, &QComboBox::currentTextChanged,
this, &DialogPointOfIntersectionArcs::ArcChanged);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxArc1, &QComboBox::currentTextChanged, this, &DialogPointOfIntersectionArcs::ArcChanged);
connect(ui->comboBoxArc1, &QComboBox::currentTextChanged, this, &DialogPointOfIntersectionArcs::ArcChanged);
vis = new VisToolPointOfIntersectionArcs(data);
@ -151,7 +150,7 @@ void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossCirclesPoint p)
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Arc)
{

View File

@ -48,7 +48,8 @@ class DialogPointOfIntersectionArcs : public DialogTool
Q_OBJECT // NOLINT
public:
DialogPointOfIntersectionArcs(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogPointOfIntersectionArcs(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent = nullptr);
~DialogPointOfIntersectionArcs() override;
auto GetPointName() const -> QString;

View File

@ -53,9 +53,9 @@
#include "ui_dialogpointofintersectioncircles.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContainer *data, quint32 toolId,
QWidget *parent)
: DialogTool(data, toolId, parent),
DialogPointOfIntersectionCircles::DialogPointOfIntersectionCircles(const VContainer *data, VAbstractPattern *doc,
quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointOfIntersectionCircles),
m_timerCircle1Radius(new QTimer(this)),
m_timerCircle2Radius(new QTimer(this))

View File

@ -48,7 +48,7 @@ class DialogPointOfIntersectionCircles : public DialogTool
Q_OBJECT // NOLINT
public:
DialogPointOfIntersectionCircles(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogPointOfIntersectionCircles(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogPointOfIntersectionCircles() override;
auto GetPointName() const -> QString;

View File

@ -37,26 +37,26 @@
#include "../../visualization/path/vistoolpointofintersectioncurves.h"
#include "../../visualization/visualization.h"
#include "../vmisc/vabstractapplication.h"
#include "../qmuparser/qmudef.h"
#include "../dialogtoolbox.h"
#include "../qmuparser/qmudef.h"
#include "../vpatterndb/vcontainer.h"
#include "ui_dialogpointofintersectioncurves.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContainer *data, quint32 toolId,
QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogPointOfIntersectionCurves),
pointName(),
flagName(false),
flagError(false)
DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContainer *data, VAbstractPattern *doc,
quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPointOfIntersectionCurves),
pointName(),
flagName(false),
flagError(false)
{
ui->setupUi(this);
ui->lineEditNamePoint->setClearButtonEnabled(true);
ui->lineEditNamePoint->setText(VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
ui->lineEditNamePoint->setText(
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
@ -65,15 +65,14 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
FillComboBoxVCrossCurvesPoint(ui->comboBoxVCorrection);
FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxCurve1, &QComboBox::currentTextChanged,
this, &DialogPointOfIntersectionCurves::CurveChanged);
connect(ui->comboBoxCurve2, &QComboBox::currentTextChanged,
this, &DialogPointOfIntersectionCurves::CurveChanged);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxCurve1, &QComboBox::currentTextChanged, this, &DialogPointOfIntersectionCurves::CurveChanged);
connect(ui->comboBoxCurve2, &QComboBox::currentTextChanged, this, &DialogPointOfIntersectionCurves::CurveChanged);
connect(ui->lineEditCurve1Alias1, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
connect(ui->lineEditCurve1Alias2, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
connect(ui->lineEditCurve2Alias1, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
@ -179,12 +178,10 @@ void DialogPointOfIntersectionCurves::SetHCrossPoint(HCrossCurvesPoint hP)
//---------------------------------------------------------------------------------------------------------------------
void DialogPointOfIntersectionCurves::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Spline
|| type == SceneObject::Arc
|| type == SceneObject::ElArc
|| type == SceneObject::SplinePath)
if (type == SceneObject::Spline || type == SceneObject::Arc || type == SceneObject::ElArc ||
type == SceneObject::SplinePath)
{
auto *point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
SCASSERT(point != nullptr)
@ -264,12 +261,12 @@ void DialogPointOfIntersectionCurves::ValidateAlias()
QRegularExpression rx(NameRegExp());
const QSharedPointer<VAbstractCurve> curve1 = data->GeometricObject<VAbstractCurve>(GetFirstCurveId());
QPair<QString, QString> curve1Alias = SegmentAliases(curve1->getType(), GetCurve1AliasSuffix1(),
GetCurve1AliasSuffix2());
QPair<QString, QString> curve1Alias =
SegmentAliases(curve1->getType(), GetCurve1AliasSuffix1(), GetCurve1AliasSuffix2());
const QSharedPointer<VAbstractCurve> curve2 = data->GeometricObject<VAbstractCurve>(GetSecondCurveId());
QPair<QString, QString> curve2Alias = SegmentAliases(curve2->getType(), GetCurve2AliasSuffix1(),
GetCurve2AliasSuffix2());
QPair<QString, QString> curve2Alias =
SegmentAliases(curve2->getType(), GetCurve2AliasSuffix1(), GetCurve2AliasSuffix2());
QSet<QString> uniqueAliases;
int countAliases = 0;
@ -289,7 +286,7 @@ void DialogPointOfIntersectionCurves::ValidateAlias()
CountUniqueAliases(curve2Alias.second);
auto Validate = [countAliases, uniqueAliases, rx, this](const QString &originalSuffix, const QString &suffix,
const QString &alias, bool &flagAlias, QLabel *label)
const QString &alias, bool &flagAlias, QLabel *label)
{
if (not suffix.isEmpty() &&
(not rx.match(alias).hasMatch() || (originalSuffix != suffix && not data->IsUnique(alias)) ||

View File

@ -48,7 +48,8 @@ class DialogPointOfIntersectionCurves : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogPointOfIntersectionCurves(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogPointOfIntersectionCurves(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent = nullptr);
~DialogPointOfIntersectionCurves() override;
auto GetPointName() const -> QString;

View File

@ -70,8 +70,8 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
//---------------------------------------------------------------------------------------------------------------------
DialogRotation::DialogRotation(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogRotation::DialogRotation(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogRotation),
timerAngle(new QTimer(this)),
formulaAngle(),

View File

@ -50,7 +50,7 @@ class DialogRotation : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogRotation(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogRotation(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogRotation() override;
auto GetOrigPointId() const -> quint32;

View File

@ -59,8 +59,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogShoulderPoint),
m_timerFormula(new QTimer(this))
{

View File

@ -50,7 +50,7 @@ class DialogShoulderPoint : public DialogTool
Q_OBJECT // NOLINT
public:
DialogShoulderPoint(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogShoulderPoint(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogShoulderPoint() override;
auto GetPointName() const -> QString;

View File

@ -32,7 +32,6 @@
#include <QLineEdit>
#include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h"
#include "dialogtool.h"
#include "ui_dialogsinglepoint.h"
@ -42,12 +41,12 @@
* @param data container with data
* @param parent parent widget
*/
DialogSinglePoint::DialogSinglePoint(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogSinglePoint),
point(),
pointName(),
flagName(true)
DialogSinglePoint::DialogSinglePoint(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogSinglePoint),
point(),
pointName(),
flagName(true)
{
ui->setupUi(this);
@ -57,11 +56,12 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, quint32 toolId, QWi
ui->doubleSpinBoxY->setRange(0, VAbstractValApplication::VApp()->fromPixel(maxSceneSize));
InitOkCancel(ui);
connect(ui->lineEditName, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditName, ui->labelEditName, pointName, this->data, flagName);
CheckState();
});
connect(ui->lineEditName, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditName, ui->labelEditName, pointName, this->data, flagName);
CheckState();
});
ui->tabWidget->setCurrentIndex(0);
SetTabStopDistance(ui->plainTextEditToolNotes);

View File

@ -50,7 +50,7 @@ class DialogSinglePoint : public DialogTool
Q_OBJECT // NOLINT
public:
DialogSinglePoint(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogSinglePoint(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogSinglePoint() override;
void SetData(const QString &name, const QPointF &point);

View File

@ -62,8 +62,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogSpline::DialogSpline(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogSpline::DialogSpline(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogSpline),
timerAngle1(new QTimer(this)),
timerAngle2(new QTimer(this)),

View File

@ -52,7 +52,7 @@ class DialogSpline : public DialogTool
Q_OBJECT // NOLINT
public:
DialogSpline(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogSpline(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogSpline() override;
auto GetSpline() const -> VSpline;

View File

@ -72,8 +72,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogSplinePath::DialogSplinePath(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogSplinePath::DialogSplinePath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogSplinePath),
path(),
newDuplicate(-1),

View File

@ -53,7 +53,7 @@ class DialogSplinePath : public DialogTool
Q_OBJECT // NOLINT
public:
DialogSplinePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogSplinePath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogSplinePath() override;
auto GetPath() const -> VSplinePath;

View File

@ -84,19 +84,24 @@ QT_WARNING_POP
* @param data container with data
* @param parent parent widget
*/
DialogTool::DialogTool(const VContainer *data, quint32 toolId, QWidget *parent)
DialogTool::DialogTool(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: QDialog(parent),
data(data),
m_doc(doc),
isInitialized(false),
bOk(nullptr),
bApply(nullptr),
associatedTool(nullptr),
toolId(toolId),
prepare(false),
vis(nullptr){SCASSERT(data != nullptr)}
vis(nullptr)
{
SCASSERT(data != nullptr);
SCASSERT(doc != nullptr);
}
//---------------------------------------------------------------------------------------------------------------------
DialogTool::~DialogTool()
//---------------------------------------------------------------------------------------------------------------------
DialogTool::~DialogTool()
{
emit ToolTip(QString());

View File

@ -85,7 +85,7 @@ class DialogTool : public QDialog
Q_OBJECT // NOLINT
public:
DialogTool(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogTool(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogTool() override;
auto GetAssociatedTool() -> VAbstractTool *;
@ -135,6 +135,8 @@ protected:
/** @brief data container with data */
const VContainer *data;
VAbstractPattern *m_doc;
/** @brief isInitialized true if window is initialized */
bool isInitialized;

View File

@ -35,8 +35,8 @@
#include <QPointer>
#include <QSet>
#include "../../visualization/visualization.h"
#include "../../visualization/line/vistooltriangle.h"
#include "../../visualization/visualization.h"
#include "../ifc/xml/vabstractpattern.h"
#include "dialogtool.h"
#include "ui_dialogtriangle.h"
@ -47,19 +47,19 @@
* @param data container with data
* @param parent parent widget
*/
DialogTriangle::DialogTriangle(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogTriangle),
pointName(),
flagName(false),
flagError(false)
DialogTriangle::DialogTriangle(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogTriangle),
pointName(),
flagName(false),
flagError(false)
{
ui->setupUi(this);
ui->lineEditNamePoint->setClearButtonEnabled(true);
ui->lineEditNamePoint->setText(
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
VAbstractValApplication::VApp()->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
InitOkCancelApply(ui);
@ -68,19 +68,16 @@ DialogTriangle::DialogTriangle(const VContainer *data, quint32 toolId, QWidget *
FillComboBoxPoints(ui->comboBoxFirstPoint);
FillComboBoxPoints(ui->comboBoxSecondPoint);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, [this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxFirstPoint, &QComboBox::currentTextChanged,
this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxSecondPoint, &QComboBox::currentTextChanged,
this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxAxisP1, &QComboBox::currentTextChanged,
this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxAxisP2, &QComboBox::currentTextChanged,
this, &DialogTriangle::PointNameChanged);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this,
[this]()
{
CheckPointLabel(this, ui->lineEditNamePoint, ui->labelEditNamePoint, pointName, this->data, flagName);
CheckState();
});
connect(ui->comboBoxFirstPoint, &QComboBox::currentTextChanged, this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxSecondPoint, &QComboBox::currentTextChanged, this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxAxisP1, &QComboBox::currentTextChanged, this, &DialogTriangle::PointNameChanged);
connect(ui->comboBoxAxisP2, &QComboBox::currentTextChanged, this, &DialogTriangle::PointNameChanged);
vis = new VisToolTriangle(data);
@ -102,7 +99,7 @@ DialogTriangle::~DialogTriangle()
*/
void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Point)
{
@ -146,7 +143,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
}
}
}
break;
break;
case (3):
{
QSet<quint32> set;
@ -166,7 +163,7 @@ void DialogTriangle::ChosenObject(quint32 id, const SceneObject &type)
}
}
}
break;
break;
default:
break;
}
@ -199,7 +196,7 @@ void DialogTriangle::PointNameChanged()
set.insert(getCurrentObjectId(ui->comboBoxAxisP2));
QColor color;
if (set.size() < 3)//Need tree or more unique points for creation triangle
if (set.size() < 3) // Need tree or more unique points for creation triangle
{
flagError = false;
color = errorColor;

View File

@ -50,7 +50,7 @@ class DialogTriangle : public DialogTool
Q_OBJECT // NOLINT
public:
DialogTriangle(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogTriangle(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogTriangle() override;
auto GetAxisP1Id() const -> quint32;

View File

@ -47,8 +47,8 @@
#include "ui_dialogtruedarts.h"
//---------------------------------------------------------------------------------------------------------------------
DialogTrueDarts::DialogTrueDarts(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogTrueDarts::DialogTrueDarts(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogTrueDarts),
d1PointName(),
d2PointName(),

View File

@ -47,7 +47,7 @@ class DialogTrueDarts : public DialogTool
Q_OBJECT // NOLINT
public:
DialogTrueDarts(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogTrueDarts(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogTrueDarts() override;
auto GetFirstNewDartPointName() -> QString;

View File

@ -43,8 +43,8 @@
* @param data container with data
* @param parent parent widget
*/
DialogUnionDetails::DialogUnionDetails(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogUnionDetails::DialogUnionDetails(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogUnionDetails),
indexD1(0),
indexD2(0),

View File

@ -50,7 +50,7 @@ class DialogUnionDetails : public DialogTool
Q_OBJECT // NOLINT
public:
DialogUnionDetails(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
DialogUnionDetails(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogUnionDetails() override;
auto getD1() const -> quint32;

View File

@ -26,18 +26,19 @@
**
*************************************************************************/
#include "dialogduplicatedetail.h"
#include "ui_dialogduplicatedetail.h"
#include "../../../visualization/path/vistoolduplicatedetail.h"
#include "../../../tools/vabstracttool.h"
#include "../../../visualization/path/vistoolduplicatedetail.h"
#include "ui_dialogduplicatedetail.h"
//---------------------------------------------------------------------------------------------------------------------
DialogDuplicateDetail::DialogDuplicateDetail(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogDuplicateDetail),
m_idDetail(NULL_ID),
m_mx(0),
m_my(0),
m_firstRelease(false)
DialogDuplicateDetail::DialogDuplicateDetail(const VContainer *data, VAbstractPattern *doc, quint32 toolId,
QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogDuplicateDetail),
m_idDetail(NULL_ID),
m_mx(0),
m_my(0),
m_firstRelease(false)
{
ui->setupUi(this);
InitOkCancel(ui);
@ -80,7 +81,7 @@ void DialogDuplicateDetail::ShowDialog(bool click)
//---------------------------------------------------------------------------------------------------------------------
void DialogDuplicateDetail::ChosenObject(quint32 id, const SceneObject &type)
{
if (prepare == false)// After first choose we ignore all objects
if (prepare == false) // After first choose we ignore all objects
{
if (type == SceneObject::Detail && id > NULL_ID)
{

View File

@ -40,7 +40,7 @@ class DialogDuplicateDetail : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogDuplicateDetail(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogDuplicateDetail(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
virtual ~DialogDuplicateDetail();
auto Duplicate() const -> quint32;

View File

@ -27,8 +27,8 @@
*************************************************************************/
#include "dialoginsertnode.h"
#include "ui_dialoginsertnode.h"
#include "../vpatterndb/vcontainer.h"
#include "ui_dialoginsertnode.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
@ -36,19 +36,16 @@
#include <QMenu>
//---------------------------------------------------------------------------------------------------------------------
DialogInsertNode::DialogInsertNode(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogInsertNode)
DialogInsertNode::DialogInsertNode(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogInsertNode)
{
ui->setupUi(this);
InitOkCancel(ui);
CheckPieces();
connect(ui->comboBoxPiece, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
{
CheckPieces();
});
connect(ui->comboBoxPiece, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]() { CheckPieces(); });
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogInsertNode::ShowContextMenu);
connect(ui->listWidget, &QListWidget::itemSelectionChanged, this, &DialogInsertNode::NodeSelected);
@ -108,7 +105,7 @@ auto DialogInsertNode::GetNodes() const -> QVector<VPieceNode>
for (qint32 i = 0; i < ui->listWidget->count(); ++i)
{
VPieceNode node = qvariant_cast<VPieceNode>(ui->listWidget->item(i)->data(Qt::UserRole));
for(int n = 1; n <= nodeNumbers.value(node.GetId(), 1); ++n)
for (int n = 1; n <= nodeNumbers.value(node.GetId(), 1); ++n)
{
nodes.append(node);
}

View File

@ -42,7 +42,7 @@ class DialogInsertNode : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogInsertNode(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogInsertNode(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
virtual ~DialogInsertNode();
virtual void SetPiecesList(const QVector<quint32> &list) override;

View File

@ -86,8 +86,8 @@ auto CuttingPath(quint32 id, const VContainer *data) -> QVector<QPointF>
} // namespace
//---------------------------------------------------------------------------------------------------------------------
DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogPiecePath::DialogPiecePath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPiecePath),
m_timerWidth(new QTimer(this)),
m_timerWidthBefore(new QTimer(this)),

View File

@ -41,7 +41,7 @@ class DialogPiecePath : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogPiecePath(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogPiecePath(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogPiecePath() override;
void EnbleShowMode(bool disable);

View File

@ -27,30 +27,27 @@
*************************************************************************/
#include "dialogpin.h"
#include "ui_dialogpin.h"
#include "../../../visualization/line/vistoolspecialpoint.h"
#include "ui_dialogpin.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
#include "../vpatterndb/vcontainer.h"
//---------------------------------------------------------------------------------------------------------------------
DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
ui(new Ui::DialogPin),
m_showMode(false),
m_flagPoint(false),
m_flagError(false)
DialogPin::DialogPin(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPin),
m_showMode(false),
m_flagPoint(false),
m_flagError(false)
{
ui->setupUi(this);
InitOkCancel(ui);
FillComboBoxPoints(ui->comboBoxPoint);
connect(ui->comboBoxPiece, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
{
CheckPieces();
});
connect(ui->comboBoxPiece, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]() { CheckPieces(); });
vis = new VisToolSpecialPoint(data);
}

View File

@ -40,7 +40,7 @@ class DialogPin : public DialogTool
{
Q_OBJECT // NOLINT
public:
explicit DialogPin(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogPin(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
virtual ~DialogPin();
void EnbleShowMode(bool disable);

View File

@ -40,8 +40,8 @@
#include <QTimer>
//---------------------------------------------------------------------------------------------------------------------
DialogPlaceLabel::DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
DialogPlaceLabel::DialogPlaceLabel(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogPlaceLabel),
m_showMode(false),
m_formulaBaseHeightWidth(0),

View File

@ -42,7 +42,7 @@ class DialogPlaceLabel : public DialogTool
Q_OBJECT // NOLINT
public:
explicit DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
explicit DialogPlaceLabel(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
~DialogPlaceLabel() override;
void EnbleShowMode(bool disable);

View File

@ -152,17 +152,7 @@ void InitComboBoxFormats(QComboBox *box, const QStringList &items, const QString
//---------------------------------------------------------------------------------------------------------------------
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent)
: DialogSeamAllowance(data, toolId, parent)
{
SCASSERT(doc != nullptr)
m_doc = doc;
uiTabLabels->groupBoxPatternLabel->setEnabled(not m_doc->GetPatternLabelTemplate().isEmpty());
}
//---------------------------------------------------------------------------------------------------------------------
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent)
: DialogTool(data, toolId, parent),
: DialogTool(data, doc, toolId, parent),
ui(new Ui::DialogSeamAllowance),
uiTabPaths(new Ui::TabPaths),
uiTabLabels(new Ui::TabLabels),
@ -210,6 +200,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
flagMainPathIsValid = MainPathIsValid();
m_ftb->SetCurrentIndex(TabOrder::Paths); // Show always first tab active on start.
uiTabLabels->groupBoxPatternLabel->setEnabled(not m_doc->GetPatternLabelTemplate().isEmpty());
}
//---------------------------------------------------------------------------------------------------------------------
@ -924,7 +916,7 @@ void DialogSeamAllowance::ShowCustomSAContextMenu(const QPoint &pos)
}
else if (selectedAction == actionOption)
{
auto *dialog = new DialogPiecePath(data, record.path, this);
auto *dialog = new DialogPiecePath(data, m_doc, record.path, this);
dialog->SetPiecePath(CurrentPath(record.path));
dialog->SetPieceId(toolId);
if (record.includeType == PiecePathIncludeType::AsMainPath)
@ -965,7 +957,7 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos)
SCASSERT(rowItem != nullptr);
const auto pathId = qvariant_cast<quint32>(rowItem->data(Qt::UserRole));
auto *dialog = new DialogPiecePath(data, pathId, this);
auto *dialog = new DialogPiecePath(data, m_doc, pathId, this);
dialog->SetPiecePath(CurrentPath(pathId));
dialog->SetPieceId(toolId);
dialog->EnbleShowMode(true);
@ -1058,7 +1050,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
}
else if (selectedAction == actionOption)
{
auto *dialog = new DialogPlaceLabel(data, labelId, this);
auto *dialog = new DialogPlaceLabel(data, m_doc, labelId, this);
dialog->EnbleShowMode(true);
dialog->SetLabelType(currentLabel.GetLabelType());
dialog->SetWidth(currentLabel.GetWidthFormula());
@ -3517,21 +3509,26 @@ void DialogSeamAllowance::InitLabelsTab()
// Pattern label data
uiTabLabels->lineEditCustomerEmail->setClearButtonEnabled(true);
uiTabLabels->lineEditCustomerName->setText(VAbstractValApplication::VApp()->GetCustomerName());
uiTabLabels->lineEditCustomerEmail->setText(VAbstractValApplication::VApp()->CustomerEmail());
uiTabLabels->dateEditCustomerBirthDate->setDate(VAbstractValApplication::VApp()->GetCustomerBirthDate());
if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual)
{
uiTabLabels->lineEditCustomerName->setText(VAbstractValApplication::VApp()->GetCustomerName());
uiTabLabels->lineEditCustomerName->setDisabled(true);
uiTabLabels->lineEditCustomerName->setToolTip(tr("The customer name from individual measurements"));
uiTabLabels->lineEditCustomerEmail->setText(VAbstractValApplication::VApp()->CustomerEmail());
uiTabLabels->lineEditCustomerEmail->setDisabled(true);
uiTabLabels->lineEditCustomerEmail->setToolTip(tr("The customer email from individual measurements"));
uiTabLabels->dateEditCustomerBirthDate->setDate(VAbstractValApplication::VApp()->GetCustomerBirthDate());
uiTabLabels->dateEditCustomerBirthDate->setDisabled(true);
uiTabLabels->dateEditCustomerBirthDate->setToolTip(tr("The customer birth date from individual measurements"));
}
else
{
uiTabLabels->lineEditCustomerName->setText(m_doc->GetCustomerName());
uiTabLabels->lineEditCustomerEmail->setText(m_doc->GetCustomerEmail());
uiTabLabels->dateEditCustomerBirthDate->setDate(m_doc->GetCustomerBirthDate());
}
connect(uiTabLabels->lineEditPatternName, &QLineEdit::editingFinished, this,
&DialogSeamAllowance::PatternLabelDataChanged);

View File

@ -55,7 +55,6 @@ class DialogSeamAllowance : public DialogTool
public:
DialogSeamAllowance(const VContainer *data, VAbstractPattern *doc, quint32 toolId, QWidget *parent = nullptr);
DialogSeamAllowance(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
~DialogSeamAllowance() override;
void EnableApply(bool enable);
@ -253,8 +252,6 @@ private:
QHash<quint32, VPlaceLabelItem> m_newPlaceLabels{};
QHash<quint32, VPiecePath> m_newPaths{};
VAbstractPattern *m_doc{nullptr};
QString m_defLabelValue{};
QMenu *m_placeholdersMenu;

View File

@ -38,6 +38,7 @@
#include <QtGlobal>
#include "../vabstractpoint.h"
#include "../vgeometry/vpointf.h"
#include "../vmisc/def.h"
#include "../vwidgets/vscenepoint.h"

View File

@ -42,11 +42,9 @@
#include <QString>
#include <QtGlobal>
#include "../ifc/exception/vexceptionbadid.h"
#include "../toolsdef.h"
#include "../vdatatool.h"
#include "../vgeometry/vpointf.h"
#include "../vinteractivetool.h"
#include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h"
@ -194,7 +192,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
// add the menu "add to group" to the context menu
QMap<quint32, QString> groupsNotContainingItem = doc->GetGroupsContainingItem(this->getId(), itemId, false);
QActionGroup *actionsAddToGroup = new QActionGroup(this);
auto *actionsAddToGroup = new QActionGroup(this);
if (not groupsNotContainingItem.empty())
{
QMenu *menuAddToGroup =
@ -286,11 +284,12 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
{
return;
}
else if (selectedAction == actionOption)
if (selectedAction == actionOption)
{
qCDebug(vTool, "Show options.");
emit VAbstractValApplication::VApp()->getSceneView()->itemClicked(nullptr);
m_dialog = QPointer<Dialog>(new Dialog(getData(), m_id, VAbstractValApplication::VApp()->getMainWindow()));
m_dialog = QPointer<Dialog>(new Dialog(getData(), doc, m_id, VAbstractValApplication::VApp()->getMainWindow()));
m_dialog->setModal(true);
connect(m_dialog.data(), &DialogTool::DialogClosed, this, &VDrawTool::FullUpdateFromGuiOk);
@ -319,16 +318,14 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
quint32 groupId = selectedAction->data().toUInt();
QDomElement item = doc->AddItemToGroup(this->getId(), itemId, groupId);
VMainGraphicsScene *scene =
qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
auto *scene = qobject_cast<VMainGraphicsScene *>(VAbstractValApplication::VApp()->getCurrentScene());
SCASSERT(scene != nullptr)
scene->clearSelection();
VAbstractMainWindow *window =
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
{
AddItemToGroup *addItemToGroup = new AddItemToGroup(item, doc, groupId);
auto *addItemToGroup = new AddItemToGroup(item, doc, groupId);
connect(addItemToGroup, &AddItemToGroup::UpdateGroups, window,
&VAbstractMainWindow::UpdateVisibilityGroups);
VAbstractApplication::VApp()->getUndoStack()->push(addItemToGroup);
@ -339,11 +336,10 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
quint32 groupId = selectedAction->data().toUInt();
QDomElement item = doc->RemoveItemFromGroup(this->getId(), itemId, groupId);
VAbstractMainWindow *window =
qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
auto *window = qobject_cast<VAbstractMainWindow *>(VAbstractValApplication::VApp()->getMainWindow());
SCASSERT(window != nullptr)
{
RemoveItemFromGroup *removeItemFromGroup = new RemoveItemFromGroup(item, doc, groupId);
auto *removeItemFromGroup = new RemoveItemFromGroup(item, doc, groupId);
connect(removeItemFromGroup, &RemoveItemFromGroup::UpdateGroups, window,
&VAbstractMainWindow::UpdateVisibilityGroups);
VAbstractApplication::VApp()->getUndoStack()->push(removeItemFromGroup);