LibreCAD
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
LinePatternPathPart Class Reference

Model used to construct line pattern path. More...

#include <linepatternpathpart.h>

Inheritance diagram for LinePatternPathPart:
Collaboration diagram for LinePatternPathPart:

Public Types

enum  PathType { PATH_PLAIN, PATH_SPACE, PATH_DOT }
 

Signals

void update ()
 

Public Member Functions

 LinePatternPathPart (QWidget *parent=0)
 Create empty model. More...
 
 LinePatternPathPart (double value, QWidget *parent=0)
 Create model pre-filled with value. More...
 
PathType type ()
 Return type (plain, space or dot) More...
 
double value ()
 Return length. More...
 

Private Slots

void onTypeChanged (const QString &value)
 
void onValueChanged (double value)
 

Private Attributes

Ui::LinePatternPathPart * ui
 

Detailed Description

Model used to construct line pattern path.

Definition at line 18 of file linepatternpathpart.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

LinePatternPathPart::LinePatternPathPart ( QWidget *  parent = 0)

Create empty model.

Parameters
parentPointer to parent widget

Definition at line 6 of file linepatternpathpart.cpp.

6  :
7  LinePatternPathPart(1, parent) {
8 }
LinePatternPathPart(QWidget *parent=0)
Create empty model.
LinePatternPathPart::LinePatternPathPart ( double  value,
QWidget *  parent = 0 
)

Create model pre-filled with value.

Parameters
valueDXF size
parentPointer to parent widget

Definition at line 10 of file linepatternpathpart.cpp.

10  :
11  QWidget(parent),
12  ui(new Ui::LinePatternPathPart) {
13 
14  ui->setupUi(this);
15 
16  ui->type->addItem(PATH_PLAIN_NAME);
17  ui->type->addItem(PATH_DOT_NAME);
18  ui->type->addItem(PATH_SPACE_NAME);
19 
20  ui->value->setValue(std::fabs(value));
21 
22  int typeIndex;
23  if(value == 0) {
24  typeIndex = ui->type->findText(PATH_DOT_NAME);
25  ui->value->setDisabled(true);
26  }
27  else if(value > 0) {
28  typeIndex = ui->type->findText(PATH_PLAIN_NAME);
29  }
30  else {
31  typeIndex = ui->type->findText(PATH_SPACE_NAME);
32  }
33 
34 
35  if (typeIndex != -1) {
36  ui->type->setCurrentIndex(typeIndex);
37  }
38 
39  connect(ui->type, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onTypeChanged(const QString&)));
40  connect(ui->value, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
41 }
#define PATH_DOT_NAME
double value()
Return length.
Ui::LinePatternPathPart * ui
void onTypeChanged(const QString &value)
void onValueChanged(double value)
#define PATH_SPACE_NAME
#define PATH_PLAIN_NAME

Member Function Documentation

void LinePatternPathPart::onTypeChanged ( const QString &  value)
privateslot

Definition at line 61 of file linepatternpathpart.cpp.

61  {
62  if(ui->type->currentText() == PATH_DOT_NAME) {
63  ui->value->setValue(0);
64  ui->value->setDisabled(true);
65  }
66  else {
67  ui->value->setValue(1);
68  ui->value->setDisabled(false);
69  }
70 
71  emit update();
72 }
#define PATH_DOT_NAME
Ui::LinePatternPathPart * ui
void LinePatternPathPart::onValueChanged ( double  value)
privateslot

Definition at line 74 of file linepatternpathpart.cpp.

74  {
75  emit update();
76 }
LinePatternPathPart::PathType LinePatternPathPart::type ( )

Return type (plain, space or dot)

Returns
PATH_PLAIN, PATH_SPACE or PATH_DOT

Definition at line 43 of file linepatternpathpart.cpp.

43  {
44  if(ui->type->currentText() == PATH_PLAIN_NAME) {
45  return PATH_PLAIN;
46  }
47  else if(ui->type->currentText() == PATH_DOT_NAME) {
48  return PATH_DOT;
49  }
50  else if(ui->type->currentText() == PATH_SPACE_NAME) {
51  return PATH_SPACE;
52  }
53 
54  return PATH_PLAIN;
55 }
#define PATH_DOT_NAME
Ui::LinePatternPathPart * ui
#define PATH_SPACE_NAME
#define PATH_PLAIN_NAME
void LinePatternPathPart::update ( )
signal
double LinePatternPathPart::value ( )

Return length.

Returns
length (always positive)

Definition at line 57 of file linepatternpathpart.cpp.

57  {
58  return ui->value->value();
59 }
Ui::LinePatternPathPart * ui

Member Data Documentation

Ui::LinePatternPathPart* LinePatternPathPart::ui
private

Definition at line 59 of file linepatternpathpart.h.


The documentation for this class was generated from the following files: