Редакция 81 | Редакция 83 | К новейшей редакции | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 81 | Редакция 82 | ||
---|---|---|---|
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 | sql.setDatabaseName(tr("an_db")); |
15 | sql.setDatabaseName(tr("an_db")); |
16 | 16 | ||
17 | /*
|
17 | /*
|
18 | field = new TableField(tr("Ñîòðóäíèêè"), this);
|
18 | field = new TableField(tr("Ñîòðóäíèêè"), this);
|
19 | field->setNotNull(true);
|
19 | field->setNotNull(true);
|
20 | field->setDefaultValue(tr("ñîòðóäíèê"));
|
20 | field->setDefaultValue(tr("ñîòðóäíèê"));
|
21 | 21 | ||
22 | table = new SqlTable (tr("NewTable"), this);
|
22 | table = new SqlTable (tr("NewTable"), this);
|
23 | table->setName(tr("NewTable"));
|
23 | table->setName(tr("NewTable"));
|
24 | table->fields().at(0)->setNotNull(true);
|
24 | table->fields().at(0)->setNotNull(true);
|
25 | if (!(table->setPrimaryKey(tr("ID")))) {
|
25 | if (!(table->setPrimaryKey(tr("ID")))) {
|
26 | ui->label_3->setText(table->lastError());
|
26 | ui->label_3->setText(table->lastError());
|
27 | }
|
27 | }
|
28 | else ui->label_3->setText(table->primaryKey());
|
28 | else ui->label_3->setText(table->primaryKey());
|
29 | table->append(field);
|
29 | table->append(field);
|
30 | 30 | ||
31 | field = new TableField(tr("Êîìïüþòåðû"), this);
|
31 | field = new TableField(tr("Êîìïüþòåðû"), this);
|
32 | field->setNotNull(true);
|
32 | field->setNotNull(true);
|
33 | field->setDefaultValue(tr("êîìïüþòåð"));
|
33 | field->setDefaultValue(tr("êîìïüþòåð"));
|
34 | table->append(field);
|
34 | table->append(field);
|
35 | 35 | ||
36 | field = new TableField(tr("Ìîíèòîðû"), this);
|
36 | field = new TableField(tr("Ìîíèòîðû"), this);
|
37 | field->setNotNull(true);
|
37 | field->setNotNull(true);
|
38 | field->setDefaultValue(tr("ìîíèòîð"));
|
38 | field->setDefaultValue(tr("ìîíèòîð"));
|
39 | table->append(field);
|
39 | table->append(field);
|
40 | 40 | ||
41 | field = new TableField(tr("Êîëè÷åñòâî (øòóê)"), this);
|
41 | field = new TableField(tr("Êîëè÷åñòâî (øòóê)"), this);
|
42 | field->setNotNull(true);
|
42 | field->setNotNull(true);
|
43 | field->setType(tr("INTEGER"));
|
43 | field->setType(tr("INTEGER"));
|
44 | field->setDefaultValue(tr("1"));
|
44 | field->setDefaultValue(tr("1"));
|
45 | table->append(field);
|
45 | table->append(field);
|
46 | 46 | ||
47 | field = new TableField(tr("Äåíü ðîæäåíèÿ"), this);
|
47 | field = new TableField(tr("Äåíü ðîæäåíèÿ"), this);
|
48 | field->setNotNull(false);
|
48 | field->setNotNull(false);
|
49 | field->setType(tr("DATE"));
|
49 | field->setType(tr("DATE"));
|
50 | field->setDefaultValue(tr("NULL"));
|
50 | field->setDefaultValue(tr("NULL"));
|
51 | table->append(field);
|
51 | table->append(field);
|
52 | 52 | ||
53 | ui->label_2->setText(table->name());
|
53 | ui->label_2->setText(table->name());
|
54 | ui->label->setText(table->fields().at(0)->sqlString());
|
54 | ui->label->setText(table->fields().at(0)->sqlString());
|
55 | ui->label_4->setText(table->sqlString());
|
55 | ui->label_4->setText(table->sqlString());
|
56 | ////// ui->lineEdit->insert(table->sqlString());
|
56 | ////// ui->lineEdit->insert(table->sqlString());
|
57 | 57 | ||
58 | */
|
58 | */
|
59 | /**********************************************
|
59 | /**********************************************
|
60 | 60 | ||
61 | QTextDocument *document;
|
61 | QTextDocument *document;
|
62 | // = ui->textEdit->document();
|
62 | // = ui->textEdit->document();
|
63 | QTextCursor *cursor;
|
63 | QTextCursor *cursor;
|
64 | 64 | ||
65 | document = ui->textEdit->document();
|
65 | document = ui->textEdit->document();
|
66 | cursor = new QTextCursor(document);
|
66 | cursor = new QTextCursor(document);
|
67 | cursor->movePosition(QTextCursor::Start);
|
67 | cursor->movePosition(QTextCursor::Start);
|
68 | QTextCharFormat format(cursor->charFormat());
|
68 | QTextCharFormat format(cursor->charFormat());
|
69 | //format.setFontFamily("Courier");
|
69 | //format.setFontFamily("Courier");
|
70 | format.setFontFamily("Arial");
|
70 | format.setFontFamily("Arial");
|
71 | //format.setFontItalic(false);
|
71 | //format.setFontItalic(false);
|
72 | 72 | ||
73 | format.setFontWeight(QFont::Normal);
|
73 | format.setFontWeight(QFont::Normal);
|
74 | QTextCharFormat boldFormat = format;
|
74 | QTextCharFormat boldFormat = format;
|
75 | boldFormat.setFontWeight(QFont::Bold);
|
75 | boldFormat.setFontWeight(QFont::Bold);
|
76 | 76 | ||
77 | QTextCharFormat italicFormat = format;
|
77 | QTextCharFormat italicFormat = format;
|
78 | //format.setFontFamily("Courier");
|
78 | //format.setFontFamily("Courier");
|
79 | // format.setFontFamily("Arial");
|
79 | // format.setFontFamily("Arial");
|
80 | italicFormat.setFontItalic(true);
|
80 | italicFormat.setFontItalic(true);
|
81 | 81 | ||
82 | cursor->insertText(table->sqlString(), format);
|
82 | cursor->insertText(table->sqlString(), format);
|
83 | 83 | ||
84 | ****************************************************/
|
84 | ****************************************************/
|
85 | 85 | ||
86 | QString errorString;
|
86 | QString errorString;
|
87 | 87 | ||
88 | sql.setDatabaseName(tr("an_db")); |
88 | sql.setDatabaseName(tr("an_db")); |
89 | sql.setHostName(tr("localhost")); |
89 | sql.setHostName(tr("localhost")); |
90 | sql.setUserName(tr("an")); |
90 | sql.setUserName(tr("an")); |
91 | sql.setPassword(tr("393939")); |
91 | sql.setPassword(tr("393939")); |
92 | 92 | ||
93 | bool ok; |
93 | bool ok; |
94 | ok = sql.connect(); |
94 | ok = sql.connect(); |
95 | if (!ok) { |
95 | if (!ok) { |
96 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
96 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
97 | this, // Ðîäèòåëüñêèé âèäæåò. |
97 | this, // Ðîäèòåëüñêèé âèäæåò. |
98 | QObject::tr("Database Error"), // Çàãîëîâîê. |
98 | QObject::tr("Database Error"), // Çàãîëîâîê. |
99 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
99 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
100 | 100 | ||
101 | }
|
101 | }
|
102 | else { |
102 | else { |
103 | 103 | ||
104 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
104 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
105 | this, // Ðîäèòåëüñêèé âèäæåò. |
105 | this, // Ðîäèòåëüñêèé âèäæåò. |
106 | QObject::tr("Database Connect"), // Çàãîëîâîê. |
106 | QObject::tr("Database Connect"), // Çàãîëîâîê. |
107 | QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
107 | QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | }
|
113 | }
|
114 | 114 | ||
115 | /*
|
115 | /*
|
116 | ok = sql.createTable(table);
|
116 | ok = sql.createTable(table);
|
117 | if (!ok) {
|
117 | if (!ok) {
|
118 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
118 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
119 | this, // Ðîäèòåëüñêèé âèäæåò.
|
119 | this, // Ðîäèòåëüñêèé âèäæåò.
|
120 | QObject::tr("Database Error"), // Çàãîëîâîê.
|
120 | QObject::tr("Database Error"), // Çàãîëîâîê.
|
121 | sql.lasError()); // Òåêñò ñîîáùåíèÿ.
|
121 | sql.lasError()); // Òåêñò ñîîáùåíèÿ.
|
122 | }
|
122 | }
|
123 | else {
|
123 | else {
|
124 | 124 | ||
125 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
125 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
|
126 | this, // Ðîäèòåëüñêèé âèäæåò.
|
126 | this, // Ðîäèòåëüñêèé âèäæåò.
|
127 | QObject::tr("Database Connect"), // Çàãîëîâîê.
|
127 | QObject::tr("Database Connect"), // Çàãîëîâîê.
|
128 | QObject::tr("Òàáëèöà â áàçå äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ.
|
128 | QObject::tr("Òàáëèöà â áàçå äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ.
|
129 | }
|
129 | }
|
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | */
|
133 | */
|
134 | 134 | ||
135 | ok = sql.createListOfClassesTable(); |
135 | ok = sql.createListOfClassesTable(); |
136 | 136 | ||
137 | if (!ok) { |
137 | if (!ok) { |
138 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
138 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
139 | this, // Ðîäèòåëüñêèé âèäæåò. |
139 | this, // Ðîäèòåëüñêèé âèäæåò. |
140 | QObject::tr("Database Error"), // Çàãîëîâîê. |
140 | QObject::tr("Database Error"), // Çàãîëîâîê. |
141 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
141 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
142 | 142 | ||
143 | }
|
143 | }
|
144 | else { |
144 | else { |
145 | 145 | ||
146 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
146 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
147 | this, // Ðîäèòåëüñêèé âèäæåò. |
147 | this, // Ðîäèòåëüñêèé âèäæåò. |
148 | QObject::tr("Database Create"), // Çàãîëîâîê. |
148 | QObject::tr("Database Create"), // Çàãîëîâîê. |
149 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
149 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
150 | }
|
150 | }
|
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | ||
155 | ok = sql.createDescriptionOfClassesTable(); |
155 | ok = sql.createDescriptionOfClassesTable(); |
156 | 156 | ||
157 | if (!ok) { |
157 | if (!ok) { |
158 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
158 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
159 | this, // Ðîäèòåëüñêèé âèäæåò. |
159 | this, // Ðîäèòåëüñêèé âèäæåò. |
160 | QObject::tr("Database Error"), // Çàãîëîâîê. |
160 | QObject::tr("Database Error"), // Çàãîëîâîê. |
161 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
161 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
162 | 162 | ||
163 | }
|
163 | }
|
164 | else { |
164 | else { |
165 | 165 | ||
166 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
166 | QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
167 | this, // Ðîäèòåëüñêèé âèäæåò. |
167 | this, // Ðîäèòåëüñêèé âèäæåò. |
168 | QObject::tr("Database Create"), // Çàãîëîâîê. |
168 | QObject::tr("Database Create"), // Çàãîëîâîê. |
169 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
169 | QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
170 | }
|
170 | }
|
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
178 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
178 | model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
179 | tableForInstance = new QTableView(); |
179 | tableForInstance = new QTableView(); |
180 | mymodel = new MyModel(this); |
180 | mymodel = new MyModel(this); |
- | 181 | modelForPointers = new ModelForPointers(this); // // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
|
- | 182 | ||
181 | //modelForDescription = new QSqlTableModel(this);
|
183 | //modelForDescription = new QSqlTableModel(this);
|
182 | modelForDescription = new ModelForDescriptionTable(this); |
184 | modelForDescription = new ModelForDescriptionTable(this); |
183 | 185 | ||
184 | 186 | ||
185 | /////////////////model->setTable(tr("ListOfClasses"));
|
187 | /////////////////model->setTable(tr("ListOfClasses"));
|
186 | mymodel->setTable(tr("ListOfClasses")); |
188 | mymodel->setTable(tr("ListOfClasses")); |
187 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
189 | modelForDescription->setTable(tr("DescriptionOfClasses")); |
188 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
190 | modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
189 | 191 | ||
190 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
192 | /////model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
191 | 193 | ||
- | 194 | modelForPointers->setEditStrategy(QSqlTableModel::OnManualSubmit); |
|
- | 195 | modelForPointers->setTable(tr("DescriptionOfClasses")); |
|
- | 196 | ||
- | 197 | ||
192 | 198 | ||
193 | 199 | ||
194 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
200 | //mymodel->setEditStrategy(QSqlTableModel::OnFieldChange);
|
195 | 201 | ||
196 | 202 | ||
197 | 203 | ||
198 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
204 | //////////////////model->setSort(0, Qt::AscendingOrder);
|
199 | mymodel->setSort(0, Qt::AscendingOrder); |
205 | mymodel->setSort(0, Qt::AscendingOrder); |
200 | modelForDescription->setSort(0, Qt::AscendingOrder); |
206 | modelForDescription->setSort(0, Qt::AscendingOrder); |
201 | - | ||
- | 207 | modelForPointers->setSort(0, Qt::AscendingOrder); |
|
202 | 208 | ||
203 | // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
|
209 | // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'"));
|
204 | ////////////////////model->select();
|
210 | ////////////////////model->select();
|
205 | mymodel->select(); |
211 | mymodel->select(); |
- | 212 | // modelForPointers->select();
|
|
206 | 213 | ||
207 | 214 | ||
208 | 215 | ||
209 | 216 | ||
210 | /////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
|
217 | /////////////////////////model->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà"));
|
211 | mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà")); |
218 | mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà")); |
212 | 219 | ||
213 | 220 | ||
214 | 221 | ||
215 | ////////////////////////model->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà"));
|
222 | ////////////////////////model->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà"));
|
216 | mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
223 | mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
217 | mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
224 | mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
218 | 225 | ||
- | 226 | //ui->tableView_3->setModel(modelForPointers);
|
|
219 | 227 | ||
220 | //ui->tableView->setModel(model);
|
228 | //ui->tableView->setModel(model);
|
221 | ui->tableView->setModel(mymodel); |
229 | ui->tableView->setModel(mymodel); |
222 | //tableForDescription = new QTableView();
|
230 | //tableForDescription = new QTableView();
|
223 | ui->tableView_2->setModel(modelForDescription); |
231 | ui->tableView_2->setModel(modelForDescription); |
224 | ui->tableView_2->setAlternatingRowColors(true); |
232 | ui->tableView_2->setAlternatingRowColors(true); |
225 | ui->tableView_2->resizeColumnsToContents(); |
233 | ui->tableView_2->resizeColumnsToContents(); |
226 | //tableForDescription->show();
|
234 | //tableForDescription->show();
|
227 | 235 | ||
228 | 236 | ||
229 | ui->tableView->setAlternatingRowColors(true); |
237 | ui->tableView->setAlternatingRowColors(true); |
230 | ui->tableView->resizeColumnsToContents(); |
238 | ui->tableView->resizeColumnsToContents(); |
231 | 239 | ||
232 | ui->tableView->hideColumn(0); |
240 | ui->tableView->hideColumn(0); |
233 | ui->tableView->hideColumn(3); |
241 | ui->tableView->hideColumn(3); |
234 | ui->tableView->hideColumn(2); |
242 | ui->tableView->hideColumn(2); |
235 | 243 | ||
236 | /*
|
244 | /*
|
237 | ui->tableView_2->hideColumn(0);
|
245 | ui->tableView_2->hideColumn(0);
|
238 | ui->tableView_2->hideColumn(5);
|
246 | ui->tableView_2->hideColumn(5);
|
239 | ui->tableView_2->hideColumn(2);
|
247 | ui->tableView_2->hideColumn(2);
|
240 | */
|
248 | */
|
241 | ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
249 | ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
242 | 250 | ||
243 | currIndexOfClassesTable = mymodel->index(0, 1); |
251 | currIndexOfClassesTable = mymodel->index(0, 1); |
244 | QModelIndex index_temp;
|
252 | QModelIndex index_temp;
|
245 | 253 | ||
246 | 254 | ||
247 | 255 | ||
248 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
256 | currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
249 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
257 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
250 | 258 | ||
251 | QModelIndex topLeft;
|
259 | QModelIndex topLeft;
|
252 | QModelIndex bottomRight;
|
260 | QModelIndex bottomRight;
|
253 | 261 | ||
254 | topLeft = mymodel->index(0, 0, QModelIndex()); |
262 | topLeft = mymodel->index(0, 0, QModelIndex()); |
255 | bottomRight = mymodel->index(0, 1, QModelIndex()); |
263 | bottomRight = mymodel->index(0, 1, QModelIndex()); |
256 | 264 | ||
257 | QItemSelection selection(topLeft, bottomRight); |
265 | QItemSelection selection(topLeft, bottomRight); |
258 | selectionModel->select(selection, QItemSelectionModel::Select); |
266 | selectionModel->select(selection, QItemSelectionModel::Select); |
259 | 267 | ||
260 | 268 | ||
261 | QString class_indx, class_instance;
|
269 | QString class_indx, class_instance;
|
262 | QString str_fltr = tr("ClassIdentifer = "); |
270 | QString str_fltr = tr("ClassIdentifer = "); |
263 | class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
271 | class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
264 | class_instance = mymodel->data(mymodel->index(0,3)).toString(); |
272 | class_instance = mymodel->data(mymodel->index(0,3)).toString(); |
265 | 273 | ||
266 | currInctanceTable = class_instance; // |
274 | currInctanceTable = class_instance; // |
267 | modelForDescription->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
275 | modelForDescription->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
268 | //class_instance.append(tr("_inctance"));
|
276 | //class_instance.append(tr("_inctance"));
|
269 | str_fltr.append(class_indx); |
277 | str_fltr.append(class_indx); |
270 | 278 | ||
271 | model->setTable(class_instance); |
279 | model->setTable(class_instance); |
272 | //model->setTable(tr("memory"));
|
280 | //model->setTable(tr("memory"));
|
273 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
281 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
274 | model->select(); |
282 | model->select(); |
275 | tableForInstance->setModel(model); |
283 | tableForInstance->setModel(model); |
276 | tableForInstance->resizeColumnsToContents(); |
284 | tableForInstance->resizeColumnsToContents(); |
277 | tableForInstance->setWindowTitle(class_instance); |
285 | tableForInstance->setWindowTitle(class_instance); |
278 | tableForInstance->show(); |
286 | tableForInstance->show(); |
279 | 287 | ||
280 | modelForDescription->setFilter(str_fltr); |
288 | modelForDescription->setFilter(str_fltr); |
281 | modelForDescription->select(); |
289 | modelForDescription->select(); |
282 | ui->tableView_2->resizeColumnsToContents(); |
290 | ui->tableView_2->resizeColumnsToContents(); |
283 | 291 | ||
284 | - | ||
- | 292 | // str_fltr.clear();
|
|
- | 293 | // str_fltr.append( tr(" FieldType = pointer "));
|
|
- | 294 | modelForPointers->setFilter(tr(" FieldType = \"pointer\" ")); |
|
- | 295 | modelForPointers->select(); |
|
- | 296 | ui->tableView_3->setModel(modelForPointers); |
|
285 | 297 | ||
286 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
298 | //connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex)));
|
287 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
299 | connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
288 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
300 | connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
289 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
301 | //connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool)));
|
290 | connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
302 | connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
291 | connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
303 | connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
292 | connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
304 | connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
293 | connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
305 | connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
294 | connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
306 | connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
295 | connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
307 | connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
296 | connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âñå êëàññû |
308 | connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âñå êëàññû |
297 | connect(ui->action_newClass, SIGNAL(triggered()), this, SLOT(on_pushButton_clicked())); // äîáàâèòü íîâûé êëàññ |
309 | connect(ui->action_newClass, SIGNAL(triggered()), this, SLOT(on_pushButton_clicked())); // äîáàâèòü íîâûé êëàññ |
298 | connect(ui->action_newField, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå |
310 | connect(ui->action_newField, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå |
299 | connect(ClassEditor::modelForDescription, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // äîáàâèòü íîâîå ïîëå |
311 | connect(ClassEditor::modelForDescription, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // äîáàâèòü íîâîå ïîëå |
300 | }
|
312 | }
|
301 | 313 | ||
302 | 314 | ||
303 | 315 | ||
304 | 316 | ||
305 | 317 | ||
306 | 318 | ||
307 | 319 | ||
308 | 320 | ||
309 | 321 | ||
310 | 322 | ||
311 | 323 | ||
312 | ClassEditor::~ClassEditor() |
324 | ClassEditor::~ClassEditor() |
313 | {
|
325 | {
|
314 | delete ui; |
326 | delete ui; |
315 | delete model; |
327 | delete model; |
316 | delete tableForInstance; |
328 | delete tableForInstance; |
317 | // delete field;
|
329 | // delete field;
|
318 | // delete settdialog;
|
330 | // delete settdialog;
|
319 | }
|
331 | }
|
320 | 332 | ||
321 | void ClassEditor::changeEvent(QEvent *e) |
333 | void ClassEditor::changeEvent(QEvent *e) |
322 | {
|
334 | {
|
323 | QMainWindow::changeEvent(e); |
335 | QMainWindow::changeEvent(e); |
324 | switch (e->type()) { |
336 | switch (e->type()) { |
325 | case QEvent::LanguageChange: |
337 | case QEvent::LanguageChange: |
326 | ui->retranslateUi(this); |
338 | ui->retranslateUi(this); |
327 | break; |
339 | break; |
328 | default: |
340 | default: |
329 | break; |
341 | break; |
330 | }
|
342 | }
|
331 | }
|
343 | }
|
332 | 344 | ||
333 | 345 | ||
334 | /*
|
346 | /*
|
335 | void ClassEditor::addNewClass(){
|
347 | void ClassEditor::addNewClass(){
|
336 | 348 | ||
337 | int row = model->rowCount();
|
349 | int row = model->rowCount();
|
338 | 350 | ||
339 | model->insertRows(row, 1);
|
351 | model->insertRows(row, 1);
|
340 | model->setData(model->index(row, 1), tr("New class")); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà"
|
352 | model->setData(model->index(row, 1), tr("New class")); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà"
|
341 | 353 | ||
342 | 354 | ||
343 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
355 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
344 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
356 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
345 | 357 | ||
346 | 358 | ||
347 | model->submitAll();
|
359 | model->submitAll();
|
348 | 360 | ||
349 | row = model->rowCount();
|
361 | row = model->rowCount();
|
350 | QString tmp_str;
|
362 | QString tmp_str;
|
351 | int i_tmp;
|
363 | int i_tmp;
|
352 | i_tmp = model->data(model->index(row-1, 0)).toInt();
|
364 | i_tmp = model->data(model->index(row-1, 0)).toInt();
|
353 | tmp_str = model->data(model->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà
|
365 | tmp_str = model->data(model->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà
|
354 | 366 | ||
355 | tmp_str.append(tr("_Inctance"));
|
367 | tmp_str.append(tr("_Inctance"));
|
356 | model->setData(model->index(row-1, 3), tmp_str ); // è çàíîñèì çíà÷åíèå â òàáëèöó
|
368 | model->setData(model->index(row-1, 3), tmp_str ); // è çàíîñèì çíà÷åíèå â òàáëèöó
|
357 | 369 | ||
358 | model->submitAll();
|
370 | model->submitAll();
|
359 | mymodel->select();
|
371 | mymodel->select();
|
360 | 372 | ||
361 | 373 | ||
362 | }
|
374 | }
|
363 | */
|
375 | */
|
364 | 376 | ||
365 | void ClassEditor::addNewClass_new(){ |
377 | void ClassEditor::addNewClass_new(){ |
366 | 378 | ||
367 | int row = mymodel->rowCount(); |
379 | int row = mymodel->rowCount(); |
368 | 380 | ||
369 | mymodel->insertRows(row, 1); |
381 | mymodel->insertRows(row, 1); |
370 | mymodel->setData(mymodel->index(row, 1), QVariant(tr("New class")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
382 | mymodel->setData(mymodel->index(row, 1), QVariant(tr("New class")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
371 | 383 | ||
372 | 384 | ||
373 | mymodel->submitAll(); |
385 | mymodel->submitAll(); |
374 | row = mymodel->rowCount(); |
386 | row = mymodel->rowCount(); |
375 | QString tmp_str1, sql_str;
|
387 | QString tmp_str1, sql_str;
|
376 | int i_tmp1; |
388 | int i_tmp1; |
377 | i_tmp1 = mymodel->data(mymodel->index(row-1, 0)).toInt(); |
389 | i_tmp1 = mymodel->data(mymodel->index(row-1, 0)).toInt(); |
378 | tmp_str1 = mymodel->data(mymodel->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà |
390 | tmp_str1 = mymodel->data(mymodel->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà |
379 | 391 | ||
380 | tmp_str1.append(tr("_Inctance")); |
392 | tmp_str1.append(tr("_Inctance")); |
381 | SqlTable* tbl; |
393 | SqlTable* tbl; |
382 | tbl = new SqlTable(tmp_str1); // ñîçäàåì õðàíèëèùå îáúåêòîâ |
394 | tbl = new SqlTable(tmp_str1); // ñîçäàåì õðàíèëèùå îáúåêòîâ |
383 | sql_str = tbl->sqlString(); |
395 | sql_str = tbl->sqlString(); |
384 | bool ok; |
396 | bool ok; |
385 | 397 | ||
386 | ok = sql.createTable(tbl); |
398 | ok = sql.createTable(tbl); |
387 | 399 | ||
388 | if (!ok) { |
400 | if (!ok) { |
389 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
401 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
390 | this, // Ðîäèòåëüñêèé âèäæåò. |
402 | this, // Ðîäèòåëüñêèé âèäæåò. |
391 | QObject::tr("Database Error"), // Çàãîëîâîê. |
403 | QObject::tr("Database Error"), // Çàãîëîâîê. |
392 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
404 | sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
393 | delete tbl; |
405 | delete tbl; |
394 | mymodel->removeRow(row-1); |
406 | mymodel->removeRow(row-1); |
395 | mymodel->submitAll(); |
407 | mymodel->submitAll(); |
396 | mymodel->select(); |
408 | mymodel->select(); |
397 | ui->tableView_2->resizeRowsToContents(); |
409 | ui->tableView_2->resizeRowsToContents(); |
398 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
410 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
399 | 411 | ||
400 | }
|
412 | }
|
401 | 413 | ||
402 | delete tbl; |
414 | delete tbl; |
403 | mymodel->setData(mymodel->index(row-1, 3), QVariant(tmp_str1), Qt::EditRole); // è çàíîñèì çíà÷åíèå â òàáëèöó |
415 | mymodel->setData(mymodel->index(row-1, 3), QVariant(tmp_str1), Qt::EditRole); // è çàíîñèì çíà÷åíèå â òàáëèöó |
404 | 416 | ||
405 | 417 | ||
406 | 418 | ||
407 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
419 | // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí"));
|
408 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
420 | // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1"));
|
409 | 421 | ||
410 | 422 | ||
411 | //mymodel->submitAll();
|
423 | //mymodel->submitAll();
|
412 | 424 | ||
413 | //row = mymodel->rowCount();
|
425 | //row = mymodel->rowCount();
|
414 | 426 | ||
415 | 427 | ||
416 | //mymodel->select();
|
428 | //mymodel->select();
|
417 | 429 | ||
418 | 430 | ||
419 | }
|
431 | }
|
420 | 432 | ||
421 | 433 | ||
422 | void ClassEditor::addNewField(){ |
434 | void ClassEditor::addNewField(){ |
423 | // QSqlRecord rec = mymodel->record(1);
|
435 | // QSqlRecord rec = mymodel->record(1);
|
424 | //bool ok;
|
436 | //bool ok;
|
425 | //ok = rec.isEmpty();
|
437 | //ok = rec.isEmpty();
|
426 | //QString currientClassID;
|
438 | //QString currientClassID;
|
427 | //currientClassID = rec.value(1).toString();
|
439 | //currientClassID = rec.value(1).toString();
|
428 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
440 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
429 | QString query_str = tr("ALTER TABLE "); |
441 | QString query_str = tr("ALTER TABLE "); |
430 | QString db_error;
|
442 | QString db_error;
|
431 | QSqlQuery q;
|
443 | QSqlQuery q;
|
432 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
444 | int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
433 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
445 | Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
434 | query_str.append( Inctance_str); |
446 | query_str.append( Inctance_str); |
435 | query_str.append(tr(" ADD COLUMN `New field` CHAR(10)")); |
447 | query_str.append(tr(" ADD COLUMN `New field` CHAR(30)")); |
436 | bool ok = q.prepare(query_str); |
448 | bool ok = q.prepare(query_str); |
437 | 449 | ||
438 | ok = q.exec(); |
450 | ok = q.exec(); |
439 | if (!ok) { |
451 | if (!ok) { |
440 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
452 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
441 | this, // Ðîäèòåëüñêèé âèäæåò. |
453 | this, // Ðîäèòåëüñêèé âèäæåò. |
442 | QObject::tr("Database Error"), // Çàãîëîâîê. |
454 | QObject::tr("Database Error"), // Çàãîëîâîê. |
443 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
455 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
444 | 456 | ||
445 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
457 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
446 | 458 | ||
447 | }
|
459 | }
|
448 | 460 | ||
449 | int row = modelForDescription->rowCount(); |
461 | int row = modelForDescription->rowCount(); |
450 | modelForDescription->insertRows(row, 1); |
462 | modelForDescription->insertRows(row, 1); |
451 | modelForDescription->onlySetData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
463 | modelForDescription->onlySetData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
452 | modelForDescription->onlySetData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
464 | modelForDescription->onlySetData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
453 | 465 | ||
454 | modelForDescription->submitAll(); |
466 | modelForDescription->submitAll(); |
455 | 467 | ||
456 | delete model; |
468 | delete model; |
457 | delete tableForInstance; |
469 | delete tableForInstance; |
458 | model = new QSqlTableModel(); |
470 | model = new QSqlTableModel(); |
459 | tableForInstance = new QTableView(); |
471 | tableForInstance = new QTableView(); |
460 | model->setTable(Inctance_str); |
472 | model->setTable(Inctance_str); |
461 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
473 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
462 | tableForInstance->setModel(model); |
474 | tableForInstance->setModel(model); |
463 | tableForInstance->setWindowTitle(Inctance_str); |
475 | tableForInstance->setWindowTitle(Inctance_str); |
464 | tableForInstance->show(); |
476 | tableForInstance->show(); |
465 | }
|
477 | }
|
466 | 478 | ||
467 | 479 | ||
468 | 480 | ||
469 | 481 | ||
470 | 482 | ||
471 | 483 | ||
472 | 484 | ||
473 | 485 | ||
474 | 486 | ||
475 | 487 | ||
476 | // äîáàâëÿåì íîâûé êëàññ
|
488 | // äîáàâëÿåì íîâûé êëàññ
|
477 | void ClassEditor::on_pushButton_clicked(){ |
489 | void ClassEditor::on_pushButton_clicked(){ |
478 | //int i;
|
490 | //int i;
|
479 | //i++;
|
491 | //i++;
|
480 | /////ClassEditor::addNewClass();
|
492 | /////ClassEditor::addNewClass();
|
481 | ClassEditor::addNewClass_new(); |
493 | ClassEditor::addNewClass_new(); |
482 | mymodel->select(); |
494 | mymodel->select(); |
483 | //ui->tableView->setModel(mymodel);
|
495 | //ui->tableView->setModel(mymodel);
|
484 | 496 | ||
485 | }
|
497 | }
|
486 | 498 | ||
487 | void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
499 | void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
488 | int i, row, column; |
500 | int i, row, column; |
489 | i++; |
501 | i++; |
490 | row = index.row(); |
502 | row = index.row(); |
491 | column = index.column(); |
503 | column = index.column(); |
492 | currIndexOfClassesTable = index; |
504 | currIndexOfClassesTable = index; |
493 | QModelIndex index_tmp, index_instance;
|
505 | QModelIndex index_tmp, index_instance;
|
494 | QString tmp_str, filter_str, instance_str;
|
506 | QString tmp_str, filter_str, instance_str;
|
495 | index_tmp = ui->tableView->model()->index(row, 0); |
507 | index_tmp = ui->tableView->model()->index(row, 0); |
496 | index_instance = ui->tableView->model()->index(row, 3); |
508 | index_instance = ui->tableView->model()->index(row, 3); |
497 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
509 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
498 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
510 | instance_str = ui->tableView->model()->data(index_instance).toString(); |
499 | modelForDescription->setInctance(instance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
511 | modelForDescription->setInctance(instance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
500 | 512 | ||
501 | 513 | ||
502 | 514 | ||
503 | 515 | ||
504 | // instance_str.append(tr("_inctance"));
|
516 | // instance_str.append(tr("_inctance"));
|
505 | /*
|
517 | /*
|
506 | Inctance_model.clear();
|
518 | Inctance_model.clear();
|
507 | Inctance_model.setTable(instance_str);
|
519 | Inctance_model.setTable(instance_str);
|
508 | Inctance_model.select();
|
520 | Inctance_model.select();
|
509 | tableForInstance_new.setModel(&Inctance_model);
|
521 | tableForInstance_new.setModel(&Inctance_model);
|
510 | tableForInstance_new.show();
|
522 | tableForInstance_new.show();
|
511 | */
|
523 | */
|
512 | // model->clear();
|
524 | // model->clear();
|
513 | tableForInstance->close(); |
525 | tableForInstance->close(); |
514 | delete model; |
526 | delete model; |
515 | delete tableForInstance; |
527 | delete tableForInstance; |
516 | model = new QSqlTableModel(); |
528 | model = new QSqlTableModel(); |
517 | tableForInstance = new QTableView(); |
529 | tableForInstance = new QTableView(); |
518 | model->setTable(instance_str); |
530 | model->setTable(instance_str); |
519 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
531 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
520 | tableForInstance->setModel(model); |
532 | tableForInstance->setModel(model); |
521 | 533 | ||
522 | model->select(); |
534 | model->select(); |
523 | tableForInstance->setWindowTitle(instance_str); |
535 | tableForInstance->setWindowTitle(instance_str); |
524 | tableForInstance->show(); |
536 | tableForInstance->show(); |
525 | 537 | ||
526 | // tableForInstance.setModel(model);
|
538 | // tableForInstance.setModel(model);
|
527 | tableForInstance->resizeColumnsToContents(); |
539 | tableForInstance->resizeColumnsToContents(); |
528 | 540 | ||
529 | currClassID = tmp_str; |
541 | currClassID = tmp_str; |
530 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
542 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
531 | filter_str = tr("ClassIdentifer = "); |
543 | filter_str = tr("ClassIdentifer = "); |
532 | filter_str.append(tmp_str); |
544 | filter_str.append(tmp_str); |
533 | modelForDescription->setFilter(filter_str); |
545 | modelForDescription->setFilter(filter_str); |
534 | modelForDescription->select(); |
546 | modelForDescription->select(); |
535 | ui->tableView_2->resizeColumnsToContents(); |
547 | ui->tableView_2->resizeColumnsToContents(); |
536 | i++; |
548 | i++; |
537 | }
|
549 | }
|
538 | 550 | ||
539 | 551 | ||
540 | 552 | ||
541 | void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ" |
553 | void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ" |
542 | QModelIndex model_index;
|
554 | QModelIndex model_index;
|
543 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
555 | QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
544 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
556 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
545 | QList<int> selectedRows; |
557 | QList<int> selectedRows; |
546 | selectedRows.clear(); |
558 | selectedRows.clear(); |
547 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
559 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
548 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
560 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
549 | 561 | ||
550 | }
|
562 | }
|
551 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
563 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
552 | 564 | ||
553 | 565 | ||
554 | for (int m =0; m < selectedRows.size(); ++m){ |
566 | for (int m =0; m < selectedRows.size(); ++m){ |
555 | 567 | ||
556 | ClassEditor::removeClass(selectedRows.at(m)); |
568 | ClassEditor::removeClass(selectedRows.at(m)); |
557 | 569 | ||
558 | 570 | ||
559 | 571 | ||
560 | }
|
572 | }
|
561 | mymodel->submitAll(); |
573 | mymodel->submitAll(); |
562 | ClassEditor::modelForDescription->select(); |
574 | ClassEditor::modelForDescription->select(); |
563 | 575 | ||
564 | }
|
576 | }
|
565 | 577 | ||
566 | void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
578 | void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
567 | int i; |
579 | int i; |
568 | i++; |
580 | i++; |
569 | ClassEditor::addNewField(); |
581 | ClassEditor::addNewField(); |
570 | ClassEditor::modelForDescription->select(); |
582 | ClassEditor::modelForDescription->select(); |
571 | ui->tableView_2->resizeColumnsToContents(); |
583 | ui->tableView_2->resizeColumnsToContents(); |
572 | }
|
584 | }
|
573 | 585 | ||
574 | 586 | ||
575 | void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
587 | void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
576 | // int i;
|
588 | // int i;
|
577 | QModelIndex model_index;
|
589 | QModelIndex model_index;
|
578 | QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel(); |
590 | QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel(); |
579 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
591 | QModelIndexList indexes = selectionModel->selectedIndexes(); |
580 | //QModelIndexList indexes_fo_first_col; // èíäåêñû äëÿ ïåðâîãî ñòîëáöà (èìåíà êëàññîâ)
|
592 | //QModelIndexList indexes_fo_first_col; // èíäåêñû äëÿ ïåðâîãî ñòîëáöà (èìåíà êëàññîâ)
|
581 | //model_index = mymodel->selec;
|
593 | //model_index = mymodel->selec;
|
582 | //modelList = ui->tableView->SelectItems;
|
594 | //modelList = ui->tableView->SelectItems;
|
583 | //i = indexes.size();
|
595 | //i = indexes.size();
|
584 | QList<int> selectedRows; |
596 | QList<int> selectedRows; |
585 | //indexes_fo_first_col.clear();
|
597 | //indexes_fo_first_col.clear();
|
586 | /*
|
598 | /*
|
587 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
|
599 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
|
588 | if (!indexes_fo_first_col.contains(model_index) && (model_index.column()==1)) indexes_fo_first_col.append(model_index); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
|
600 | if (!indexes_fo_first_col.contains(model_index) && (model_index.column()==1)) indexes_fo_first_col.append(model_index); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
|
589 | 601 | ||
590 | }
|
602 | }
|
591 | */
|
603 | */
|
592 | selectedRows.clear(); |
604 | selectedRows.clear(); |
593 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
605 | foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
594 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
606 | if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
595 | selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
607 | selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
596 | }
|
608 | }
|
597 | }
|
609 | }
|
598 | 610 | ||
599 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
611 | qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
600 | 612 | ||
601 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
613 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
602 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
614 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
603 | for (int m =0; m < selectedRows.size(); ++m){ |
615 | for (int m =0; m < selectedRows.size(); ++m){ |
604 | 616 | ||
605 | 617 | ||
606 | QString query_str;
|
618 | QString query_str;
|
607 | QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
619 | QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
608 | QSqlQuery q;
|
620 | QSqlQuery q;
|
609 | 621 | ||
610 | query_str.clear(); |
622 | query_str.clear(); |
611 | 623 | ||
612 | 624 | ||
613 | field_name_str = modelForDescription->data(modelForDescription->index(selectedRows.at(m), 1)).toString(); |
625 | field_name_str = modelForDescription->data(modelForDescription->index(selectedRows.at(m), 1)).toString(); |
614 | 626 | ||
615 | query_str.append(tr("ALTER TABLE ")); |
627 | query_str.append(tr("ALTER TABLE ")); |
616 | query_str.append(Inctance_str); |
628 | query_str.append(Inctance_str); |
617 | query_str.append(tr(" DROP COLUMN `")); |
629 | query_str.append(tr(" DROP COLUMN `")); |
618 | query_str.append(field_name_str); |
630 | query_str.append(field_name_str); |
619 | query_str.append(tr("`")); |
631 | query_str.append(tr("`")); |
620 | q.prepare(query_str); |
632 | q.prepare(query_str); |
621 | bool ok = q.exec(); |
633 | bool ok = q.exec(); |
622 | if (!ok) { |
634 | if (!ok) { |
623 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
635 | QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
624 | this, // Ðîäèòåëüñêèé âèäæåò. |
636 | this, // Ðîäèòåëüñêèé âèäæåò. |
625 | QObject::tr("Database Error"), // Çàãîëîâîê. |
637 | QObject::tr("Database Error"), // Çàãîëîâîê. |
626 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
638 | q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
627 | 639 | ||
628 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
640 | return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
629 | 641 | ||
630 | }
|
642 | }
|
631 | 643 | ||
632 | 644 | ||
633 | 645 | ||
634 | modelForDescription->removeRow(selectedRows.at(m)); |
646 | modelForDescription->removeRow(selectedRows.at(m)); |
635 | 647 | ||
636 | }
|
648 | }
|
637 | delete model; |
649 | delete model; |
638 | delete tableForInstance; |
650 | delete tableForInstance; |
639 | model = new QSqlTableModel(); |
651 | model = new QSqlTableModel(); |
640 | tableForInstance = new QTableView(); |
652 | tableForInstance = new QTableView(); |
641 | model->setTable(Inctance_str); |
653 | model->setTable(Inctance_str); |
642 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
654 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
643 | tableForInstance->setModel(model); |
655 | tableForInstance->setModel(model); |
644 | tableForInstance->setWindowTitle(Inctance_str); |
656 | tableForInstance->setWindowTitle(Inctance_str); |
645 | tableForInstance->show(); |
657 | tableForInstance->show(); |
646 | //i = selectedRows.size();
|
658 | //i = selectedRows.size();
|
647 | 659 | ||
648 | //if (i > 0) model_index = indexes.at(0);
|
660 | //if (i > 0) model_index = indexes.at(0);
|
649 | }
|
661 | }
|
650 | 662 | ||
651 | 663 | ||
652 | void ClassEditor::on_pushButton_5_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
664 | void ClassEditor::on_pushButton_5_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
653 | int row; |
665 | int row; |
654 | row = ClassEditor::modelForDescription->rowCount(); |
666 | row = ClassEditor::modelForDescription->rowCount(); |
655 | ClassEditor::modelForDescription->removeRows(0, row); |
667 | ClassEditor::modelForDescription->removeRows(0, row); |
656 | ClassEditor::modelForDescription->submitAll(); |
668 | ClassEditor::modelForDescription->submitAll(); |
657 | }
|
669 | }
|
658 | 670 | ||
659 | void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
671 | void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
660 | 672 | ||
661 | int i; |
673 | int i; |
662 | i++; |
674 | i++; |
663 | ui->tableView->resizeColumnsToContents(); |
675 | ui->tableView->resizeColumnsToContents(); |
664 | 676 | ||
665 | 677 | ||
666 | 678 | ||
667 | 679 | ||
668 | 680 | ||
669 | }
|
681 | }
|
670 | 682 | ||
671 | void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
683 | void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
672 | ui->tableView_2->resizeColumnsToContents(); |
684 | ui->tableView_2->resizeColumnsToContents(); |
673 | 685 | ||
674 | /*
|
686 | /*
|
675 | QString instance_str;
|
687 | QString instance_str;
|
676 | instance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString();
|
688 | instance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString();
|
677 | tableForInstance->close();
|
689 | tableForInstance->close();
|
678 | delete model;
|
690 | delete model;
|
679 | delete tableForInstance;
|
691 | delete tableForInstance;
|
680 | model = new QSqlTableModel();
|
692 | model = new QSqlTableModel();
|
681 | tableForInstance = new QTableView();
|
693 | tableForInstance = new QTableView();
|
682 | model->setTable(instance_str);
|
694 | model->setTable(instance_str);
|
683 | model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
695 | model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
684 | tableForInstance->setModel(model);
|
696 | tableForInstance->setModel(model);
|
685 | 697 | ||
686 | model->select();
|
698 | model->select();
|
687 | tableForInstance->setWindowTitle(instance_str);
|
699 | tableForInstance->setWindowTitle(instance_str);
|
688 | tableForInstance->show();
|
700 | tableForInstance->show();
|
689 | */
|
701 | */
|
690 | }
|
702 | }
|
691 | 703 | ||
692 | void ClassEditor::on_action_ID_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ID" |
704 | void ClassEditor::on_action_ID_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ID" |
693 | if (is_checked) ui->tableView->showColumn(0); |
705 | if (is_checked) ui->tableView->showColumn(0); |
694 | else ui->tableView->hideColumn(0); |
706 | else ui->tableView->hideColumn(0); |
695 | ui->tableView->resizeColumnsToContents(); |
707 | ui->tableView->resizeColumnsToContents(); |
696 | }
|
708 | }
|
697 | 709 | ||
698 | void ClassEditor::on_action_showAlias_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ïñåâäîíèì" |
710 | void ClassEditor::on_action_showAlias_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ïñåâäîíèì" |
699 | if (is_checked) ui->tableView->showColumn(2); |
711 | if (is_checked) ui->tableView->showColumn(2); |
700 | else ui->tableView->hideColumn(2); |
712 | else ui->tableView->hideColumn(2); |
701 | ui->tableView->resizeColumnsToContents(); |
713 | ui->tableView->resizeColumnsToContents(); |
702 | }
|
714 | }
|
703 | 715 | ||
704 | void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ" |
716 | void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ" |
705 | if (is_checked) ui->tableView->showColumn(3); |
717 | if (is_checked) ui->tableView->showColumn(3); |
706 | else ui->tableView->hideColumn(3); |
718 | else ui->tableView->hideColumn(3); |
707 | ui->tableView->resizeColumnsToContents(); |
719 | ui->tableView->resizeColumnsToContents(); |
708 | }
|
720 | }
|
709 | 721 | ||
710 | 722 | ||
711 | 723 | ||
712 | void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû" |
724 | void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû" |
713 | int row; |
725 | int row; |
714 | row = ClassEditor::mymodel->rowCount(); |
726 | row = ClassEditor::mymodel->rowCount(); |
715 | for (int m=0; m < row; ++m){ |
727 | for (int m=0; m < row; ++m){ |
716 | ClassEditor::removeClass(0); |
728 | ClassEditor::removeClass(0); |
717 | //ClassEditor::mymodel->removeRows(0, row);
|
729 | //ClassEditor::mymodel->removeRows(0, row);
|
718 | }
|
730 | }
|
719 | ClassEditor::mymodel->submitAll(); |
731 | ClassEditor::mymodel->submitAll(); |
720 | ClassEditor::modelForDescription->select(); |
732 | ClassEditor::modelForDescription->select(); |
721 | }
|
733 | }
|
722 | 734 | ||
723 | void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row |
735 | void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row |
724 | QModelIndex index_tmp;
|
736 | QModelIndex index_tmp;
|
725 | QString tmp_str, filter_str;
|
737 | QString tmp_str, filter_str;
|
726 | index_tmp = ui->tableView->model()->index(class_row, 0); |
738 | index_tmp = ui->tableView->model()->index(class_row, 0); |
727 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
739 | tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
728 | currClassID = tmp_str; |
740 | currClassID = tmp_str; |
729 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
741 | // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString());
|
730 | filter_str = tr("ClassIdentifer = "); |
742 | filter_str = tr("ClassIdentifer = "); |
731 | filter_str.append(tmp_str); |
743 | filter_str.append(tmp_str); |
732 | modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé |
744 | modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé |
733 | ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà |
745 | ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà |
734 | mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ |
746 | mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ |
735 | mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ |
747 | mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ |
736 | ui->tableView->resizeColumnsToContents(); |
748 | ui->tableView->resizeColumnsToContents(); |
737 | ui->tableView_2->resizeColumnsToContents(); |
749 | ui->tableView_2->resizeColumnsToContents(); |
738 | 750 | ||
739 | }
|
751 | }
|
740 | 752 | ||
741 | 753 | ||
742 | void ClassEditor::on_field_changed(){ // ïîìåíÿëîñü èìÿ ïîëÿ |
754 | void ClassEditor::on_field_changed(){ // ïîìåíÿëîñü èìÿ ïîëÿ |
743 | ClassEditor::refreshInctance(); |
755 | ClassEditor::refreshInctance(); |
744 | }
|
756 | }
|
745 | 757 | ||
746 | 758 | ||
747 | 759 | ||
748 | 760 | ||
749 | void ClassEditor::refreshInctance(){ // îáíîâèì ìîäåëü òàáëèöû-õðàíèëèùà |
761 | void ClassEditor::refreshInctance(){ // îáíîâèì ìîäåëü òàáëèöû-õðàíèëèùà |
750 | 762 | ||
751 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
763 | QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
752 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
764 | Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
753 | delete model; |
765 | delete model; |
754 | delete tableForInstance; |
766 | delete tableForInstance; |
755 | model = new QSqlTableModel(); |
767 | model = new QSqlTableModel(); |
756 | tableForInstance = new QTableView(); |
768 | tableForInstance = new QTableView(); |
757 | model->setTable(Inctance_str); |
769 | model->setTable(Inctance_str); |
758 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
770 | model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
759 | model->select(); |
771 | model->select(); |
760 | tableForInstance->setModel(model); |
772 | tableForInstance->setModel(model); |
761 | tableForInstance->setWindowTitle(Inctance_str); |
773 | tableForInstance->setWindowTitle(Inctance_str); |
762 | tableForInstance->resizeRowsToContents(); |
774 | tableForInstance->resizeRowsToContents(); |
763 | tableForInstance->show(); |
775 | tableForInstance->show(); |
764 | 776 | ||
765 | }
|
777 | }
|
766 | 778 |