Independent pen style and color after a group operation.

This commit is contained in:
Roman Telezhynskyi 2020-11-10 12:40:37 +02:00
parent fa0afbb589
commit 545f2d33fe
29 changed files with 854 additions and 81 deletions

View File

@ -6,6 +6,7 @@
- Fix crash while synchronize measurements.
- Object alias.
- Change value for an uninitialized local variable to NAN.
- Independent pen style and color after a group operation.
# Version 0.7.36 October 24, 2020
- [#892] Show tooltip for piece node point.

View File

@ -138,6 +138,7 @@ const QString AttrAlias = QStringLiteral("alias");
const QString AttrAlias1 = QStringLiteral("alias1");
const QString AttrAlias2 = QStringLiteral("alias2");
const QString TypeLineDefault = QStringLiteral("default");
const QString TypeLineNone = QStringLiteral("none");
const QString TypeLineLine = QStringLiteral("hair");
const QString TypeLineDashLine = QStringLiteral("dashLine");
@ -152,10 +153,14 @@ const QString TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
*/
QStringList StylesList()
{
const QStringList styles = QStringList() << TypeLineNone << TypeLineLine << TypeLineDashLine
<< TypeLineDotLine << TypeLineDashDotLine
<< TypeLineDashDotDotLine;
return styles;
return QStringList{
TypeLineNone,
TypeLineLine,
TypeLineDashLine,
TypeLineDotLine,
TypeLineDashDotLine,
TypeLineDashDotDotLine
};
}
//---------------------------------------------------------------------------------------------------------------------
@ -210,6 +215,22 @@ QString PenStyleToLineStyle(Qt::PenStyle penStyle)
return TypeLineLine;
}
//---------------------------------------------------------------------------------------------------------------------
QIcon PenStylePic(Qt::PenStyle style)
{
QPixmap pix(80, 14);
pix.fill(Qt::white);
QBrush brush(Qt::black);
QPen pen(brush, 2.5, style);
QPainter painter(&pix);
painter.setPen(pen);
painter.drawLine(2, 7, 78, 7);
return QIcon(pix);
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QIcon> LineStylesPics()
{
@ -218,18 +239,7 @@ QMap<QString, QIcon> LineStylesPics()
for (auto &s : styles)
{
const Qt::PenStyle style = LineStyleToPenStyle(s);
QPixmap pix(80, 14);
pix.fill(Qt::white);
QBrush brush(Qt::black);
QPen pen(brush, 2.5, style);
QPainter painter(&pix);
painter.setPen(pen);
painter.drawLine(2, 7, 78, 7);
map.insert(s, QIcon(pix));
map.insert(s, PenStylePic(LineStyleToPenStyle(s)));
}
return map;
}
@ -242,6 +252,7 @@ QMap<QString, QIcon> CurvePenStylesPics()
return map;
}
const QString ColorDefault = QStringLiteral("default");
const QString ColorBlack = QStringLiteral("black");
const QString ColorGreen = QStringLiteral("green");
const QString ColorBlue = QStringLiteral("blue");

View File

@ -156,6 +156,7 @@ extern const QString AttrAlias;
extern const QString AttrAlias1;
extern const QString AttrAlias2;
extern const QString TypeLineDefault;
extern const QString TypeLineNone;
extern const QString TypeLineLine;
extern const QString TypeLineDashLine;
@ -166,9 +167,11 @@ extern const QString TypeLineDashDotDotLine;
QStringList StylesList();
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
QString PenStyleToLineStyle(Qt::PenStyle penStyle);
QIcon PenStylePic(Qt::PenStyle style);
QMap<QString, QIcon> LineStylesPics();
QMap<QString, QIcon> CurvePenStylesPics();
extern const QString ColorDefault;
extern const QString ColorBlack;
extern const QString ColorGreen;
extern const QString ColorBlue;

View File

