Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 101 → Rev 102

/trunk/DBViewer/mainwindow.h
70,8 → 70,8
QString ClassName(QString class_id); //âîçâðàùàåò èìÿ êëàññà ïî åãî ID
void addChildsItems(QTreeWidgetItem *perent_class_item); // äîáîâëÿåì ê ýëåìåíòó äåðåâà â êà÷åñòâå äî÷åðíèõ ýëåìåíòîâ âñå êëàññû, äëÿ êîòîðûõ êëàññ ýëåìåíòà ÿâëÿåòñÿ êîíòåéíåðîì
QStringList classChields(QString class_id);
QMap <QString, QString> getClassList(); // ïîëó÷àåì ñïèñîê êëàññîâ
 
 
};
 
#endif // MAINWINDOW_H
/trunk/DBViewer/mainwindow.ui
6,8 → 6,8
<rect>
<x>0</x>
<y>0</y>
<width>766</width>
<height>633</height>
<width>770</width>
<height>709</height>
</rect>
</property>
<property name="windowTitle">
20,7 → 20,7
<x>20</x>
<y>10</y>
<width>731</width>
<height>541</height>
<height>591</height>
</rect>
</property>
<property name="currentIndex">
41,7 → 41,7
<x>10</x>
<y>10</y>
<width>711</width>
<height>511</height>
<height>451</height>
</rect>
</property>
<column>
65,6 → 65,19
</property>
</column>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>10</x>
<y>480</y>
<width>231</width>
<height>31</height>
</rect>
</property>
<property name="editable">
<bool>false</bool>
</property>
</widget>
</widget>
</widget>
</widget>
73,7 → 86,7
<rect>
<x>0</x>
<y>0</y>
<width>766</width>
<width>770</width>
<height>27</height>
</rect>
</property>
/trunk/DBViewer/mainwindow.cpp
22,6 → 22,7
 
MainWindow::openDataBase();
MainWindow::buildPreviewModel(tr("Ìîÿ ìîäåëü"), tr("7"));
MainWindow::getClassList();
 
}
 
441,3 → 442,29
return result;
 
}
 
 
QMap <QString, QString> MainWindow::getClassList(){ // ïîëó÷àåì ñïèñîê êëàññîâ
QMap <QString, QString> result_map;
QSqlQuery q;
QString sql_str;
int field_class_id, field_class_name;
bool ok;
sql_str = tr("select * "
" from ListOfClasses " //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì
);
q.prepare(sql_str);
ok = q.exec();
if (!ok) {
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
this, // Ðîäèòåëüñêèé âèäæåò.
QObject::tr("Database Error"), // Çàãîëîâîê.
q.lastError().text()); // Òåêñò ñîîáùåíèÿ.
return result_map; // åñëè îøèáêà - âîçâðàùàåì ïóñòîé ñïèñîê
}
field_class_id = q.record().indexOf(tr("ID"));
field_class_name = q.record().indexOf(tr("ClassName"));
 
 
return result_map;
}