Редакция 134 | Редакция 137 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 134 | Редакция 135 | ||
---|---|---|---|
1 | #include "classeditor.h"
|
1 | #include "classeditor.h"
|
2 | #include "ui_classeditor.h"
|
2 | #include "ui_classeditor.h"
|
3 | 3 | ||
4 | 4 | ||
5 | ClassEditor::ClassEditor(QWidget *parent) : |
5 | ClassEditor::ClassEditor(QWidget *parent) : |
6 | QMainWindow(parent), |
6 | QMainWindow(parent), |
7 | ui(new Ui::ClassEditor) |
7 | ui(new Ui::ClassEditor) |
8 | {
|
8 | {
|
9 | ui->setupUi(this); |
9 | ui->setupUi(this); |
10 | 10 | ||
11 | 11 | ||
12 | 12 | ||
13 | // settdialog = new SettingsDialog(this);
|
13 | // settdialog = new SettingsDialog(this);
|
14 | ///////////////////////////////////////////////////// settdialog.show();
|
14 | ///////////////////////////////////////////////////// settdialog.show();
|
- | 15 | ||
- | 16 | readSettings(); |
|
- | 17 | ||
15 | sql.setDatabaseName(tr("an_db")); |
18 | // sql.setDatabaseName(tr("an_db"));
|
- | 19 | ||
- | 20 | ||
- | 21 | ||
16 | 22 | ||
17 | /*
|
23 | /*
|
18 | field = new TableField(tr("Ñîòðóäíèêè"), this);
|
24 | field = new TableField(tr("Ñîòðóäíèêè"), this);
|
19 | field->setNotNull(true);
|
25 | field->setNotNull(true);
|
20 | field->setDefaultValue(tr("ñîòðóäíèê"));
|
26 | field->setDefaultValue(tr("ñîòðóäíèê"));
|
21 | 27 | ||
22 | table = new SqlTable (tr("NewTable"), this);
|
28 | table = new SqlTable (tr("NewTable"), this);
|
23 | table->setName(tr("NewTable"));
|
29 | table->setName(tr("NewTable"));
|
24 | table->fields().at(0)->setNotNull(true);
|
30 | table->fields().at(0)->setNotNull(true);
|
25 | if (!(table->setPrimaryKey(tr("ID")))) {
|
31 | if (!(table->setPrimaryKey(tr("ID")))) {
|
26 | ui->label_3->setText(table->lastError());
|
32 | ui->label_3->setText(table->lastError());
|
27 | }
|
33 | }
|
28 | else ui->label_3->setText(table->primaryKey());
|
34 | else ui->label_3->setText(table->primaryKey());
|
29 | table->append(field);
|
35 | table->append(field);
|
30 | 36 | ||
31 | field = new TableField(tr("Êîìïüþòåðû"), this);
|
37 | field = new TableField(tr("Êîìïüþòåðû"), this);
|
32 | field->setNotNull(true);
|
38 | field->setNotNull(true);
|
33 | field->setDefaultValue(tr("êîìïüþòåð"));
|
39 | field->setDefaultValue(tr("êîìïüþòåð"));
|
34 | table->append(field);
|
40 | table->append(field);
|
35 | 41 | ||
36 | field = new TableField(tr("Ìîíèòîðû"), this);
|
42 | field = new TableField(tr("Ìîíèòîðû"), this);
|
37 | field->setNotNull(true);
|
43 | field->setNotNull(true);
|
38 | field->setDefaultValue(tr("ìîíèòîð"));
|
44 | field->setDefaultValue(tr("ìîíèòîð"));
|
39 | table->append(field);
|
45 | table->append(field);
|
40 | 46 | ||
41 | field = new TableField(tr("Êîëè÷åñòâî (øòóê)"), this);
|
47 | field = new TableField(tr("Êîëè÷åñòâî (øòóê)"), this);
|
42 | field->setNotNull(true);
|
48 | field->setNotNull(true);
|
43 | field->setType(tr("INTEGER"));
|
49 | field->setType(tr("INTEGER"));
|
44 | field->setDefaultValue(tr("1"));
|
50 | field->setDefaultValue(tr("1"));
|
45 | table->append(field);
|
51 | table->append(field);
|
46 | 52 | ||
47 | field = new TableField(tr("Äåíü ðîæäåíèÿ"), this);
|
53 | field = new TableField(tr("Äåíü ðîæäåíèÿ"), this);
|
48 | field->setNotNull(false);
|
54 | field->setNotNull(false);
|
49 | field->setType(tr("DATE"));
|
55 | field->setType(tr("DATE"));
|
50 | field->setDefaultValue(tr("NULL"));
|
56 | field->setDefaultValue(tr("NULL"));
|
51 | table->append(field);
|
57 | table->append(field);
|
52 | 58 | ||
53 | ui->label_2->setText(table->name());
|
59 | ui->label_2->setText(table->name());
|
54 | ui->label->setText(table->fields().at(0)->sqlString());
|
60 | ui->label->setText(table->fields().at(0)->sqlString());
|
55 | ui->label_4->setText(table->sqlString());
|
61 | ui->label_4->setText(table->sqlString());
|
56 | ////// ui->lineEdit->insert(table->sqlString());
|
62 | ////// ui->lineEdit->insert(table->sqlString());
|
57 | 63 | ||
58 | */
|
64 | */
|
59 | /**********************************************
|
65 | /**********************************************
|
60 | 66 | ||
61 | QTextDocument *document;
|
67 | QTextDocument *document;
|
62 | // = ui->textEdit->document();
|
68 | // = ui->textEdit->document();
|
63 | QTextCursor *cursor;
|
69 | QTextCursor *cursor;
|
64 | 70 | ||
65 | document = ui->textEdit->document();
|
71 | document = ui->textEdit->document();
|
66 | cursor = new QTextCursor(document);
|
72 | cursor = new QTextCursor(document);
|
67 | cursor->movePosition(QTextCursor::Start);
|
73 | cursor->movePosition(QTextCursor::Start);
|
68 | QTextCharFormat format(cursor->charFormat());
|
74 | QTextCharFormat format(cursor->charFormat());
|
69 | //format.setFontFamily("Courier");
|
75 | //format.setFontFamily("Courier");
|
70 | format.setFontFamily("Arial");
|
76 | format.setFontFamily("Arial");
|
71 | //format.setFontItalic(false);
|
77 | //format.setFontItalic(false);
|
72 | 78 | ||
73 | format.setFontWeight(QFont::Normal);
|
79 | format.setFontWeight(QFont::Normal);
|
74 | QTextCharFormat boldFormat = format;
|
80 | QTextCharFormat boldFormat = format;
|
75 | boldFormat.setFontWeight(QFont::Bold);
|
81 | boldFormat.setFontWeight(QFont::Bold);
|
76 | 82 | ||
77 | QTextCharFormat italicFormat = format;
|
83 | QTextCharFormat italicFormat = format;
|
78 | //format.setFontFamily("Courier");
|
84 | //format.setFontFamily("Courier");
|
79 | // format.setFontFamily("Arial");
|
85 | // format.setFontFamily("Arial");
|
80 | italicFormat.setFontItalic(true);
|
86 | italicFormat.setFontItalic(true);
|
81 | 87 | ||
82 | cursor->insertText(table->sqlString(), format);
|
88 | cursor->insertText(table->sqlString(), format);
|
83 | 89 | ||
84 | ****************************************************/
|
90 | ****************************************************/
|
85 | 91 | ||
86 | QString errorString;
|
92 | QString errorString;
|
87 | 93 | ||
88 | sql.setDatabaseName(tr("an_db")); |
94 | // sql.setDatabaseName(tr("an_db"));
|
- | 95 | ||
- | 96 | sql.setDatabaseName(baseName); |
|
89 | // sql.setDatabaseName(tr("inventory"));
|
97 | // sql.setDatabaseName(tr("inventory"));
|
- | 98 | ||
90 | sql.setHostName(tr("localhost")); |
99 | // sql.setHostName(tr("localhost"));
|
- | 100 | sql.setHostName(hostName); |
|
- | 101 | ||
91 | sql.setUserName(tr("an")); |
102 | // sql.setUserName(tr("an"));
|
- | 103 | ||
- | 104 | sql.setUserName(userName); |
|
- | 105 | ||
92 | sql.setPassword(tr("393939")); |
106 | // sql.setPassword(tr("393939"));
|
- | 107 | ||
- | 108 | sql.setPassword(password); |
|
93 | 109 | ||
94 | bool ok; |
110 | bool ok; |
95 | ok = sql.connect(); |
111 | ok = sql.connect(); |
96 | if (!ok) { |
112 | if (!ok) { |
97 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
113 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
98 | this, // Ðîäèòåëüñêèé âèäæåò. |
114 | this, // Ðîäèòåëüñêèé âèäæåò. |
99 | QObject::tr("Database Error"), // Çàãîëîâîê. |
115 | QObject::tr("Database Error"), // Çàãîëîâîê. |
100 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
116 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
101 | 117 | ||
102 | }
|
118 | }
|
103 | else { |
119 | else { |
104 | 120 | ||
105 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
121 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
106 | this, // Ðîäèòåëüñêèé âèäæåò. |
122 | this, // Ðîäèòåëüñêèé âèäæåò. |
107 | QObject::tr("Database Connect"), // Çàãîëîâîê. |
123 | QObject::tr("Database Connect"), // Çàãîëîâîê. |
108 | QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
124 | QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
109 | 125 | ||
110 | 126 | ||
111 | 127 | ||
112 | 128 | ||
113 | 129 | ||
114 | }
|
130 | }
|
115 | 131 | ||
116 | /*
|
132 | /*
|
117 | ok = sql.createTable(table);
|
133 | ok = sql.createTable(table);
|
118 | if (!ok) {
|
134 | if (!ok) {
|
119 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
135 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
120 | this, // Ðîäèòåëüñêèé âèäæåò.
|
136 | this, // Ðîäèòåëüñêèé âèäæåò.
|
121 | QObject::tr("Database Error"), // Çàãîëîâîê.
|
137 | QObject::tr("Database Error"), // Çàãîëîâîê.
|
122 | sql.lasError()); // Òåêñò ñîîáùåíèÿ.
|
138 | sql.lasError()); // Òåêñò ñîîáùåíèÿ.
|
123 | }
|
139 | }
|
124 | else {
|
140 | else {
|
125 | 141 | ||
126 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
142 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
127 | this, // Ðîäèòåëüñêèé âèäæåò.
|
143 | this, // Ðîäèòåëüñêèé âèäæåò.
|
128 | QObject::tr("Database Connect"), // Çàãîëîâîê.
|
144 | QObject::tr("Database Connect"), // Çàãîëîâîê.
|
129 | QObject::tr("Òàáëèöà â áàçå äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ.
|
145 | QObject::tr("Òàáëèöà â áàçå äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ.
|
130 | }
|
146 | }
|
131 | 147 | ||
132 | 148 | ||
133 | 149 | ||
134 | */
|
150 | */
|
135 | 151 | ||
136 | ok = sql.createListOfClassesTable(); |
152 | ok = sql.createListOfClassesTable(); |
137 | 153 | ||
138 | if (!ok) { |
154 | if (!ok) { |
139 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
155 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
140 | this, // Ðîäèòåëüñêèé âèäæåò. |
156 | this, // Ðîäèòåëüñêèé âèäæåò. |
141 | QObject::tr("Database Error"), // Çàãîëîâîê. |
157 | QObject::tr("Database Error"), // Çàãîëîâîê. |
142 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
158 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
143 | 159 | ||
144 | }
|
160 | }
|
145 | else { |
161 | else { |
146 | 162 | ||
147 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
163 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
148 | this, // Ðîäèòåëüñêèé âèäæåò. |
164 | this, // Ðîäèòåëüñêèé âèäæåò. |
149 | QObject::tr("Database Create"), // Çàãîëîâîê. |
165 | QObject::tr("Database Create"), // Çàãîëîâîê. |
150 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
166 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
151 | }
|
167 | }
|
152 | 168 | ||
153 | 169 | ||
154 | 170 | ||
155 | 171 | ||
156 | ok = sql.createDescriptionOfClassesTable(); |
172 | ok = sql.createDescriptionOfClassesTable(); |
157 | 173 | ||
158 | if (!ok) { |
174 | if (!ok) { |
159 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
175 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
160 | this, // Ðîäèòåëüñêèé âèäæåò. |
176 | this, // Ðîäèòåëüñêèé âèäæåò. |
161 | QObject::tr("Database Error"), // Çàãîëîâîê. |
177 | QObject::tr("Database Error"), // Çàãîëîâîê. |
162 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
178 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
163 | 179 | ||
164 | }
|
180 | }
|
165 | else { |
181 | else { |
166 | 182 | ||
167 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
183 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
168 | this, // Ðîäèòåëüñêèé âèäæåò. |
184 | this, // Ðîäèòåëüñêèé âèäæåò. |
169 | QObject::tr("Database Create"), // Çàãîëîâîê. |
185 | QObject::tr("Database Create"), // Çàãîëîâîê. |
170 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
186 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
171 | }
|
187 | }
|
172 | 188 | ||
173 | 189 | ||
174 | 190 | ||
175 | 191 | ||
176 | 192 | ||
177 | 193 | ||
178 | 194 | ||
179 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
195 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
180 | tableForInstance = new QTableView(); |
196 | tableForInstance = new QTableView(); |
181 | mymodel = new MyModel(this); |
197 | mymodel = new MyModel(this); |
182 | modelForPointers = new ModelForPointers(this); // // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
198 | modelForPointers = new ModelForPointers(this); // // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
183 | 199 | ||
184 | //modelForDescription = new QSqlTableModel(this);
|
200 | //modelForDescription = new QSqlTableModel(this);
|
185 | modelForDescription = new ModelForDescriptionTable(this); |
201 | modelForDescription = new ModelForDescriptionTable(this); |
186 | 202 | ||
187 | 203 | ||
188 | /////////////////model->setTable(tr("ListOfClasses"));
|
204 | /////////////////model->setTable(tr("ListOfClasses"));
|
189 | mymodel->setTable(tr("ListOfClasses")); |
205 | mymodel->setTable(tr("ListOfClasses")); |
190 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
206 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
191 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
207 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
192 | 208 | ||
193 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
209 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
194 | 210 | ||
195 | // modelForPointers->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
211 | // modelForPointers->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
196 | 212 | ||
197 | modelForPointers->setEditStrategy(QSqlTableModel::OnFieldChange); |
213 | modelForPointers->setEditStrategy(QSqlTableModel::OnFieldChange); |
198 | 214 | ||
199 | modelForPointers->setTable(tr("DescriptionOfClasses")); |
215 | modelForPointers->setTable(tr("DescriptionOfClasses")); |
200 | 216 | ||
201 | 217 | ||
202 | 218 | ||
203 | 219 | ||
204 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
220 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
205 | 221 | ||
206 | 222 | ||
207 | 223 | ||
208 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
224 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
209 | mymodel->setSort(0, Qt::AscendingOrder); |
225 | mymodel->setSort(0, Qt::AscendingOrder); |
210 | modelForDescription->setSort(0, Qt::AscendingOrder); |
226 | modelForDescription->setSort(0, Qt::AscendingOrder); |
211 | modelForPointers->setSort(0, Qt::AscendingOrder); |
227 | modelForPointers->setSort(0, Qt::AscendingOrder); |
212 | 228 | ||
213 | // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
|
229 | // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
|
214 | ////////////////////model->select();
|
230 | ////////////////////model->select();
|
215 | mymodel->select(); |
231 | mymodel->select(); |
216 | // modelForPointers->select();
|
232 | // modelForPointers->select();
|
217 | 233 | ||
218 | 234 | ||
219 | 235 | ||
220 | 236 | ||
221 | /////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
|
237 | /////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
|
222 | mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà")); |
238 | mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà")); |
223 | 239 | ||
224 | 240 | ||
225 | 241 | ||
226 | ////////////////////////model->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà"));
|
242 | ////////////////////////model->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà"));
|
227 | mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
243 | mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
228 | mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
244 | mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
229 | 245 | ||
230 | //ui->tableView_3->setModel(modelForPointers);
|
246 | //ui->tableView_3->setModel(modelForPointers);
|
231 | 247 | ||
232 | //ui->tableView->setModel(model);
|
248 | //ui->tableView->setModel(model);
|
233 | ui->tableView->setModel(mymodel); |
249 | ui->tableView->setModel(mymodel); |
234 | //tableForDescription = new QTableView();
|
250 | //tableForDescription = new QTableView();
|
235 | ui->tableView_2->setModel(modelForDescription); |
251 | ui->tableView_2->setModel(modelForDescription); |
236 | ui->tableView_2->setAlternatingRowColors(true); |
252 | ui->tableView_2->setAlternatingRowColors(true); |
237 | ui->tableView_2->resizeColumnsToContents(); |
253 | ui->tableView_2->resizeColumnsToContents(); |
238 | //tableForDescription->show();
|
254 | //tableForDescription->show();
|
239 | 255 | ||
240 | 256 | ||
241 | ui->tableView->setAlternatingRowColors(true); |
257 | ui->tableView->setAlternatingRowColors(true); |
242 | ui->tableView->resizeColumnsToContents(); |
258 | ui->tableView->resizeColumnsToContents(); |
243 | 259 | ||
244 | ui->tableView->hideColumn(0); |
260 | ui->tableView->hideColumn(0); |
245 | ui->tableView->hideColumn(3); |
261 | ui->tableView->hideColumn(3); |
246 | ui->tableView->hideColumn(2); |
262 | ui->tableView->hideColumn(2); |
247 | 263 | ||
248 | /*
|
264 | /*
|
249 | ui->tableView_2->hideColumn(0);
|
265 | ui->tableView_2->hideColumn(0);
|
250 | ui->tableView_2->hideColumn(5);
|
266 | ui->tableView_2->hideColumn(5);
|
251 | ui->tableView_2->hideColumn(2);
|
267 | ui->tableView_2->hideColumn(2);
|
252 | */
|
268 | */
|
253 | ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
269 | ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
254 | 270 | ||
255 | delegateForDefaultValueColomn.getItems(); |
271 | delegateForDefaultValueColomn.getItems(); |
256 | ui->tableView_3->setItemDelegateForColumn(4, &delegateForDefaultValueColomn); |
272 | ui->tableView_3->setItemDelegateForColumn(4, &delegateForDefaultValueColomn); |
257 | 273 | ||
258 | 274 | ||
259 | 275 | ||
- | 276 | if (mymodel->rowCount() > 0) { |
|
- | 277 | ||
- | 278 | ||
- | 279 | ||
260 | if (mymodel->rowCount() > 0) currIndexOfClassesTable = mymodel->index(0, 1); |
280 | currIndexOfClassesTable = mymodel->index(0, 1); |
261 | QModelIndex index_temp;
|
281 | QModelIndex index_temp;
|
262 | 282 | ||
263 | 283 | ||
264 | 284 | ||
265 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
285 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
266 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
286 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
267 | 287 | ||
268 | QModelIndex topLeft;
|
288 | QModelIndex topLeft;
|
269 | QModelIndex bottomRight;
|
289 | QModelIndex bottomRight;
|
270 | 290 | ||
271 | topLeft = mymodel->index(0, 0, QModelIndex()); |
291 | topLeft = mymodel->index(0, 0, QModelIndex()); |
272 | bottomRight = mymodel->index(0, 1, QModelIndex()); |
292 | bottomRight = mymodel->index(0, 1, QModelIndex()); |
273 | 293 | ||
274 | QItemSelection selection(topLeft, bottomRight); |
294 | QItemSelection selection(topLeft, bottomRight); |
275 | selectionModel->select(selection, QItemSelectionModel::Select); |
295 | selectionModel->select(selection, QItemSelectionModel::Select); |
276 | 296 | ||
277 | 297 | ||
278 | QString class_indx, class_instance;
|
298 | QString class_indx, class_instance;
|
279 | QString str_fltr = tr("ClassIdentifer = "); |
299 | QString str_fltr = tr("ClassIdentifer = "); |
280 | class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
300 | class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
281 | class_instance = mymodel->data(mymodel->index(0,3)).toString(); |
301 | class_instance = mymodel->data(mymodel->index(0,3)).toString(); |
282 | 302 | ||
283 | currInctanceTable = class_instance; // |
303 | currInctanceTable = class_instance; // |
284 | modelForDescription->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
304 | modelForDescription->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
285 | //class_instance.append(tr("_inctance"));
|
305 | //class_instance.append(tr("_inctance"));
|
286 | str_fltr.append(class_indx); |
306 | str_fltr.append(class_indx); |
287 | str_fltr.append(tr(" AND FieldType <> \"pointer\"")); |
307 | str_fltr.append(tr(" AND FieldType <> \"pointer\"")); |
288 | 308 | ||
289 | model->setTable(class_instance); |
309 | model->setTable(class_instance); |
290 | //model->setTable(tr("memory"));
|
310 | //model->setTable(tr("memory"));
|
291 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
311 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
292 | model->select(); |
312 | model->select(); |
293 | tableForInstance->setModel(model); |
313 | tableForInstance->setModel(model); |
294 | tableForInstance->resizeColumnsToContents(); |
314 | tableForInstance->resizeColumnsToContents(); |
295 | tableForInstance->setWindowTitle(class_instance); |
315 | tableForInstance->setWindowTitle(class_instance); |
296 | tableForInstance->show(); |
316 | tableForInstance->show(); |
297 | 317 | ||
298 | modelForDescription->setFilter(str_fltr); |
318 | modelForDescription->setFilter(str_fltr); |
299 | modelForDescription->select(); |
319 | modelForDescription->select(); |
300 | ui->tableView_2->resizeColumnsToContents(); |
320 | ui->tableView_2->resizeColumnsToContents(); |
301 | 321 | ||
302 | 322 | ||
303 | str_fltr = tr("ClassIdentifer = "); |
323 | str_fltr = tr("ClassIdentifer = "); |
304 | modelForPointers->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
324 | modelForPointers->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
305 | str_fltr.append(class_indx); |
325 | str_fltr.append(class_indx); |
306 | str_fltr.append(tr(" AND FieldType = \"pointer\"")); |
326 | str_fltr.append(tr(" AND FieldType = \"pointer\"")); |
307 | // str_fltr.append( tr(" FieldType = pointer "));
|
327 | // str_fltr.append( tr(" FieldType = pointer "));
|
308 | 328 | ||
309 | 329 | ||
310 | 330 | ||
311 | modelForPointers->setFilter(str_fltr); |
331 | modelForPointers->setFilter(str_fltr); |
312 | modelForPointers->select(); |
332 | modelForPointers->select(); |
313 | ui->tableView_3->setModel(modelForPointers); |
333 | ui->tableView_3->setModel(modelForPointers); |
314 | ui->tableView_3->resizeColumnsToContents(); |
334 | ui->tableView_3->resizeColumnsToContents(); |
315 | 335 | ||
- | 336 | }
|
|
- | 337 | ||
316 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
338 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
317 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
339 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
318 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
340 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
319 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
341 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
320 | connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
342 | connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
321 | connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
343 | connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
322 | connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
344 | connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
323 | connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
345 | connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
324 | connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
346 | connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
325 | connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
347 | connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
326 | connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âñå êëàññû |
348 | connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âñå êëàññû |
327 | connect(ui->action_newClass, SIGNAL(triggered()), this, SLOT(on_pushButton_clicked())); // äîáàâèòü íîâûé êëàññ |
349 | connect(ui->action_newClass, SIGNAL(triggered()), this, SLOT(on_pushButton_clicked())); // äîáàâèòü íîâûé êëàññ |
328 | connect(ui->action_newField, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå |
350 | connect(ui->action_newField, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå |
329 | connect(ui->action_newPointer, SIGNAL(triggered()), this, SLOT(on_action_newPointer())); // äîáàâèòü íîâîå ïîëå äëÿ óêàçàòåëåé íà êëàññû-êîíòåéíåðû |
351 | connect(ui->action_newPointer, SIGNAL(triggered()), this, SLOT(on_action_newPointer())); // äîáàâèòü íîâîå ïîëå äëÿ óêàçàòåëåé íà êëàññû-êîíòåéíåðû |
330 | // connect(ui->action_newPointer, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå äëÿ óêàçàòåëåé íà êëàññû-êîíòåéíåðû
|
352 | // connect(ui->action_newPointer, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå äëÿ óêàçàòåëåé íà êëàññû-êîíòåéíåðû
|
331 | 353 | ||
332 | connect(ui->action_removeSelectedPointers, SIGNAL(triggered()), this, SLOT(on_action_removeSelectedPointers())); // óäàëèòü âûäåëåííûå êëàññû |
354 | connect(ui->action_removeSelectedPointers, SIGNAL(triggered()), this, SLOT(on_action_removeSelectedPointers())); // óäàëèòü âûäåëåííûå êëàññû |
333 | connect(modelForDescription, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå ïîëåé ïðîèçîøëè èçìåíåíèÿ |
355 | connect(modelForDescription, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå ïîëåé ïðîèçîøëè èçìåíåíèÿ |
334 | connect(ClassEditor::modelForPointers, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå óêàçàòåëåé ïðîèçîøëè èçìåíåíèÿ |
356 | connect(ClassEditor::modelForPointers, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå óêàçàòåëåé ïðîèçîøëè èçìåíåíèÿ |
335 | 357 | ||
336 | 358 | ||
- | 359 | connect(ui->getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); // âûáîð â ãëàâíîé ôîðìå â ìåíþ "Áàçà äàííûõ" ïóíêòà "Ïàðàìåòðû ñîåäèíåíèÿ" |
|
- | 360 | connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
|
- | 361 | ||
- | 362 | ||
- | 363 | ||
337 | 364 | ||
338 | }
|
365 | }
|
339 | 366 | ||
340 | 367 | ||
341 | 368 | ||
342 | 369 | ||
343 | 370 | ||
344 | 371 | ||
345 | 372 | ||
346 | 373 | ||
347 | 374 | ||
348 | 375 | ||
349 | 376 | ||
350 | ClassEditor::~ClassEditor() |
377 | ClassEditor::~ClassEditor() |
351 | {
|
378 | {
|
352 | delete ui; |
379 | delete ui; |
353 | delete model; |
380 | delete model; |
354 | delete tableForInstance; |
381 | delete tableForInstance; |
355 | // delete field;
|
382 | // delete field;
|
356 | // delete settdialog;
|
383 | // delete settdialog;
|
357 | }
|
384 | }
|
358 | 385 | ||
359 | void ClassEditor::changeEvent(QEvent *e) |
386 | void ClassEditor::changeEvent(QEvent *e) |
360 | {
|
387 | {
|
361 | QMainWindow::changeEvent(e); |
388 | QMainWindow::changeEvent(e); |
362 | switch (e->type()) { |
389 | switch (e->type()) { |
363 | case QEvent::LanguageChange: |
390 | case QEvent::LanguageChange: |
364 | ui->retranslateUi(this); |
391 | ui->retranslateUi(this); |
365 | break; |
392 | break; |
366 | default: |
393 | default: |
367 | break; |
394 | break; |
368 | }
|
395 | }
|
369 | }
|
396 | }
|
370 | 397 | ||
371 | 398 | ||
372 | /*
|
399 | /*
|
373 | void ClassEditor::addNewClass(){
|
400 | void ClassEditor::addNewClass(){
|
374 | 401 | ||
375 | int row = model->rowCount();
|
402 | int row = model->rowCount();
|
376 | 403 | ||
377 | model->insertRows(row, 1);
|
404 | model->insertRows(row, 1);
|
378 | model->setData(model->index(row, 1), tr("New class")); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà"
|
405 | model->setData(model->index(row, 1), tr("New class")); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà"
|
379 | 406 | ||
380 | 407 | ||
381 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
408 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
382 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
409 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
383 | 410 | ||
384 | 411 | ||
385 | model->submitAll();
|
412 | model->submitAll();
|
386 | 413 | ||
387 | row = model->rowCount();
|
414 | row = model->rowCount();
|
388 | QString tmp_str;
|
415 | QString tmp_str;
|
389 | int i_tmp;
|
416 | int i_tmp;
|
390 | i_tmp = model->data(model->index(row-1, 0)).toInt();
|
417 | i_tmp = model->data(model->index(row-1, 0)).toInt();
|
391 | tmp_str = model->data(model->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà
|
418 | tmp_str = model->data(model->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà
|
392 | 419 | ||
393 | tmp_str.append(tr("_Inctance"));
|
420 | tmp_str.append(tr("_Inctance"));
|
394 | model->setData(model->index(row-1, 3), tmp_str ); // è çàíîñèì çíà÷åíèå â òàáëèöó
|
421 | model->setData(model->index(row-1, 3), tmp_str ); // è çàíîñèì çíà÷åíèå â òàáëèöó
|
395 | 422 | ||
396 | model->submitAll();
|
423 | model->submitAll();
|
397 | mymodel->select();
|
424 | mymodel->select();
|
398 | 425 | ||
399 | 426 | ||
400 | }
|
427 | }
|
401 | */
|
428 | */
|
402 | 429 | ||
403 | void ClassEditor::addNewClass_new(){ |
430 | void ClassEditor::addNewClass_new(){ |
404 | 431 | ||
405 | int row = mymodel->rowCount(); |
432 | int row = mymodel->rowCount(); |
406 | 433 | ||
407 | mymodel->insertRows(row, 1); |
434 | mymodel->insertRows(row, 1); |
408 | mymodel->setData(mymodel->index(row, 1), QVariant(tr("New class")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
435 | mymodel->setData(mymodel->index(row, 1), QVariant(tr("New class")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
409 | 436 | ||
410 | 437 | ||
411 | mymodel->submitAll(); |
438 | mymodel->submitAll(); |
412 | row = mymodel->rowCount(); |
439 | row = mymodel->rowCount(); |
413 | QString tmp_str1, sql_str;
|
440 | QString tmp_str1, sql_str;
|
414 | int i_tmp1; |
441 | int i_tmp1; |
415 | i_tmp1 = mymodel->data(mymodel->index(row-1, 0)).toInt(); |
442 | i_tmp1 = mymodel->data(mymodel->index(row-1, 0)).toInt(); |
416 | tmp_str1 = mymodel->data(mymodel->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà |
443 | tmp_str1 = mymodel->data(mymodel->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà |
417 | 444 | ||
418 | tmp_str1.append(tr("_Inctance")); |
445 | tmp_str1.append(tr("_Inctance")); |
419 | SqlTable* tbl; |
446 | SqlTable* tbl; |
420 | tbl = new SqlTable(tmp_str1); // ñîçäàåì õðàíèëèùå îáúåêòîâ |
447 | tbl = new SqlTable(tmp_str1); // ñîçäàåì õðàíèëèùå îáúåêòîâ |
421 | sql_str = tbl->sqlString(); |
448 | sql_str = tbl->sqlString(); |
422 | bool ok; |
449 | bool ok; |
423 | 450 | ||
424 | ok = sql.createTable(tbl); |
451 | ok = sql.createTable(tbl); |
425 | 452 | ||
426 | if (!ok) { |
453 | if (!ok) { |
427 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
454 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
428 | this, // Ðîäèòåëüñêèé âèäæåò. |
455 | this, // Ðîäèòåëüñêèé âèäæåò. |
429 | QObject::tr("Database Error"), // Çàãîëîâîê. |
456 | QObject::tr("Database Error"), // Çàãîëîâîê. |
430 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
457 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
431 | delete tbl; |
458 | delete tbl; |
432 | mymodel->removeRow(row-1); |
459 | mymodel->removeRow(row-1); |
433 | mymodel->submitAll(); |
460 | mymodel->submitAll(); |
434 | mymodel->select(); |
461 | mymodel->select(); |
435 | ui->tableView_2->resizeRowsToContents(); |
462 | ui->tableView_2->resizeRowsToContents(); |
436 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
463 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
437 | 464 | ||
438 | }
|
465 | }
|
439 | 466 | ||
440 | delete tbl; |
467 | delete tbl; |
441 | mymodel->setData(mymodel->index(row-1, 3), QVariant(tmp_str1), Qt::EditRole); // è çàíîñèì çíà÷åíèå â òàáëèöó |
468 | mymodel->setData(mymodel->index(row-1, 3), QVariant(tmp_str1), Qt::EditRole); // è çàíîñèì çíà÷åíèå â òàáëèöó |
442 | 469 | ||
443 | 470 | ||
444 | 471 | ||
445 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
472 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
446 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
473 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
447 | 474 | ||
448 | 475 | ||
449 | //mymodel->submitAll();
|
476 | //mymodel->submitAll();
|
450 | 477 | ||
451 | //row = mymodel->rowCount();
|
478 | //row = mymodel->rowCount();
|
452 | 479 | ||
453 | 480 | ||
454 | //mymodel->select();
|
481 | //mymodel->select();
|
455 | 482 | ||
456 | 483 | ||
457 | }
|
484 | }
|
458 | 485 | ||
459 | 486 | ||
460 | void ClassEditor::addNewField(){ |
487 | void ClassEditor::addNewField(){ |
461 | // QSqlRecord rec = mymodel->record(1);
|
488 | // QSqlRecord rec = mymodel->record(1);
|
462 | //bool ok;
|
489 | //bool ok;
|
463 | //ok = rec.isEmpty();
|
490 | //ok = rec.isEmpty();
|
464 | //QString currientClassID;
|
491 | //QString currientClassID;
|
465 | //currientClassID = rec.value(1).toString();
|
492 | //currientClassID = rec.value(1).toString();
|
466 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
493 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
467 | QString query_str = tr("ALTER TABLE "); |
494 | QString query_str = tr("ALTER TABLE "); |
468 | QString db_error;
|
495 | QString db_error;
|
469 | QSqlQuery q;
|
496 | QSqlQuery q;
|
470 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
497 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
471 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
498 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
472 | query_str.append( Inctance_str); |
499 | query_str.append( Inctance_str); |
473 | query_str.append(tr(" ADD COLUMN `New field` CHAR(30)")); |
500 | query_str.append(tr(" ADD COLUMN `New field` CHAR(30)")); |
474 | bool ok = q.prepare(query_str); |
501 | bool ok = q.prepare(query_str); |
475 | 502 | ||
476 | ok = q.exec(); |
503 | ok = q.exec(); |
477 | if (!ok) { |
504 | if (!ok) { |
478 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
505 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
479 | this, // Ðîäèòåëüñêèé âèäæåò. |
506 | this, // Ðîäèòåëüñêèé âèäæåò. |
480 | QObject::tr("Database Error"), // Çàãîëîâîê. |
507 | QObject::tr("Database Error"), // Çàãîëîâîê. |
481 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
508 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
482 | 509 | ||
483 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
510 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
484 | 511 | ||
485 | }
|
512 | }
|
486 | 513 | ||
487 | int row = modelForDescription->rowCount(); |
514 | int row = modelForDescription->rowCount(); |
488 | modelForDescription->insertRows(row, 1); |
515 | modelForDescription->insertRows(row, 1); |
489 | modelForDescription->onlySetData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
516 | modelForDescription->onlySetData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
490 | modelForDescription->onlySetData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
517 | modelForDescription->onlySetData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
491 | 518 | ||
492 | modelForDescription->submitAll(); |
519 | modelForDescription->submitAll(); |
493 | 520 | ||
494 | delete model; |
521 | delete model; |
495 | delete tableForInstance; |
522 | delete tableForInstance; |
496 | model = new QSqlTableModel(); |
523 | model = new QSqlTableModel(); |
497 | tableForInstance = new QTableView(); |
524 | tableForInstance = new QTableView(); |
498 | model->setTable(Inctance_str); |
525 | model->setTable(Inctance_str); |
499 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
526 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
500 | tableForInstance->setModel(model); |
527 | tableForInstance->setModel(model); |
501 | tableForInstance->setWindowTitle(Inctance_str); |
528 | tableForInstance->setWindowTitle(Inctance_str); |
502 | tableForInstance->show(); |
529 | tableForInstance->show(); |
503 | }
|
530 | }
|
504 | 531 | ||
505 | 532 | ||
506 | 533 | ||
507 | void ClassEditor::addNewPointer(){ //äîáîâëÿåì íîâîå ïîëå, ãäå áóäóò õðàíèòüñÿ óêàçàòåëè íà îáúåêòû êëàññà-êîíòåéíåðà |
534 | void ClassEditor::addNewPointer(){ //äîáîâëÿåì íîâîå ïîëå, ãäå áóäóò õðàíèòüñÿ óêàçàòåëè íà îáúåêòû êëàññà-êîíòåéíåðà |
508 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
535 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
509 | QString query_str = tr("ALTER TABLE "); |
536 | QString query_str = tr("ALTER TABLE "); |
510 | QString db_error;
|
537 | QString db_error;
|
511 | QSqlQuery q;
|
538 | QSqlQuery q;
|
512 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
539 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
513 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
540 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
514 | query_str.append( Inctance_str); |
541 | query_str.append( Inctance_str); |
515 | query_str.append(tr(" ADD COLUMN `Ñlass-container ID` CHAR(30)")); |
542 | query_str.append(tr(" ADD COLUMN `Ñlass-container ID` CHAR(30)")); |
516 | bool ok = q.prepare(query_str); |
543 | bool ok = q.prepare(query_str); |
517 | 544 | ||
518 | ok = q.exec(); |
545 | ok = q.exec(); |
519 | if (!ok) { |
546 | if (!ok) { |
520 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
547 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
521 | this, // Ðîäèòåëüñêèé âèäæåò. |
548 | this, // Ðîäèòåëüñêèé âèäæåò. |
522 | QObject::tr("Database Error"), // Çàãîëîâîê. |
549 | QObject::tr("Database Error"), // Çàãîëîâîê. |
523 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
550 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
524 | 551 | ||
525 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
552 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
526 | 553 | ||
527 | }
|
554 | }
|
528 | 555 | ||
529 | 556 | ||
530 | int row = ClassEditor::modelForPointers->rowCount(); |
557 | int row = ClassEditor::modelForPointers->rowCount(); |
531 | modelForPointers->insertRows(row, 1); |
558 | modelForPointers->insertRows(row, 1); |
532 | 559 | ||
533 | modelForPointers->onlySetData(modelForPointers->index(row, 1), QVariant(tr("Ñlass-container ID")), Qt::EditRole); |
560 | modelForPointers->onlySetData(modelForPointers->index(row, 1), QVariant(tr("Ñlass-container ID")), Qt::EditRole); |
534 | modelForPointers->onlySetData(modelForPointers->index(row, 3), QVariant(tr("pointer")), Qt::EditRole); |
561 | modelForPointers->onlySetData(modelForPointers->index(row, 3), QVariant(tr("pointer")), Qt::EditRole); |
535 | modelForPointers->onlySetData(modelForPointers->index(row, 5), QVariant(currClassID), Qt::EditRole); |
562 | modelForPointers->onlySetData(modelForPointers->index(row, 5), QVariant(currClassID), Qt::EditRole); |
536 | modelForPointers->onlySetData(modelForPointers->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
563 | modelForPointers->onlySetData(modelForPointers->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
537 | 564 | ||
538 | 565 | ||
539 | modelForPointers->submitAll(); |
566 | modelForPointers->submitAll(); |
540 | 567 | ||
- | 568 | ||
- | 569 | ||
- | 570 | ||
- | 571 | ||
- | 572 | ||
- | 573 | ||
- | 574 | ||
- | 575 | /*
|
|
- | 576 | ||
- | 577 | str_fltr = tr("ClassIdentifer = ");
|
|
- | 578 | modelForPointers->setInctance(Inctance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà
|
|
- | 579 | str_fltr.append(class_indx);
|
|
- | 580 | str_fltr.append(tr(" AND FieldType = \"pointer\""));
|
|
- | 581 | // str_fltr.append( tr(" FieldType = pointer "));
|
|
- | 582 | ||
- | 583 | ||
- | 584 | ||
- | 585 | modelForPointers->setFilter(str_fltr);
|
|
- | 586 | modelForPointers->select();
|
|
- | 587 | ui->tableView_3->setModel(modelForPointers);
|
|
- | 588 | ui->tableView_3->resizeColumnsToContents();
|
|
- | 589 | */
|
|
- | 590 | ||
- | 591 | ||
- | 592 | ||
- | 593 | ||
- | 594 | // modelForPointers->select();
|
|
- | 595 | ||
- | 596 | ||
- | 597 | ||
- | 598 | ||
- | 599 | ||
541 | ClassEditor::refreshInctance(); |
600 | ClassEditor::refreshInctance(); |
542 | 601 | ||
543 | 602 | ||
544 | 603 | ||
545 | 604 | ||
546 | 605 | ||
547 | 606 | ||
548 | 607 | ||
549 | 608 | ||
550 | 609 | ||
551 | }
|
610 | }
|
552 | 611 | ||
553 | 612 | ||
554 | 613 | ||
555 | 614 | ||
556 | 615 | ||
557 | // äîáàâëÿåì íîâûé êëàññ
|
616 | // äîáàâëÿåì íîâûé êëàññ
|
558 | void ClassEditor::on_pushButton_clicked(){ |
617 | void ClassEditor::on_pushButton_clicked(){ |
559 | //int i;
|
618 | //int i;
|
560 | //i++;
|
619 | //i++;
|
561 | /////ClassEditor::addNewClass();
|
620 | /////ClassEditor::addNewClass();
|
562 | ClassEditor::addNewClass_new(); |
621 | ClassEditor::addNewClass_new(); |
563 | mymodel->select(); |
622 | mymodel->select(); |
564 | //ui->tableView->setModel(mymodel);
|
623 | //ui->tableView->setModel(mymodel);
|
565 | 624 | ||
566 | }
|
625 | }
|
567 | 626 | ||
568 | void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
627 | void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
569 | int i, row, column; |
628 | int i, row, column; |
570 | i++; |
629 | i++; |
571 | row = index.row(); |
630 | row = index.row(); |
572 | column = index.column(); |
631 | column = index.column(); |
573 | currIndexOfClassesTable = index; |
632 | currIndexOfClassesTable = index; |
574 | QModelIndex index_tmp, index_instance;
|
633 | QModelIndex index_tmp, index_instance;
|
575 | QString tmp_str, filter_str, instance_str;
|
634 | QString tmp_str, filter_str, instance_str;
|
576 | index_tmp = ui->tableView->model()->index(row, 0); |
635 | index_tmp = ui->tableView->model()->index(row, 0); |
577 | index_instance = ui->tableView->model()->index(row, 3); |
636 | index_instance = ui->tableView->model()->index(row, 3); |
578 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
637 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
579 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
638 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
580 | modelForDescription->setInctance(instance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
639 | modelForDescription->setInctance(instance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
581 | modelForPointers->setInctance(instance_str); |
640 | modelForPointers->setInctance(instance_str); |
582 | 641 | ||
583 | delegateForDefaultValueColomn.getItems(); //ïðîñèì äåëåãàòà îáíîâèòü ñïèñîê êëàññîâ |
642 | delegateForDefaultValueColomn.getItems(); //ïðîñèì äåëåãàòà îáíîâèòü ñïèñîê êëàññîâ |
584 | 643 | ||
585 | // instance_str.append(tr("_inctance"));
|
644 | // instance_str.append(tr("_inctance"));
|
586 | /*
|
645 | /*
|
587 | Inctance_model.clear();
|
646 | Inctance_model.clear();
|
588 | Inctance_model.setTable(instance_str);
|
647 | Inctance_model.setTable(instance_str);
|
589 | Inctance_model.select();
|
648 | Inctance_model.select();
|
590 | tableForInstance_new.setModel(&Inctance_model);
|
649 | tableForInstance_new.setModel(&Inctance_model);
|
591 | tableForInstance_new.show();
|
650 | tableForInstance_new.show();
|
592 | */
|
651 | */
|
593 | // model->clear();
|
652 | // model->clear();
|
594 | tableForInstance->close(); |
653 | tableForInstance->close(); |
595 | delete model; |
654 | delete model; |
596 | delete tableForInstance; |
655 | delete tableForInstance; |
597 | model = new QSqlTableModel(); |
656 | model = new QSqlTableModel(); |
598 | tableForInstance = new QTableView(); |
657 | tableForInstance = new QTableView(); |
599 | model->setTable(instance_str); |
658 | model->setTable(instance_str); |
600 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
659 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
601 | tableForInstance->setModel(model); |
660 | tableForInstance->setModel(model); |
602 | 661 | ||
603 | model->select(); |
662 | model->select(); |
604 | tableForInstance->setWindowTitle(instance_str); |
663 | tableForInstance->setWindowTitle(instance_str); |
605 | tableForInstance->show(); |
664 | tableForInstance->show(); |
606 | 665 | ||
607 | // tableForInstance.setModel(model);
|
666 | // tableForInstance.setModel(model);
|
608 | tableForInstance->resizeColumnsToContents(); |
667 | tableForInstance->resizeColumnsToContents(); |
609 | 668 | ||
610 | currClassID = tmp_str; |
669 | currClassID = tmp_str; |
611 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
670 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
612 | filter_str = tr("ClassIdentifer = "); |
671 | filter_str = tr("ClassIdentifer = "); |
613 | filter_str.append(tmp_str); |
672 | filter_str.append(tmp_str); |
614 | filter_str.append(tr(" AND FieldType <> \"pointer\"")); |
673 | filter_str.append(tr(" AND FieldType <> \"pointer\"")); |
615 | modelForDescription->setFilter(filter_str); |
674 | modelForDescription->setFilter(filter_str); |
616 | modelForDescription->select(); |
675 | modelForDescription->select(); |
617 | ui->tableView_2->resizeColumnsToContents(); |
676 | ui->tableView_2->resizeColumnsToContents(); |
618 | 677 | ||
619 | filter_str = tr("ClassIdentifer = "); |
678 | filter_str = tr("ClassIdentifer = "); |
620 | filter_str.append(tmp_str); |
679 | filter_str.append(tmp_str); |
621 | filter_str.append(tr(" AND FieldType = \"pointer\"")); |
680 | filter_str.append(tr(" AND FieldType = \"pointer\"")); |
622 | modelForPointers->setFilter(filter_str); |
681 | modelForPointers->setFilter(filter_str); |
623 | modelForPointers->select(); |
682 | modelForPointers->select(); |
624 | ui->tableView_3->resizeColumnsToContents(); |
683 | ui->tableView_3->resizeColumnsToContents(); |
625 | 684 | ||
626 | 685 | ||
627 | 686 | ||
628 | 687 | ||
629 | i++; |
688 | i++; |
630 | }
|
689 | }
|
631 | 690 | ||
632 | 691 | ||
633 | 692 | ||
634 | void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ" |
693 | void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ" |
635 | QModelIndex model_index;
|
694 | QModelIndex model_index;
|
636 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
695 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
637 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
696 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
638 | QList<int> selectedRows; |
697 | QList<int> selectedRows; |
639 | selectedRows.clear(); |
698 | selectedRows.clear(); |
640 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
699 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
641 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
700 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
642 | 701 | ||
643 | }
|
702 | }
|
644 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
703 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
645 | 704 | ||
646 | 705 | ||
647 | for (int m =0; m < selectedRows.size(); ++m){ |
706 | for (int m =0; m < selectedRows.size(); ++m){ |
648 | 707 | ||
649 | ClassEditor::removeClass(selectedRows.at(m)); |
708 | ClassEditor::removeClass(selectedRows.at(m)); |
650 | 709 | ||
651 | 710 | ||
652 | 711 | ||
653 | }
|
712 | }
|
654 | mymodel->submitAll(); |
713 | mymodel->submitAll(); |
655 | ClassEditor::modelForDescription->select(); |
714 | ClassEditor::modelForDescription->select(); |
656 | 715 | ||
657 | }
|
716 | }
|
658 | 717 | ||
659 | void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
718 | void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
660 | int i; |
719 | int i; |
661 | i++; |
720 | i++; |
662 | ClassEditor::addNewField(); |
721 | ClassEditor::addNewField(); |
663 | ClassEditor::modelForDescription->select(); |
722 | ClassEditor::modelForDescription->select(); |
664 | ui->tableView_2->resizeColumnsToContents(); |
723 | ui->tableView_2->resizeColumnsToContents(); |
665 | }
|
724 | }
|
666 | 725 | ||
667 | 726 | ||
668 | void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
727 | void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
669 | // int i;
|
728 | // int i;
|
670 | QModelIndex model_index;
|
729 | QModelIndex model_index;
|
671 | QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel(); |
730 | QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel(); |
672 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
731 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
673 | //QModelIndexList indexes_fo_first_col; // èíäåêñû äëÿ ïåðâîãî ñòîëáöà (èìåíà êëàññîâ)
|
732 | //QModelIndexList indexes_fo_first_col; // èíäåêñû äëÿ ïåðâîãî ñòîëáöà (èìåíà êëàññîâ)
|
674 | //model_index = mymodel->selec;
|
733 | //model_index = mymodel->selec;
|
675 | //modelList = ui->tableView->SelectItems;
|
734 | //modelList = ui->tableView->SelectItems;
|
676 | //i = indexes.size();
|
735 | //i = indexes.size();
|
677 | QList<int> selectedRows; |
736 | QList<int> selectedRows; |
678 | //indexes_fo_first_col.clear();
|
737 | //indexes_fo_first_col.clear();
|
679 | /*
|
738 | /*
|
680 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
|
739 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
|
681 | if (!indexes_fo_first_col.contains(model_index) && (model_index.column()==1)) indexes_fo_first_col.append(model_index); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
|
740 | if (!indexes_fo_first_col.contains(model_index) && (model_index.column()==1)) indexes_fo_first_col.append(model_index); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
|
682 | 741 | ||
683 | }
|
742 | }
|
684 | */
|
743 | */
|
685 | selectedRows.clear(); |
744 | selectedRows.clear(); |
686 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
745 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
687 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
746 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
688 | selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
747 | selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
689 | }
|
748 | }
|
690 | }
|
749 | }
|
691 | 750 | ||
692 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
751 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
693 | 752 | ||
694 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
753 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
695 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
754 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
696 | for (int m =0; m < selectedRows.size(); ++m){ |
755 | for (int m =0; m < selectedRows.size(); ++m){ |
697 | 756 | ||
698 | 757 | ||
699 | QString query_str;
|
758 | QString query_str;
|
700 | QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
759 | QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
701 | QSqlQuery q;
|
760 | QSqlQuery q;
|
702 | 761 | ||
703 | query_str.clear(); |
762 | query_str.clear(); |
704 | 763 | ||
705 | 764 | ||
706 | field_name_str = modelForDescription->data(modelForDescription->index(selectedRows.at(m), 1)).toString(); |
765 | field_name_str = modelForDescription->data(modelForDescription->index(selectedRows.at(m), 1)).toString(); |
707 | 766 | ||
708 | query_str.append(tr("ALTER TABLE ")); |
767 | query_str.append(tr("ALTER TABLE ")); |
709 | query_str.append(Inctance_str); |
768 | query_str.append(Inctance_str); |
710 | query_str.append(tr(" DROP COLUMN `")); |
769 | query_str.append(tr(" DROP COLUMN `")); |
711 | query_str.append(field_name_str); |
770 | query_str.append(field_name_str); |
712 | query_str.append(tr("`")); |
771 | query_str.append(tr("`")); |
713 | q.prepare(query_str); |
772 | q.prepare(query_str); |
714 | bool ok = q.exec(); |
773 | bool ok = q.exec(); |
715 | if (!ok) { |
774 | if (!ok) { |
716 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
775 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
717 | this, // Ðîäèòåëüñêèé âèäæåò. |
776 | this, // Ðîäèòåëüñêèé âèäæåò. |
718 | QObject::tr("Database Error"), // Çàãîëîâîê. |
777 | QObject::tr("Database Error"), // Çàãîëîâîê. |
719 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
778 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
720 | 779 | ||
721 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
780 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
722 | 781 | ||
723 | }
|
782 | }
|
724 | 783 | ||
725 | 784 | ||
726 | 785 | ||
727 | modelForDescription->removeRow(selectedRows.at(m)); |
786 | modelForDescription->removeRow(selectedRows.at(m)); |
728 | 787 | ||
729 | }
|
788 | }
|
730 | delete model; |
789 | delete model; |
731 | delete tableForInstance; |
790 | delete tableForInstance; |
732 | model = new QSqlTableModel(); |
791 | model = new QSqlTableModel(); |
733 | tableForInstance = new QTableView(); |
792 | tableForInstance = new QTableView(); |
734 | model->setTable(Inctance_str); |
793 | model->setTable(Inctance_str); |
735 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
794 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
736 | tableForInstance->setModel(model); |
795 | tableForInstance->setModel(model); |
737 | tableForInstance->setWindowTitle(Inctance_str); |
796 | tableForInstance->setWindowTitle(Inctance_str); |
738 | tableForInstance->show(); |
797 | tableForInstance->show(); |
739 | //i = selectedRows.size();
|
798 | //i = selectedRows.size();
|
740 | 799 | ||
741 | //if (i > 0) model_index = indexes.at(0);
|
800 | //if (i > 0) model_index = indexes.at(0);
|
742 | }
|
801 | }
|
743 | 802 | ||
744 | 803 | ||
745 | void ClassEditor::on_action_removeSelectedPointers(){ // óäàëèòü âûäåëåííûå óêàçàòåëè |
804 | void ClassEditor::on_action_removeSelectedPointers(){ // óäàëèòü âûäåëåííûå óêàçàòåëè |
746 | QModelIndex model_index;
|
805 | QModelIndex model_index;
|
747 | QItemSelectionModel *selectionModel = ui->tableView_3->selectionModel(); |
806 | QItemSelectionModel *selectionModel = ui->tableView_3->selectionModel(); |
748 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
807 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
749 | QList<int> selectedRows; |
808 | QList<int> selectedRows; |
750 | 809 | ||
751 | selectedRows.clear(); |
810 | selectedRows.clear(); |
752 | 811 | ||
753 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
812 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
754 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
813 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
755 | selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
814 | selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
756 | }
|
815 | }
|
757 | }
|
816 | }
|
758 | 817 | ||
759 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
818 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
760 | 819 | ||
761 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
820 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
762 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
821 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
763 | for (int m =0; m < selectedRows.size(); ++m){ |
822 | for (int m =0; m < selectedRows.size(); ++m){ |
764 | 823 | ||
765 | 824 | ||
766 | QString query_str;
|
825 | QString query_str;
|
767 | QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
826 | QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
768 | QSqlQuery q;
|
827 | QSqlQuery q;
|
769 | 828 | ||
770 | query_str.clear(); |
829 | query_str.clear(); |
771 | 830 | ||
772 | 831 | ||
773 | field_name_str = modelForPointers->data(modelForPointers->index(selectedRows.at(m), 1)).toString(); |
832 | field_name_str = modelForPointers->data(modelForPointers->index(selectedRows.at(m), 1)).toString(); |
774 | 833 | ||
775 | query_str.append(tr("ALTER TABLE ")); |
834 | query_str.append(tr("ALTER TABLE ")); |
776 | query_str.append(Inctance_str); |
835 | query_str.append(Inctance_str); |
777 | query_str.append(tr(" DROP COLUMN `")); |
836 | query_str.append(tr(" DROP COLUMN `")); |
778 | query_str.append(field_name_str); |
837 | query_str.append(field_name_str); |
779 | query_str.append(tr("`")); |
838 | query_str.append(tr("`")); |
780 | q.prepare(query_str); |
839 | q.prepare(query_str); |
781 | bool ok = q.exec(); |
840 | bool ok = q.exec(); |
782 | if (!ok) { |
841 | if (!ok) { |
783 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
842 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
784 | this, // Ðîäèòåëüñêèé âèäæåò. |
843 | this, // Ðîäèòåëüñêèé âèäæåò. |
785 | QObject::tr("Database Error"), // Çàãîëîâîê. |
844 | QObject::tr("Database Error"), // Çàãîëîâîê. |
786 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
845 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
787 | 846 | ||
788 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
847 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
789 | 848 | ||
790 | }
|
849 | }
|
791 | 850 | ||
792 | 851 | ||
793 | 852 | ||
794 | modelForPointers->removeRow(selectedRows.at(m)); |
853 | modelForPointers->removeRow(selectedRows.at(m)); |
795 | 854 | ||
796 | }
|
855 | }
|
797 | 856 | ||
798 | 857 | ||
799 | refreshInctance(); |
858 | refreshInctance(); |
800 | 859 | ||
801 | 860 | ||
802 | 861 | ||
803 | }
|
862 | }
|
804 | 863 | ||
805 | 864 | ||
806 | 865 | ||
807 | 866 | ||
808 | 867 | ||
809 | void ClassEditor::on_pushButton_5_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
868 | void ClassEditor::on_pushButton_5_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
810 | int row; |
869 | int row; |
811 | row = ClassEditor::modelForDescription->rowCount(); |
870 | row = ClassEditor::modelForDescription->rowCount(); |
812 | ClassEditor::modelForDescription->removeRows(0, row); |
871 | ClassEditor::modelForDescription->removeRows(0, row); |
813 | ClassEditor::modelForDescription->submitAll(); |
872 | ClassEditor::modelForDescription->submitAll(); |
814 | }
|
873 | }
|
815 | 874 | ||
816 | void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
875 | void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
817 | 876 | ||
818 | int i; |
877 | int i; |
819 | i++; |
878 | i++; |
820 | ui->tableView->resizeColumnsToContents(); |
879 | ui->tableView->resizeColumnsToContents(); |
821 | 880 | ||
822 | 881 | ||
823 | 882 | ||
824 | 883 | ||
825 | 884 | ||
826 | }
|
885 | }
|
827 | 886 | ||
828 | void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
887 | void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
829 | ui->tableView_2->resizeColumnsToContents(); |
888 | ui->tableView_2->resizeColumnsToContents(); |
830 | 889 | ||
831 | /*
|
890 | /*
|
832 | QString instance_str;
|
891 | QString instance_str;
|
833 | instance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString();
|
892 | instance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString();
|
834 | tableForInstance->close();
|
893 | tableForInstance->close();
|
835 | delete model;
|
894 | delete model;
|
836 | delete tableForInstance;
|
895 | delete tableForInstance;
|
837 | model = new QSqlTableModel();
|
896 | model = new QSqlTableModel();
|
838 | tableForInstance = new QTableView();
|
897 | tableForInstance = new QTableView();
|
839 | model->setTable(instance_str);
|
898 | model->setTable(instance_str);
|
840 | model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
899 | model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
841 | tableForInstance->setModel(model);
|
900 | tableForInstance->setModel(model);
|
842 | 901 | ||
843 | model->select();
|
902 | model->select();
|
844 | tableForInstance->setWindowTitle(instance_str);
|
903 | tableForInstance->setWindowTitle(instance_str);
|
845 | tableForInstance->show();
|
904 | tableForInstance->show();
|
846 | */
|
905 | */
|
847 | }
|
906 | }
|
848 | 907 | ||
849 | void ClassEditor::on_action_ID_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ID" |
908 | void ClassEditor::on_action_ID_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ID" |
850 | if (is_checked) ui->tableView->showColumn(0); |
909 | if (is_checked) ui->tableView->showColumn(0); |
851 | else ui->tableView->hideColumn(0); |
910 | else ui->tableView->hideColumn(0); |
852 | ui->tableView->resizeColumnsToContents(); |
911 | ui->tableView->resizeColumnsToContents(); |
853 | }
|
912 | }
|
854 | 913 | ||
855 | void ClassEditor::on_action_showAlias_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ïñåâäîíèì" |
914 | void ClassEditor::on_action_showAlias_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ïñåâäîíèì" |
856 | if (is_checked) ui->tableView->showColumn(2); |
915 | if (is_checked) ui->tableView->showColumn(2); |
857 | else ui->tableView->hideColumn(2); |
916 | else ui->tableView->hideColumn(2); |
858 | ui->tableView->resizeColumnsToContents(); |
917 | ui->tableView->resizeColumnsToContents(); |
859 | }
|
918 | }
|
860 | 919 | ||
861 | void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ" |
920 | void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ" |
862 | if (is_checked) ui->tableView->showColumn(3); |
921 | if (is_checked) ui->tableView->showColumn(3); |
863 | else ui->tableView->hideColumn(3); |
922 | else ui->tableView->hideColumn(3); |
864 | ui->tableView->resizeColumnsToContents(); |
923 | ui->tableView->resizeColumnsToContents(); |
865 | }
|
924 | }
|
866 | 925 | ||
867 | 926 | ||
868 | 927 | ||
869 | void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû" |
928 | void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû" |
870 | int row; |
929 | int row; |
871 | row = ClassEditor::mymodel->rowCount(); |
930 | row = ClassEditor::mymodel->rowCount(); |
872 | for (int m=0; m < row; ++m){ |
931 | for (int m=0; m < row; ++m){ |
873 | ClassEditor::removeClass(0); |
932 | ClassEditor::removeClass(0); |
874 | //ClassEditor::mymodel->removeRows(0, row);
|
933 | //ClassEditor::mymodel->removeRows(0, row);
|
875 | }
|
934 | }
|
876 | ClassEditor::mymodel->submitAll(); |
935 | ClassEditor::mymodel->submitAll(); |
877 | ClassEditor::modelForDescription->select(); |
936 | ClassEditor::modelForDescription->select(); |
878 | }
|
937 | }
|
879 | 938 | ||
880 | void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row |
939 | void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row |
881 | QModelIndex index_tmp;
|
940 | QModelIndex index_tmp;
|
882 | QString tmp_str, filter_str;
|
941 | QString tmp_str, filter_str;
|
883 | index_tmp = ui->tableView->model()->index(class_row, 0); |
942 | index_tmp = ui->tableView->model()->index(class_row, 0); |
884 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
943 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
885 | currClassID = tmp_str; |
944 | currClassID = tmp_str; |
886 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
945 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
887 | filter_str = tr("ClassIdentifer = "); |
946 | filter_str = tr("ClassIdentifer = "); |
888 | filter_str.append(tmp_str); |
947 | filter_str.append(tmp_str); |
889 | modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé |
948 | modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé |
890 | ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà |
949 | ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà |
891 | mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ |
950 | mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ |
892 | mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ |
951 | mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ |
893 | ui->tableView->resizeColumnsToContents(); |
952 | ui->tableView->resizeColumnsToContents(); |
894 | ui->tableView_2->resizeColumnsToContents(); |
953 | ui->tableView_2->resizeColumnsToContents(); |
895 | 954 | ||
896 | }
|
955 | }
|
897 | 956 | ||
898 | 957 | ||
899 | void ClassEditor::on_field_changed(){ // ïîìåíÿëîñü èìÿ ïîëÿ |
958 | void ClassEditor::on_field_changed(){ // ïîìåíÿëîñü èìÿ ïîëÿ |
900 | ClassEditor::refreshInctance(); |
959 | ClassEditor::refreshInctance(); |
901 | }
|
960 | }
|
902 | 961 | ||
903 | 962 | ||
904 | 963 | ||
905 | 964 | ||
906 | void ClassEditor::refreshInctance(){ // îáíîâèì ìîäåëü òàáëèöû-õðàíèëèùà |
965 | void ClassEditor::refreshInctance(){ // îáíîâèì ìîäåëü òàáëèöû-õðàíèëèùà |
907 | 966 | ||
908 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
967 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
909 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
968 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
910 | delete model; |
969 | delete model; |
911 | delete tableForInstance; |
970 | delete tableForInstance; |
912 | model = new QSqlTableModel(); |
971 | model = new QSqlTableModel(); |
913 | tableForInstance = new QTableView(); |
972 | tableForInstance = new QTableView(); |
914 | model->setTable(Inctance_str); |
973 | model->setTable(Inctance_str); |
915 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
974 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
916 | model->select(); |
975 | model->select(); |
917 | tableForInstance->setModel(model); |
976 | tableForInstance->setModel(model); |
918 | tableForInstance->setWindowTitle(Inctance_str); |
977 | tableForInstance->setWindowTitle(Inctance_str); |
919 | tableForInstance->resizeRowsToContents(); |
978 | tableForInstance->resizeRowsToContents(); |
920 | tableForInstance->show(); |
979 | tableForInstance->show(); |
921 | 980 | ||
922 | }
|
981 | }
|
923 | 982 | ||
924 | 983 | ||
925 | 984 | ||
926 | 985 | ||
927 | void ClassEditor::on_action_newPointer(){ // äîáàâëÿåì íîâîå ïîëå äëÿ óêàçàòåëåé íà îáúåêòû êëàññà-êîíòåéíåðà |
986 | void ClassEditor::on_action_newPointer(){ // äîáàâëÿåì íîâîå ïîëå äëÿ óêàçàòåëåé íà îáúåêòû êëàññà-êîíòåéíåðà |
928 | ClassEditor::addNewPointer(); |
987 | ClassEditor::addNewPointer(); |
929 | ClassEditor::modelForPointers->select(); |
988 | ClassEditor::modelForPointers->select(); |
930 | ui->tableView_3->resizeColumnsToContents(); |
989 | ui->tableView_3->resizeColumnsToContents(); |
931 | 990 | ||
932 | }
|
991 | }
|
933 | 992 | ||
- | 993 | ||
- | 994 | // Ñ÷èòûâàåì íàñòðîéêè
|
|
- | 995 | ||
- | 996 | void ClassEditor::readSettings() |
|
- | 997 | {
|
|
- | 998 | QSettings settings("Trolltech", "Application Example"); |
|
- | 999 | baseName = settings.value("baseName", "an_db").toString(); |
|
- | 1000 | userName = settings.value("userName", "an").toString(); |
|
- | 1001 | password = settings.value("password", "393939").toString(); |
|
- | 1002 | tableName = settings.value("tableName", "inventar").toString(); |
|
- | 1003 | hostName = settings.value("hostName", "server").toString(); |
|
- | 1004 | // resize(size);
|
|
- | 1005 | // move(pos);tableName
|
|
- | 1006 | }
|
|
- | 1007 | ||
- | 1008 | ||
- | 1009 | void ClassEditor::writeSettings() |
|
- | 1010 | {
|
|
- | 1011 | QSettings settings("Trolltech", "Application Example"); |
|
- | 1012 | settings.setValue("baseName", baseName); |
|
- | 1013 | settings.setValue("userName", userName); |
|
- | 1014 | settings.setValue("password", password); |
|
- | 1015 | settings.setValue("tableName", tableName); |
|
- | 1016 | settings.setValue("hostName", hostName); |
|
- | 1017 | }
|
|
- | 1018 | ||
- | 1019 | ||
- | 1020 | void ClassEditor::applySetting() |
|
- | 1021 | {
|
|
- | 1022 | bool ok; |
|
- | 1023 | baseName = setFrm.lineEdit->text(); |
|
- | 1024 | userName = setFrm.lineEdit_2->text(); |
|
- | 1025 | password = setFrm.lineEdit_3->text(); |
|
- | 1026 | // tableName = setFrm->lineEdit_4->text();
|
|
- | 1027 | hostName = setFrm.lineEdit_5->text(); |
|
- | 1028 | writeSettings(); |
|
- | 1029 | ||
- | 1030 | sql.close(); // ðàçðûâàåì ñîåäèíåíèå ñ áàçîé |
|
- | 1031 | ||
- | 1032 | sql.setDatabaseName(baseName); |
|
- | 1033 | // sql.setDatabaseName(tr("inventory"));
|
|
- | 1034 | ||
- | 1035 | // sql.setHostName(tr("localhost"));
|
|
- | 1036 | sql.setHostName(hostName); |
|
- | 1037 | ||
- | 1038 | // sql.setUserName(tr("an"));
|
|
- | 1039 | ||
- | 1040 | sql.setUserName(userName); |
|
- | 1041 | ||
- | 1042 | // sql.setPassword(tr("393939"));
|
|
- | 1043 | ||
- | 1044 | sql.setPassword(password); |
|
- | 1045 | ||
- | 1046 | ok = sql.connect(); |
|
- | 1047 | if (!ok) { |
|
- | 1048 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
|
- | 1049 | this, // Ðîäèòåëüñêèé âèäæåò. |
|
- | 1050 | QObject::tr("Database Error"), // Çàãîëîâîê. |
|
- | 1051 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
|
- | 1052 | ||
- | 1053 | }
|
|
- | 1054 | else { |
|
- | 1055 | ||
- | 1056 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
|
- | 1057 | this, // Ðîäèòåëüñêèé âèäæåò. |
|
- | 1058 | QObject::tr("Database Connect"), // Çàãîëîâîê. |
|
- | 1059 | QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
|
- | 1060 | ||
- | 1061 | ||
- | 1062 | ||
- | 1063 | ||
- | 1064 | ||
- | 1065 | }
|
|
- | 1066 | ||
- | 1067 | ||
- | 1068 | mymodel->select(); |
|
- | 1069 | model->select(); |
|
- | 1070 | modelForDescription->select(); |
|
- | 1071 | ||
- | 1072 | //////////// ok=openDataBase();
|
|
- | 1073 | //////////// if (!ok) return;
|
|
- | 1074 | // // // ui->treeWidget->clear(); // î÷èùàåì äåðåâî ñ ìîäåëüþ
|
|
- | 1075 | ||
- | 1076 | // // // buildPreviewModel(tr("Ìîÿ ìîäåëü"), tr("1"));
|
|
- | 1077 | //////////// class_list_map.clear(); // î÷èùàåì ñïèñîê êëàññîâ
|
|
- | 1078 | //////////// initComboBox();
|
|
- | 1079 | // // // getDatabaseData();
|
|
- | 1080 | // delete setFrm;
|
|
- | 1081 | setFrm.close(); |
|
- | 1082 | }
|
|
- | 1083 | ||
- | 1084 | void ClassEditor::getSetting() |
|
- | 1085 | {
|
|
- | 1086 | // setFrm = new settingForm;
|
|
- | 1087 | // // // connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting()));
|
|
- | 1088 | setFrm.lineEdit->setText(baseName); |
|
- | 1089 | setFrm.lineEdit_2->setText(userName); |
|
- | 1090 | setFrm.lineEdit_3->setText(password); |
|
- | 1091 | // setFrm->lineEdit_4->setText(tableName);
|
|
- | 1092 | setFrm.lineEdit_5->setText(hostName); |
|
- | 1093 | setFrm.show(); |
|
- | 1094 | ||
- | 1095 | ||
- | 1096 | ||
- | 1097 | }
|
|
- | 1098 | ||
- | 1099 | ||
- | 1100 | void ClassEditor::initDataBase(){ // íàñòðîéêà ïàðàìåòðîâ ñîåäèíåíèÿ è óñòàíîâêà ñîåäèíåíèÿ |
|
- | 1101 | ||
- | 1102 | ||
- | 1103 | }
|
|
934 | 1104 |