@ -184,6 +184,8 @@
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"/>
<xs:attribute name="alias" type="xs:string"/>
<xs:attribute name="color" type="operationColors"/>
<xs:attribute name="penStyle" type="operationPenStyle"/>
</xs:complexType>
</xs:element>
</xs:sequence>
@ -821,6 +823,28 @@
<xs:enumeration value="cornflowerblue"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="operationColors">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="black"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
<xs:enumeration value="darkRed"/>
<xs:enumeration value="darkGreen"/>
<xs:enumeration value="darkBlue"/>
<xs:enumeration value="yellow"/>
<xs:enumeration value="lightsalmon"/>
<xs:enumeration value="goldenrod"/>
<xs:enumeration value="orange"/>
<xs:enumeration value="deeppink"/>
<xs:enumeration value="violet"/>
<xs:enumeration value="darkviolet"/>
<xs:enumeration value="mediumseagreen"/>
<xs:enumeration value="lime"/>
<xs:enumeration value="deepskyblue"/>
<xs:enumeration value="cornflowerblue"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="linePenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="none"/>
@ -831,6 +855,17 @@
<xs:enumeration value="dashDotDotLine"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="operationPenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="none"/>
<xs:enumeration value="hair"/>
<xs:enumeration value="dashLine"/>
<xs:enumeration value="dotLine"/>
<xs:enumeration value="dashDotLine"/>
<xs:enumeration value="dashDotDotLine"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="curvePenStyle">
<xs:restriction base="xs:string">
<xs:enumeration value="hair"/>

View File

@ -1158,6 +1158,20 @@ QDomElement VPatternRecipe::GroupOperationSource(VAbstractOperation *tool, quint
{
SetAttribute(node, AttrAlias, obj->GetAlias());
}
if (obj->getType() != GOType::Point)
{
if (item.penStyle != TypeLineDefault)
{
SetAttribute(node, AttrPenStyle, item.penStyle);
}
if (item.color != ColorDefault)
{
SetAttribute(node, AttrColor, item.color);
}
}
nodes.appendChild(node);
}

View File

@ -511,3 +511,16 @@ void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar)
edit->setTabStopDistance(tabWidthChar * singleCharWidthDouble);
#endif
}
//---------------------------------------------------------------------------------------------------------------------
QIcon LineColor(int size, const QString &color)
{
// On Mac pixmap should be little bit smaller.
#if defined(Q_OS_MAC)
size -= 2; // Two pixels should be enough.
#endif //defined(Q_OS_MAC)
QPixmap pix(size, size);
pix.fill(QColor(color));
return QIcon(pix);
}

View File

@ -87,5 +87,6 @@ QString DialogWarningIcon();
QFont NodeFont(QFont font, bool nodeExcluded = false);
void CurrentCurveLength(vidtype curveId, VContainer *data);
void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar=4);
QIcon LineColor(int size, const QString &color);
#endif // DIALOGTOOLBOX_H

View File

