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