2 #include "ui_addlinepatterndialog.h"
12 _oldLinePattern(linePattern) {
16 _layout =
static_cast<QVBoxLayout*
>(
ui->pathList->layout());
18 throw "Unable to cast AddLinePatternDialog pathList layout to QVBoxLayout";
21 if(linePattern !=
nullptr) {
22 ui->name->setText(linePattern->name().c_str());
23 ui->description->setText(linePattern->description().c_str());
25 for (
auto value : linePattern->path()) {
41 std::string name =
ui->name->text().toStdString();
46 std::vector<double> path;
49 auto parts = findChildren<LinePatternPathPart*>();
51 for(
auto part : parts) {
52 auto type = part->type();
53 auto value = part->value();
61 path.push_back(value);
66 path.push_back(-value);
72 _linePattern = std::make_shared<lc::DxfLinePatternByValue>(
74 ui->description->text().toStdString(),
78 QPixmap previewPixmap(
ui->preview->frameSize());
81 painter.drawLinePattern();
83 ui->preview->setPixmap(previewPixmap);
100 operation->execute();
107 operation->execute();
Model used to construct line pattern path.
void on_saveButton_pressed()
Save Save the line pattern in the document and close the dialog.
void onEditButtonPressed()
Edit Replace the original line pattern with the new one and close the dialog.
lc::DxfLinePatternByValue_CSPtr _linePattern
AddLinePatternDialog(lc::Document_SPtr document, QWidget *parent=0)
Create empty dialog.
void on_cancelButton_pressed()
Cancel Close the dialog.
void on_newValueButton_pressed()
Create a new entry for the pattern path.
void generatePreview()
Generate line pattern preview Create a new QPixmap with a preview of the line pattern and add it in t...
lc::DxfLinePatternByValue_CSPtr _oldLinePattern
lc::Document_SPtr _document
Create a dialog with all required fields to create a new line pattern.
Painting line patterns on a QPaintDevice.
Ui::AddLinePatternDialog * ui