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