@ -59,6 +59,7 @@
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "ui_dialogflippingbyaxis.h"
#include "../../tools/drawTools/operation/vabstractoperation.h"
//---------------------------------------------------------------------------------------------------------------------
DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, quint32 toolId, QWidget *parent)
@ -78,6 +79,8 @@ DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, quint32 toolI
FillComboBoxPoints(ui->comboBoxOriginPoint);
FillComboBoxAxisType(ui->comboBoxAxisType);
FillComboBoxTypeLine(ui->comboBoxPenStyle, OperationLineStylesPics(), TypeLineDefault);
FillComboBoxLineColors(ui->comboBoxColor, VAbstractOperation::OperationColorsList());
ui->comboBoxOriginPoint->setCurrentIndex(-1);
@ -88,6 +91,11 @@ DialogFlippingByAxis::DialogFlippingByAxis(const VContainer *data, quint32 toolI
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogFlippingByAxis::ShowSourceDetails);
connect(ui->lineEditAlias, &QLineEdit::textEdited, this, &DialogFlippingByAxis::AliasChanged);
connect(ui->comboBoxPenStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogFlippingByAxis::PenStyleChanged);
connect(ui->comboBoxColor, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogFlippingByAxis::ColorChanged);
vis = new VisToolFlippingByAxis(data);
@ -379,6 +387,8 @@ void DialogFlippingByAxis::GroupNameChanged()
void DialogFlippingByAxis::ShowSourceDetails(int row)
{
ui->lineEditAlias->setDisabled(true);
ui->comboBoxPenStyle->setDisabled(true);
ui->comboBoxColor->setDisabled(true);
if (ui->listWidget->count() == 0)
{
@ -389,15 +399,70 @@ void DialogFlippingByAxis::ShowSourceDetails(int row)
const QSharedPointer<VGObject> obj = data->GetGObject(sourceItem.id);
ui->labelAlias->setText(obj->getType() == GOType::Point ? tr("Label:") : tr("Alias:"));
if (obj->getType() == GOType::Point)
{
ui->labelAlias->setText(tr("Label:"));
ui->comboBoxPenStyle->blockSignals(true);
ui->comboBoxColor->blockSignals(true);
ui->comboBoxPenStyle->setCurrentIndex(-1);
ui->comboBoxColor->setCurrentIndex(-1);
ui->comboBoxPenStyle->blockSignals(false);
ui->comboBoxColor->blockSignals(false);
}
else
{
ui->labelAlias->setText(tr("Alias:"));
auto SetValue = [sourceItem](QComboBox *box, const QString &value, const QString &def)
{
box->blockSignals(true);
int index = box->findData(value);
if (index != -1)
{
box->setCurrentIndex(index);
}
else
{
index = box->findData(def);
box->setCurrentIndex(index);
}
box->blockSignals(false);
};
SetValue(ui->comboBoxPenStyle, sourceItem.penStyle, TypeLineDefault);
if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxPenStyle->currentIndex();
ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>');
}
SetValue(ui->comboBoxColor, sourceItem.color, ColorDefault);
if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxColor->currentIndex();
ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->iconSize().height(), curve->GetColor()));
}
ui->comboBoxPenStyle->setEnabled(true);
ui->comboBoxColor->setEnabled(true);
}
ui->lineEditAlias->blockSignals(true);
ui->lineEditAlias->setText(sourceItem.alias);
ui->lineEditAlias->setEnabled(true);
ui->lineEditAlias->blockSignals(false);
SetAliasValid(sourceItem.id, SourceAliasValid(sourceItem, obj, data,
OriginAlias(sourceItem.id, sourceObjects, obj)));
SetAliasValid(sourceItem.id,
SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -419,6 +484,38 @@ void DialogFlippingByAxis::AliasChanged(const QString &text)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFlippingByAxis::PenStyleChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.penStyle = GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFlippingByAxis::ColorChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.color = GetComboBoxCurrentData(ui->comboBoxColor, ColorDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFlippingByAxis::ShowVisualization()
{

View File

@ -92,6 +92,8 @@ private slots:
void GroupNameChanged();
void ShowSourceDetails(int row);
void AliasChanged(const QString &text);
void PenStyleChanged();
void ColorChanged();
protected:
virtual void ShowVisualization() override;

View File

@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>415</width>
<height>464</height>
<width>423</width>
<height>436</height>
</rect>
</property>
<property name="windowTitle">
<string>Flipping by axis</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -53,6 +53,58 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -203,9 +255,7 @@
<header>vlineedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>

View File

@ -59,6 +59,7 @@
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "ui_dialogflippingbyline.h"
#include "../../tools/drawTools/operation/vabstractoperation.h"
//---------------------------------------------------------------------------------------------------------------------
DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, quint32 toolId, QWidget *parent)
@ -78,6 +79,8 @@ DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, quint32 toolI
FillComboBoxPoints(ui->comboBoxFirstLinePoint);
FillComboBoxPoints(ui->comboBoxSecondLinePoint);
FillComboBoxTypeLine(ui->comboBoxPenStyle, OperationLineStylesPics(), TypeLineDefault);
FillComboBoxLineColors(ui->comboBoxColor, VAbstractOperation::OperationColorsList());
connect(ui->lineEditSuffix, &QLineEdit::textChanged, this, &DialogFlippingByLine::SuffixChanged);
connect(ui->lineEditVisibilityGroup, &QLineEdit::textChanged, this, &DialogFlippingByLine::GroupNameChanged);
@ -85,6 +88,10 @@ DialogFlippingByLine::DialogFlippingByLine(const VContainer *data, quint32 toolI
this, &DialogFlippingByLine::PointChanged);
connect(ui->comboBoxSecondLinePoint, &QComboBox::currentTextChanged,
this, &DialogFlippingByLine::PointChanged);
connect(ui->comboBoxPenStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogFlippingByLine::PenStyleChanged);
connect(ui->comboBoxColor, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogFlippingByLine::ColorChanged);
vis = new VisToolFlippingByLine(data);
@ -399,6 +406,8 @@ void DialogFlippingByLine::GroupNameChanged()
void DialogFlippingByLine::ShowSourceDetails(int row)
{
ui->lineEditAlias->setDisabled(true);
ui->comboBoxPenStyle->setDisabled(true);
ui->comboBoxColor->setDisabled(true);
if (ui->listWidget->count() == 0)
{
@ -409,15 +418,70 @@ void DialogFlippingByLine::ShowSourceDetails(int row)
const QSharedPointer<VGObject> obj = data->GetGObject(sourceItem.id);
ui->labelAlias->setText(obj->getType() == GOType::Point ? tr("Label:") : tr("Alias:"));
if (obj->getType() == GOType::Point)
{
ui->labelAlias->setText(tr("Label:"));
ui->comboBoxPenStyle->blockSignals(true);
ui->comboBoxColor->blockSignals(true);
ui->comboBoxPenStyle->setCurrentIndex(-1);
ui->comboBoxColor->setCurrentIndex(-1);
ui->comboBoxPenStyle->blockSignals(false);
ui->comboBoxColor->blockSignals(false);
}
else
{
ui->labelAlias->setText(tr("Alias:"));
auto SetValue = [sourceItem](QComboBox *box, const QString &value, const QString &def)
{
box->blockSignals(true);
int index = box->findData(value);
if (index != -1)
{
box->setCurrentIndex(index);
}
else
{
index = box->findData(def);
box->setCurrentIndex(index);
}
box->blockSignals(false);
};
SetValue(ui->comboBoxPenStyle, sourceItem.penStyle, TypeLineDefault);
if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxPenStyle->currentIndex();
ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>');
}
SetValue(ui->comboBoxColor, sourceItem.color, ColorDefault);
if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxColor->currentIndex();
ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->iconSize().height(), curve->GetColor()));
}
ui->comboBoxPenStyle->setEnabled(true);
ui->comboBoxColor->setEnabled(true);
}
ui->lineEditAlias->blockSignals(true);
ui->lineEditAlias->setText(sourceItem.alias);
ui->lineEditAlias->setEnabled(true);
ui->lineEditAlias->blockSignals(false);
SetAliasValid(sourceItem.id, SourceAliasValid(sourceItem, obj, data,
OriginAlias(sourceItem.id, sourceObjects, obj)));
SetAliasValid(sourceItem.id,
SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -439,6 +503,38 @@ void DialogFlippingByLine::AliasChanged(const QString &text)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFlippingByLine::PenStyleChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.penStyle = GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFlippingByLine::ColorChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.color = GetComboBoxCurrentData(ui->comboBoxColor, ColorDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogFlippingByLine::ShowVisualization()
{

View File

@ -92,6 +92,8 @@ private slots:
void GroupNameChanged();
void ShowSourceDetails(int row);
void AliasChanged(const QString &text);
void PenStyleChanged();
void ColorChanged();
protected:
virtual void ShowVisualization() override;

View File

@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>387</width>
<height>440</height>
<width>424</width>
<height>436</height>
</rect>
</property>
<property name="windowTitle">
<string>Flipping by line</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -53,6 +53,58 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -203,9 +255,7 @@
<header>vlineedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>

View File

@ -64,6 +64,7 @@
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "ui_dialogmove.h"
#include "../../tools/drawTools/operation/vabstractoperation.h"
//---------------------------------------------------------------------------------------------------------------------
DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
@ -112,6 +113,8 @@ DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
InitOkCancelApply(ui);
FillComboBoxTypeLine(ui->comboBoxPenStyle, OperationLineStylesPics(), TypeLineDefault);
FillComboBoxLineColors(ui->comboBoxColor, VAbstractOperation::OperationColorsList());
FillComboBoxPoints(ui->comboBoxRotationOriginPoint);
ui->comboBoxRotationOriginPoint->blockSignals(true);
@ -144,6 +147,9 @@ DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogMove::ShowSourceDetails);
connect(ui->lineEditAlias, &QLineEdit::textEdited, this, &DialogMove::AliasChanged);
connect(ui->comboBoxPenStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogMove::PenStyleChanged);
connect(ui->comboBoxColor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DialogMove::ColorChanged);
vis = new VisToolMove(data);
@ -563,6 +569,8 @@ void DialogMove::GroupNameChanged()
void DialogMove::ShowSourceDetails(int row)
{
ui->lineEditAlias->setDisabled(true);
ui->comboBoxPenStyle->setDisabled(true);
ui->comboBoxColor->setDisabled(true);
if (ui->listWidget->count() == 0)
{
@ -573,15 +581,70 @@ void DialogMove::ShowSourceDetails(int row)
const QSharedPointer<VGObject> obj = data->GetGObject(sourceItem.id);
ui->labelAlias->setText(obj->getType() == GOType::Point ? tr("Label:") : tr("Alias:"));
if (obj->getType() == GOType::Point)
{
ui->labelAlias->setText(tr("Label:"));
ui->comboBoxPenStyle->blockSignals(true);
ui->comboBoxColor->blockSignals(true);
ui->comboBoxPenStyle->setCurrentIndex(-1);
ui->comboBoxColor->setCurrentIndex(-1);
ui->comboBoxPenStyle->blockSignals(false);
ui->comboBoxColor->blockSignals(false);
}
else
{
ui->labelAlias->setText(tr("Alias:"));
auto SetValue = [sourceItem](QComboBox *box, const QString &value, const QString &def)
{
box->blockSignals(true);
int index = box->findData(value);
if (index != -1)
{
box->setCurrentIndex(index);
}
else
{
index = box->findData(def);
box->setCurrentIndex(index);
}
box->blockSignals(false);
};
SetValue(ui->comboBoxPenStyle, sourceItem.penStyle, TypeLineDefault);
if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxPenStyle->currentIndex();
ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>');
}
SetValue(ui->comboBoxColor, sourceItem.color, ColorDefault);
if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxColor->currentIndex();
ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->iconSize().height(), curve->GetColor()));
}
ui->comboBoxPenStyle->setEnabled(true);
ui->comboBoxColor->setEnabled(true);
}
ui->lineEditAlias->blockSignals(true);
ui->lineEditAlias->setText(sourceItem.alias);
ui->lineEditAlias->setEnabled(true);
ui->lineEditAlias->blockSignals(false);
SetAliasValid(sourceItem.id, SourceAliasValid(sourceItem, obj, data,
OriginAlias(sourceItem.id, sourceObjects, obj)));
SetAliasValid(sourceItem.id,
SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -603,6 +666,38 @@ void DialogMove::AliasChanged(const QString &text)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMove::PenStyleChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.penStyle = GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMove::ColorChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.color = GetComboBoxCurrentData(ui->comboBoxColor, ColorDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMove::ShowVisualization()
{

View File

@ -107,6 +107,8 @@ private slots:
void ShowSourceDetails(int row);
void AliasChanged(const QString &text);
void PenStyleChanged();
void ColorChanged();
protected:
virtual void ShowVisualization() override;

View File

@ -9,15 +9,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>536</width>
<height>669</height>
<width>456</width>
<height>625</height>
</rect>
</property>
<property name="windowTitle">
<string>Move</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -60,6 +60,58 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -138,7 +190,7 @@
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
@ -155,7 +207,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
<pixmap>:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
@ -318,7 +370,7 @@
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
@ -335,7 +387,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
<pixmap>:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
@ -498,7 +550,7 @@
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
@ -515,7 +567,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
<pixmap>:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
@ -750,9 +802,7 @@
<header>vlineedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>

View File

@ -64,6 +64,7 @@
#include "../vwidgets/vmaingraphicsscene.h"
#include "../vwidgets/vmaingraphicsview.h"
#include "ui_dialogrotation.h"
#include "../../tools/drawTools/operation/vabstractoperation.h"
//---------------------------------------------------------------------------------------------------------------------
DialogRotation::DialogRotation(const VContainer *data, quint32 toolId, QWidget *parent)
@ -93,6 +94,8 @@ DialogRotation::DialogRotation(const VContainer *data, quint32 toolId, QWidget *
InitOkCancelApply(ui);
FillComboBoxPoints(ui->comboBoxOriginPoint);
FillComboBoxTypeLine(ui->comboBoxPenStyle, OperationLineStylesPics(), TypeLineDefault);
FillComboBoxLineColors(ui->comboBoxColor, VAbstractOperation::OperationColorsList());
connect(ui->lineEditSuffix, &QLineEdit::textChanged, this, &DialogRotation::SuffixChanged);
connect(ui->lineEditVisibilityGroup, &QLineEdit::textChanged, this, &DialogRotation::GroupNameChanged);
@ -104,6 +107,10 @@ DialogRotation::DialogRotation(const VContainer *data, quint32 toolId, QWidget *
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogRotation::DeployAngleTextEdit);
connect(ui->comboBoxOriginPoint, &QComboBox::currentTextChanged,
this, &DialogRotation::PointChanged);
connect(ui->comboBoxPenStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogRotation::PenStyleChanged);
connect(ui->comboBoxColor, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&DialogRotation::ColorChanged);
vis = new VisToolRotation(data);
@ -638,6 +645,8 @@ void DialogRotation::EvalAngle()
void DialogRotation::ShowSourceDetails(int row)
{
ui->lineEditAlias->setDisabled(true);
ui->comboBoxPenStyle->setDisabled(true);
ui->comboBoxColor->setDisabled(true);
if (ui->listWidget->count() == 0)
{
@ -648,15 +657,70 @@ void DialogRotation::ShowSourceDetails(int row)
const QSharedPointer<VGObject> obj = data->GetGObject(sourceItem.id);
ui->labelAlias->setText(obj->getType() == GOType::Point ? tr("Label:") : tr("Alias:"));
if (obj->getType() == GOType::Point)
{
ui->labelAlias->setText(tr("Label:"));
ui->comboBoxPenStyle->blockSignals(true);
ui->comboBoxColor->blockSignals(true);
ui->comboBoxPenStyle->setCurrentIndex(-1);
ui->comboBoxColor->setCurrentIndex(-1);
ui->comboBoxPenStyle->blockSignals(false);
ui->comboBoxColor->blockSignals(false);
}
else
{
ui->labelAlias->setText(tr("Alias:"));
auto SetValue = [sourceItem](QComboBox *box, const QString &value, const QString &def)
{
box->blockSignals(true);
int index = box->findData(value);
if (index != -1)
{
box->setCurrentIndex(index);
}
else
{
index = box->findData(def);
box->setCurrentIndex(index);
}
box->blockSignals(false);
};
SetValue(ui->comboBoxPenStyle, sourceItem.penStyle, TypeLineDefault);
if (sourceItem.penStyle.isEmpty() || sourceItem.penStyle == TypeLineDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxPenStyle->currentIndex();
ui->comboBoxPenStyle->setItemText(index, '<' + tr("Default") + '>');
}
SetValue(ui->comboBoxColor, sourceItem.color, ColorDefault);
if (sourceItem.color.isEmpty() || sourceItem.color == ColorDefault)
{
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(sourceItem.id);
int index = ui->comboBoxColor->currentIndex();
ui->comboBoxColor->setItemIcon(index, LineColor(ui->comboBoxColor->iconSize().height(), curve->GetColor()));
}
ui->comboBoxPenStyle->setEnabled(true);
ui->comboBoxColor->setEnabled(true);
}
ui->lineEditAlias->blockSignals(true);
ui->lineEditAlias->setText(sourceItem.alias);
ui->lineEditAlias->setEnabled(true);
ui->lineEditAlias->blockSignals(false);
SetAliasValid(sourceItem.id, SourceAliasValid(sourceItem, obj, data,
OriginAlias(sourceItem.id, sourceObjects, obj)));
SetAliasValid(sourceItem.id,
SourceAliasValid(sourceItem, obj, data, OriginAlias(sourceItem.id, sourceObjects, obj)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -678,6 +742,38 @@ void DialogRotation::AliasChanged(const QString &text)
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogRotation::PenStyleChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.penStyle = GetComboBoxCurrentData(ui->comboBoxPenStyle, TypeLineDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogRotation::ColorChanged()
{
if (ui->listWidget->count() == 0)
{
return;
}
if (auto *item = ui->listWidget->currentItem())
{
auto sourceItem = qvariant_cast<SourceItem>(item->data(Qt::UserRole));
sourceItem.color = GetComboBoxCurrentData(ui->comboBoxColor, ColorDefault);
item->setData(Qt::UserRole, QVariant::fromValue(sourceItem));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogRotation::SetNotes(const QString &notes)
{

View File

@ -94,6 +94,8 @@ private slots:
void EvalAngle();
void ShowSourceDetails(int row);
void AliasChanged(const QString &text);
void PenStyleChanged();
void ColorChanged();
protected:
virtual void ShowVisualization() override;

View File

@ -6,15 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>485</height>
<width>408</width>
<height>461</height>
</rect>
</property>
<property name="windowTitle">
<string>Rotation</string>
</property>
<property name="windowIcon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -53,6 +53,58 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Pen style:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxPenStyle">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Color:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxColor">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -131,7 +183,7 @@
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../../vmisc/share/resources/icon.qrc">
<iconset>
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property>
<property name="iconSize">
@ -148,7 +200,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
<pixmap>:/icon/24x24/equal.png</pixmap>
</property>
</widget>
</item>
@ -374,9 +426,7 @@
<header>vlineedit.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../vmisc/share/resources/icon.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>

View File

@ -270,7 +270,7 @@ void DialogTool::FillComboBoxCurves(QComboBox *box) const
* @brief FillComboBoxTypeLine fill comboBox list of type lines
* @param box comboBox
*/
void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const
void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics, const QString &def) const
{
SCASSERT(box != nullptr)
QMap<QString, QIcon>::const_iterator i = stylesPics.constBegin();
@ -280,7 +280,7 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon>
++i;
}
const int index = box->findData(QVariant(TypeLineLine));
const int index = box->findData(QVariant(def));
if (index != -1)
{
box->setCurrentIndex(index);
@ -289,23 +289,21 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon>
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxLineColors(QComboBox *box) const
{
FillComboBoxLineColors(box, VAbstractTool::ColorsList());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::FillComboBoxLineColors(QComboBox *box, const QMap<QString, QString> &lineColors) const
{
SCASSERT(box != nullptr)
box->clear();
int size = box->iconSize().height();
// On Mac pixmap should be little bit smaller.
#if defined(Q_OS_MAC)
size -= 2; // Two pixels should be enough.
#endif //defined(Q_OS_MAC)
const QMap<QString, QString> map = VAbstractTool::ColorsList();
QMap<QString, QString>::const_iterator i = map.constBegin();
while (i != map.constEnd())
QMap<QString, QString>::const_iterator i = lineColors.constBegin();
while (i != lineColors.constEnd())
{
QPixmap pix(size, size);
pix.fill(QColor(i.key()));
box->addItem(QIcon(pix), i.value(), QVariant(i.key()));
box->addItem(LineColor(box->iconSize().height(), i.key()), i.value(), QVariant(i.key()));
++i;
}
}

View File

@ -165,8 +165,10 @@ protected:
void FillComboBoxSplines(QComboBox *box)const;
void FillComboBoxSplinesPath(QComboBox *box)const;
void FillComboBoxCurves(QComboBox *box)const;
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics) const;
void FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon> &stylesPics,
const QString &def=TypeLineLine) const;
void FillComboBoxLineColors(QComboBox *box)const;
void FillComboBoxLineColors(QComboBox *box, const QMap<QString, QString> &lineColors)const;
void FillComboBoxCrossCirclesPoints(QComboBox *box) const;
void FillComboBoxVCrossCurvesPoint(QComboBox *box) const;
void FillComboBoxHCrossCurvesPoint(QComboBox *box) const;

View File

@ -93,6 +93,16 @@ DestinationItem VAbstractFlipping::CreateItem(quint32 idTool, const SourceItem &
rotated.SetAliasSuffix(sItem.alias);
}
if (sItem.penStyle != TypeLineDefault)
{
rotated.SetPenStyle(sItem.penStyle);
}
if (sItem.color != ColorDefault)
{
rotated.SetColor(sItem.color);
}
DestinationItem item;
item.id = data->AddGObject(new Item(rotated));
return item;
@ -133,6 +143,16 @@ void VAbstractFlipping::UpdateItem(quint32 idTool, const SourceItem &sItem, cons
rotated.SetAliasSuffix(sItem.alias);
}
if (sItem.penStyle != TypeLineDefault)
{
rotated.SetPenStyle(sItem.penStyle);
}
if (sItem.color != ColorDefault)
{
rotated.SetColor(sItem.color);
}
data->UpdateGObject(id, new Item(rotated));
}

View File

@ -208,6 +208,8 @@ QVector<SourceItem> VAbstractOperation::ExtractSourceData(const QDomElement &dom
SourceItem item;
item.id = VDomDocument::GetParametrUInt(element, AttrIdObject, NULL_ID_STR);
item.alias = VDomDocument::GetParametrEmptyString(element, AttrAlias);
item.penStyle = VDomDocument::GetParametrString(element, AttrPenStyle, TypeLineDefault);
item.color = VDomDocument::GetParametrString(element, AttrColor, ColorDefault);
source.append(item);
}
}
@ -250,6 +252,14 @@ QVector<DestinationItem> VAbstractOperation::ExtractDestinationData(const QDomEl
return destination;
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QString> VAbstractOperation::OperationColorsList()
{
QMap<QString, QString> list = VAbstractTool::ColorsList();
list.insert(ColorDefault, '<' + tr("default") + '>');
return list;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractOperation::FullUpdateFromFile()
{
@ -728,6 +738,8 @@ void VAbstractOperation::SaveSourceDestination(QDomElement &tag)
QDomElement item = doc->createElement(TagItem);
doc->SetAttribute(item, AttrIdObject, sItem.id);
doc->SetAttributeOrRemoveIf(item, AttrAlias, sItem.alias, sItem.alias.isEmpty());
doc->SetAttributeOrRemoveIf(item, AttrPenStyle, sItem.penStyle, sItem.penStyle == TypeLineDefault);
doc->SetAttributeOrRemoveIf(item, AttrColor, sItem.color, sItem.color == ColorDefault);
tagObjects.appendChild(item);
}
tag.appendChild(tagObjects);

View File

@ -98,6 +98,8 @@ public:
static void ExtractData(const QDomElement &domElement, VAbstractOperationInitData &initData);
static QVector<SourceItem> ExtractSourceData(const QDomElement &domElement);
static QVector<DestinationItem> ExtractDestinationData(const QDomElement &domElement);
static QMap<QString, QString> OperationColorsList();
public slots:
virtual void FullUpdateFromFile() override;

View File

@ -628,6 +628,16 @@ DestinationItem VToolMove::CreateItem(quint32 idTool, const SourceItem &sItem, q
moved.SetAliasSuffix(sItem.alias);
}
if (sItem.penStyle != TypeLineDefault)
{
moved.SetPenStyle(sItem.penStyle);
}
if (sItem.color != ColorDefault)
{
moved.SetColor(sItem.color);
}
DestinationItem item;
item.id = data->AddGObject(new Item(moved));
return item;
@ -672,6 +682,16 @@ void VToolMove::UpdateItem(quint32 idTool, const SourceItem &sItem, qreal angle,
moved.SetAliasSuffix(sItem.alias);
}
if (sItem.penStyle != TypeLineDefault)
{
moved.SetPenStyle(sItem.penStyle);
}
if (sItem.color != ColorDefault)
{
moved.SetColor(sItem.color);
}
data->UpdateGObject(id, new Item(moved));
}

View File

@ -439,6 +439,16 @@ DestinationItem VToolRotation::CreateItem(quint32 idTool, const SourceItem &sIte
rotated.SetAliasSuffix(sItem.alias);
}
if (sItem.penStyle != TypeLineDefault)
{
rotated.SetPenStyle(sItem.penStyle);
}
if (sItem.color != ColorDefault)
{
rotated.SetColor(sItem.color);
}
DestinationItem item;
item.id = data->AddGObject(new Item(rotated));
return item;
@ -507,6 +517,16 @@ void VToolRotation::UpdateItem(quint32 idTool, const SourceItem &sItem, const QP
rotated.SetAliasSuffix(sItem.alias);
}
if (sItem.penStyle != TypeLineDefault)
{
rotated.SetPenStyle(sItem.penStyle);
}
if (sItem.color != ColorDefault)
{
rotated.SetColor(sItem.color);
}
data->UpdateGObject(id, new Item(rotated));
}

View File

@ -28,6 +28,11 @@
#include "toolsdef.h"
#include <QBrush>
#include <QIcon>
#include <QPainter>
#include <QPen>
#include <QPixmap>
#include <QRegularExpression>
#include <QVector>
@ -103,3 +108,11 @@ QString OriginAlias(quint32 id, const QVector<SourceItem> &source, const QShared
return QString();
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QIcon> OperationLineStylesPics()
{
QMap<QString, QIcon> map = LineStylesPics();
map.insert(TypeLineDefault, QIcon());
return map;
}

View File

@ -38,6 +38,8 @@ struct SourceItem
{
quint32 id{0};
QString alias{};
QString penStyle{};
QString color{};
};
Q_DECLARE_METATYPE(SourceItem)
@ -50,4 +52,6 @@ QString OriginAlias(quint32 id, const QVector<SourceItem> &source, const QShared
bool SourceAliasValid(const SourceItem &item, const QSharedPointer<VGObject> &obj, const VContainer *data,
const QString &originAlias);
QMap<QString, QIcon> OperationLineStylesPics();
#endif // TOOLSDEF_H

View File

@ -273,13 +273,25 @@ int VAbstractTool::ConfirmDeletion()
//---------------------------------------------------------------------------------------------------------------------
const QStringList VAbstractTool::Colors()
{
const QStringList colors = QStringList() << ColorBlack << ColorGreen << ColorBlue
<< ColorDarkRed << ColorDarkGreen << ColorDarkBlue
<< ColorYellow << ColorLightSalmon << ColorGoldenRod
<< ColorOrange << ColorDeepPink << ColorViolet
<< ColorDarkViolet << ColorMediumSeaGreen << ColorLime
<< ColorDeepSkyBlue << ColorCornFlowerBlue;
return colors;
return QStringList {
ColorBlack,
ColorGreen,
ColorBlue,
ColorDarkRed,
ColorDarkGreen,
ColorDarkBlue,
ColorYellow,
ColorLightSalmon,
ColorGoldenRod,
ColorOrange,
ColorDeepPink,
ColorViolet,
ColorDarkViolet,
ColorMediumSeaGreen,
ColorLime,
ColorDeepSkyBlue,
ColorCornFlowerBlue
};
}
//---------------------------------------------------------------------------------------------------------------------