##// END OF EJS Templates
minor.typo
Michal Klocek -
r292:a611478e7e73
parent child
Show More
@@ -1,145 +1,145
1 #include "dataseriedialog.h"
1 #include "dataseriedialog.h"
2 #include <QDialogButtonBox>
2 #include <QDialogButtonBox>
3 #include <QGridLayout>
3 #include <QGridLayout>
4 #include <QCheckbox>
4 #include <QCheckBox>
5 #include <QPushButton>
5 #include <QPushButton>
6 #include <QGroupBox>
6 #include <QGroupBox>
7 #include <QRadioButton>
7 #include <QRadioButton>
8 #include <QLabel>
8 #include <QLabel>
9 #include <QDebug>
9 #include <QDebug>
10
10
11 DataSerieDialog::DataSerieDialog(QString defaultType, QWidget *parent) :
11 DataSerieDialog::DataSerieDialog(QString defaultType, QWidget *parent) :
12 QDialog(parent)
12 QDialog(parent)
13 {
13 {
14 QDialogButtonBox *addSeriesBox = new QDialogButtonBox(Qt::Horizontal);
14 QDialogButtonBox *addSeriesBox = new QDialogButtonBox(Qt::Horizontal);
15 QPushButton *b = addSeriesBox->addButton(QDialogButtonBox::Ok);
15 QPushButton *b = addSeriesBox->addButton(QDialogButtonBox::Ok);
16 connect(b, SIGNAL(clicked()), this, SLOT(accept()));
16 connect(b, SIGNAL(clicked()), this, SLOT(accept()));
17 b = addSeriesBox->addButton(QDialogButtonBox::Cancel);
17 b = addSeriesBox->addButton(QDialogButtonBox::Cancel);
18 connect(b, SIGNAL(clicked()), this, SLOT(reject()));
18 connect(b, SIGNAL(clicked()), this, SLOT(reject()));
19
19
20 QGridLayout *grid = new QGridLayout();
20 QGridLayout *grid = new QGridLayout();
21
21
22 m_seriesTypeSelector = seriesTypeSelector();
22 m_seriesTypeSelector = seriesTypeSelector();
23 m_columnCountSelector = columnCountSelector();
23 m_columnCountSelector = columnCountSelector();
24 m_rowCountSelector = rowCountSelector();
24 m_rowCountSelector = rowCountSelector();
25 m_dataCharacteristicsSelector = dataCharacteristicsSelector();
25 m_dataCharacteristicsSelector = dataCharacteristicsSelector();
26
26
27 grid->addWidget(m_seriesTypeSelector, 0, 0);
27 grid->addWidget(m_seriesTypeSelector, 0, 0);
28 grid->addWidget(m_columnCountSelector, 0, 1);
28 grid->addWidget(m_columnCountSelector, 0, 1);
29 grid->addWidget(m_rowCountSelector, 1, 1);
29 grid->addWidget(m_rowCountSelector, 1, 1);
30 grid->addWidget(m_dataCharacteristicsSelector, 1, 0);
30 grid->addWidget(m_dataCharacteristicsSelector, 1, 0);
31 m_labelsSelector = new QCheckBox("Labels defined");
31 m_labelsSelector = new QCheckBox("Labels defined");
32 m_labelsSelector->setChecked(true);
32 m_labelsSelector->setChecked(true);
33 grid->addWidget(m_labelsSelector, 2, 0);
33 grid->addWidget(m_labelsSelector, 2, 0);
34 grid->addWidget(addSeriesBox, 3, 1);
34 grid->addWidget(addSeriesBox, 3, 1);
35
35
36 setLayout(grid);
36 setLayout(grid);
37 }
37 }
38
38
39 QGroupBox *DataSerieDialog::seriesTypeSelector()
39 QGroupBox *DataSerieDialog::seriesTypeSelector()
40 {
40 {
41 QVBoxLayout *layout = new QVBoxLayout();
41 QVBoxLayout *layout = new QVBoxLayout();
42
42
43 QRadioButton *line = new QRadioButton("Line");
43 QRadioButton *line = new QRadioButton("Line");
44 line->setChecked(true);
44 line->setChecked(true);
45 layout->addWidget(line);
45 layout->addWidget(line);
46 layout->addWidget(new QRadioButton("Area"));
46 layout->addWidget(new QRadioButton("Area"));
47 layout->addWidget(new QRadioButton("Pie"));
47 layout->addWidget(new QRadioButton("Pie"));
48 layout->addWidget(new QRadioButton("Bar"));
48 layout->addWidget(new QRadioButton("Bar"));
49 layout->addWidget(new QRadioButton("Stacked bar"));
49 layout->addWidget(new QRadioButton("Stacked bar"));
50 layout->addWidget(new QRadioButton("Percent bar"));
50 layout->addWidget(new QRadioButton("Percent bar"));
51 layout->addWidget(new QRadioButton("Scatter"));
51 layout->addWidget(new QRadioButton("Scatter"));
52 layout->addWidget(new QRadioButton("Spline"));
52 layout->addWidget(new QRadioButton("Spline"));
53
53
54 QGroupBox *groupBox = new QGroupBox("Series type");
54 QGroupBox *groupBox = new QGroupBox("Series type");
55 groupBox->setLayout(layout);
55 groupBox->setLayout(layout);
56
56
57 return groupBox;
57 return groupBox;
58 }
58 }
59
59
60 QGroupBox *DataSerieDialog::columnCountSelector()
60 QGroupBox *DataSerieDialog::columnCountSelector()
61 {
61 {
62 QVBoxLayout *layout = new QVBoxLayout();
62 QVBoxLayout *layout = new QVBoxLayout();
63
63
64 QRadioButton *radio = new QRadioButton("1");
64 QRadioButton *radio = new QRadioButton("1");
65 radio->setChecked(true);
65 radio->setChecked(true);
66 layout->addWidget(radio);
66 layout->addWidget(radio);
67 layout->addWidget(new QRadioButton("2"));
67 layout->addWidget(new QRadioButton("2"));
68 layout->addWidget(new QRadioButton("3"));
68 layout->addWidget(new QRadioButton("3"));
69 layout->addWidget(new QRadioButton("5"));
69 layout->addWidget(new QRadioButton("5"));
70 layout->addWidget(new QRadioButton("10"));
70 layout->addWidget(new QRadioButton("10"));
71 layout->addWidget(new QRadioButton("100"));
71 layout->addWidget(new QRadioButton("100"));
72
72
73 QGroupBox *groupBox = new QGroupBox("Column count");
73 QGroupBox *groupBox = new QGroupBox("Column count");
74 groupBox->setLayout(layout);
74 groupBox->setLayout(layout);
75
75
76 return groupBox;
76 return groupBox;
77 }
77 }
78
78
79 QGroupBox *DataSerieDialog::rowCountSelector()
79 QGroupBox *DataSerieDialog::rowCountSelector()
80 {
80 {
81 QVBoxLayout *layout = new QVBoxLayout();
81 QVBoxLayout *layout = new QVBoxLayout();
82
82
83 layout->addWidget(new QRadioButton("1"));
83 layout->addWidget(new QRadioButton("1"));
84 QRadioButton *radio = new QRadioButton("10");
84 QRadioButton *radio = new QRadioButton("10");
85 radio->setChecked(true);
85 radio->setChecked(true);
86 layout->addWidget(radio);
86 layout->addWidget(radio);
87 layout->addWidget(new QRadioButton("50"));
87 layout->addWidget(new QRadioButton("50"));
88 layout->addWidget(new QRadioButton("100"));
88 layout->addWidget(new QRadioButton("100"));
89 layout->addWidget(new QRadioButton("10000"));
89 layout->addWidget(new QRadioButton("10000"));
90 layout->addWidget(new QRadioButton("1000000"));
90 layout->addWidget(new QRadioButton("1000000"));
91
91
92 QGroupBox *groupBox = new QGroupBox("Row count");
92 QGroupBox *groupBox = new QGroupBox("Row count");
93 groupBox->setLayout(layout);
93 groupBox->setLayout(layout);
94
94
95 return groupBox;
95 return groupBox;
96 }
96 }
97
97
98 QGroupBox *DataSerieDialog::dataCharacteristicsSelector()
98 QGroupBox *DataSerieDialog::dataCharacteristicsSelector()
99 {
99 {
100 QVBoxLayout *layout = new QVBoxLayout();
100 QVBoxLayout *layout = new QVBoxLayout();
101
101
102 QRadioButton *radio1 = new QRadioButton("Linear");
102 QRadioButton *radio1 = new QRadioButton("Linear");
103 radio1->setChecked(true);
103 radio1->setChecked(true);
104 layout->addWidget(radio1);
104 layout->addWidget(radio1);
105 layout->addWidget(new QRadioButton("Constant"));
105 layout->addWidget(new QRadioButton("Constant"));
106 layout->addWidget(new QRadioButton("Random"));
106 layout->addWidget(new QRadioButton("Random"));
107 layout->addWidget(new QRadioButton("Sin"));
107 layout->addWidget(new QRadioButton("Sin"));
108 layout->addWidget(new QRadioButton("Sin + random"));
108 layout->addWidget(new QRadioButton("Sin + random"));
109
109
110 QGroupBox *groupBox = new QGroupBox("Data Characteristics");
110 QGroupBox *groupBox = new QGroupBox("Data Characteristics");
111 groupBox->setLayout(layout);
111 groupBox->setLayout(layout);
112
112
113 return groupBox;
113 return groupBox;
114 }
114 }
115
115
116 void DataSerieDialog::accept()
116 void DataSerieDialog::accept()
117 {
117 {
118 accepted(radioSelection(m_seriesTypeSelector),
118 accepted(radioSelection(m_seriesTypeSelector),
119 radioSelection(m_columnCountSelector).toInt(),
119 radioSelection(m_columnCountSelector).toInt(),
120 radioSelection(m_rowCountSelector).toInt(),
120 radioSelection(m_rowCountSelector).toInt(),
121 radioSelection(m_dataCharacteristicsSelector),
121 radioSelection(m_dataCharacteristicsSelector),
122 m_labelsSelector->isChecked());
122 m_labelsSelector->isChecked());
123 QDialog::accept();
123 QDialog::accept();
124 }
124 }
125
125
126 QString DataSerieDialog::radioSelection(QGroupBox *groupBox)
126 QString DataSerieDialog::radioSelection(QGroupBox *groupBox)
127 {
127 {
128 QString selection;
128 QString selection;
129 QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(groupBox->layout());
129 QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(groupBox->layout());
130 Q_ASSERT(layout);
130 Q_ASSERT(layout);
131
131
132 for (int i(0); i < layout->count(); i++) {
132 for (int i(0); i < layout->count(); i++) {
133 QLayoutItem *item = layout->itemAt(i);
133 QLayoutItem *item = layout->itemAt(i);
134 Q_ASSERT(item);
134 Q_ASSERT(item);
135 QRadioButton *radio = qobject_cast<QRadioButton *>(item->widget());
135 QRadioButton *radio = qobject_cast<QRadioButton *>(item->widget());
136 Q_ASSERT(radio);
136 Q_ASSERT(radio);
137 if (radio->isChecked()) {
137 if (radio->isChecked()) {
138 selection = radio->text();
138 selection = radio->text();
139 break;
139 break;
140 }
140 }
141 }
141 }
142
142
143 qDebug() << "radioSelection: " << selection;
143 qDebug() << "radioSelection: " << selection;
144 return selection;
144 return selection;
145 }
145 }
General Comments 0
You need to be logged in to leave comments. Login now