Test combobox that show colors.
--HG-- branch : feature
This commit is contained in:
parent
de1c9d8a77
commit
e2fab3345a
|
@ -64,6 +64,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, const quint32 &toolId, QWid
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxBasePoint);
|
FillComboBoxPoints(ui->comboBoxBasePoint);
|
||||||
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
|
||||||
|
FillComboBoxLineColors(ui->comboBoxLineColor);
|
||||||
|
|
||||||
connect(ui->toolButtonPutHereLength, &QPushButton::clicked, this, &DialogEndLine::PutHere);
|
connect(ui->toolButtonPutHereLength, &QPushButton::clicked, this, &DialogEndLine::PutHere);
|
||||||
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogEndLine::PutAngle);
|
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogEndLine::PutAngle);
|
||||||
|
|
|
@ -409,6 +409,9 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -477,6 +480,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Line color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -301,6 +301,50 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box, const QMap<QString, QIcon>
|
||||||
box->setCurrentIndex(1);
|
box->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogTool::FillComboBoxLineColors(QComboBox *box) const
|
||||||
|
{
|
||||||
|
SCASSERT(box != nullptr);
|
||||||
|
|
||||||
|
const QStringList colorNames = VAbstractTool::Colors();
|
||||||
|
|
||||||
|
for (int i = 0; i < colorNames.size(); ++i)
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 0: // ColorBlack
|
||||||
|
name = tr("black");
|
||||||
|
break;
|
||||||
|
case 1: // ColorGreen
|
||||||
|
name = tr("green");
|
||||||
|
break;
|
||||||
|
case 2: // ColorBlue
|
||||||
|
name = tr("blue");
|
||||||
|
break;
|
||||||
|
case 3: // ColorDarkRed
|
||||||
|
name = tr("dark red");
|
||||||
|
break;
|
||||||
|
case 4: // ColorDarkGreen
|
||||||
|
name = tr("dark green");
|
||||||
|
break;
|
||||||
|
case 5: // ColorDarkBlue
|
||||||
|
name = tr("dark blue");
|
||||||
|
break;
|
||||||
|
case 6: // ColorYellow
|
||||||
|
name = tr("yellow");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
name = tr("black");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap pix(16, 16);
|
||||||
|
pix.fill(QColor(colorNames.at(i)));
|
||||||
|
box->insertItem(i, QIcon(pix), name, QVariant(colorNames.at(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief getTypeLine return type of line
|
* @brief getTypeLine return type of line
|
||||||
|
@ -318,6 +362,18 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogTool::GetLineColor(const QComboBox *box) const
|
||||||
|
{
|
||||||
|
SCASSERT(box != nullptr)
|
||||||
|
QString value = box->currentData().toString();
|
||||||
|
if (value.isEmpty())
|
||||||
|
{
|
||||||
|
value = VAbstractTool::ColorBlack;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SetupTypeLine setupe type of line
|
* @brief SetupTypeLine setupe type of line
|
||||||
|
|
|
@ -216,6 +216,7 @@ protected:
|
||||||
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline)const;
|
ComboBoxCutSpline cut = ComboBoxCutSpline::NoCutSpline)const;
|
||||||
void FillComboBoxCurves(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;
|
||||||
|
void FillComboBoxLineColors(QComboBox *box)const;
|
||||||
virtual void CheckState();
|
virtual void CheckState();
|
||||||
QString GetTypeLine(const QComboBox *box)const;
|
QString GetTypeLine(const QComboBox *box)const;
|
||||||
template <class key, class val>
|
template <class key, class val>
|
||||||
|
|
|
@ -85,8 +85,8 @@ const QString VAbstractTool::ColorGreen = QStringLiteral("green");
|
||||||
const QString VAbstractTool::ColorBlue = QStringLiteral("blue");
|
const QString VAbstractTool::ColorBlue = QStringLiteral("blue");
|
||||||
const QString VAbstractTool::ColorDarkRed = QStringLiteral("darkRed");
|
const QString VAbstractTool::ColorDarkRed = QStringLiteral("darkRed");
|
||||||
const QString VAbstractTool::ColorDarkGreen = QStringLiteral("darkGreen");
|
const QString VAbstractTool::ColorDarkGreen = QStringLiteral("darkGreen");
|
||||||
const QString VAbstractTool::ColorDarkBlue = QStringLiteral("DarkBlue");
|
const QString VAbstractTool::ColorDarkBlue = QStringLiteral("darkBlue");
|
||||||
const QString VAbstractTool::ColorYellow = QStringLiteral("Yellow");
|
const QString VAbstractTool::ColorYellow = QStringLiteral("yellow");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,6 +86,9 @@ public:
|
||||||
static const QString AttrAxisP1;
|
static const QString AttrAxisP1;
|
||||||
static const QString AttrAxisP2;
|
static const QString AttrAxisP2;
|
||||||
static const QString AttrCurve;
|
static const QString AttrCurve;
|
||||||
|
static const QString AttrLineColor;
|
||||||
|
static const QString AttrColor;
|
||||||
|
|
||||||
static const QString TypeLineNone;
|
static const QString TypeLineNone;
|
||||||
static const QString TypeLineLine;
|
static const QString TypeLineLine;
|
||||||
static const QString TypeLineDashLine;
|
static const QString TypeLineDashLine;
|
||||||
|
@ -93,10 +96,20 @@ public:
|
||||||
static const QString TypeLineDashDotLine;
|
static const QString TypeLineDashDotLine;
|
||||||
static const QString TypeLineDashDotDotLine;
|
static const QString TypeLineDashDotDotLine;
|
||||||
|
|
||||||
|
static const QString ColorBlack;
|
||||||
|
static const QString ColorGreen;
|
||||||
|
static const QString ColorBlue;
|
||||||
|
static const QString ColorDarkRed;
|
||||||
|
static const QString ColorDarkGreen;
|
||||||
|
static const QString ColorDarkBlue;
|
||||||
|
static const QString ColorYellow;
|
||||||
|
|
||||||
static const QStringList StylesList();
|
static const QStringList StylesList();
|
||||||
static Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
|
static Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
|
||||||
static QMap<QString, QIcon> LineStylesPics();
|
static QMap<QString, QIcon> LineStylesPics();
|
||||||
|
|
||||||
|
static const QStringList Colors();
|
||||||
|
|
||||||
static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc);
|
static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc);
|
||||||
|
|
||||||
const VContainer *getData() const;
|
const VContainer *getData() const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user