Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 112 → Rev 113

/trunk/DBViewer/database.cpp
26,23 → 26,31
QString model_name;
QString rootClassID;
QString rootClassInctance;
QFont font;
 
QTreeWidgetItem * item;
model_name = model_item->text(0);
if (model_item->checkState(0) == false) return;
 
font.setWeight(20);
font.setItalic(true);
item = new QTreeWidgetItem (ui->treeWidget_2);
item->setFont(0, font);
item->setText(0, model_name);
 
 
rootClassID = model_item->child(0)->text(1);
rootClassInctance = getClassInctance(rootClassID);
if (model_item->child(0)->checkState(0)) // åñëè â ìîäåëè êîðíåâîé êëàññ âûáðàí äëÿ îòîáðàæåíèÿ (ñòîèò ãàëî÷êà), òî
{
QTreeWidgetItem * item_tmp;
item_tmp = new QTreeWidgetItem(item); // â äåðåâå, îòîáðàæàþùåì îáúåêòû êëàññîâ, ñîçäàåì íîâûé óçåë
item_tmp->setText(0, model_item->child(0)->text(0)); // ñ íàçâàíèåì êëàññà
///// QTreeWidgetItem * item_tmp;
///// item_tmp = new QTreeWidgetItem(item); // â äåðåâå, îòîáðàæàþùåì îáúåêòû êëàññîâ, ñîçäàåì íîâûé óçåë
///// item_tmp->setText(0, model_item->child(0)->text(0)); // ñ íàçâàíèåì êëàññà
 
//showClassObjects(item_tmp, model_item->child(0)); // è âûâîäèì âñå îáúåêòû äàííîãî êëàññà
 
showObjects(item_tmp, model_item->child(0), tr(""));
///// showObjects(item_tmp, model_item->child(0), tr(""));
showObjects(item, model_item->child(0), tr(""));
}
 
 
185,11 → 193,19
QSqlQuery q;
QString sql_str;
QString str_tmp;
QTreeWidgetItem * title_item;
QFont font;
font.setWeight(40);
font.setBold(true);;
filtr_empty = filtr.isEmpty();
classID = model_item->text(1);
className = model_item->text(0);
inctance = getClassInctance(classID);
 
/*
title_item = new QTreeWidgetItem(parent_object_item);
title_item->setFont(0, font);
title_item->setText(0, className);
*/
sql_str = tr("select * "
" from " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà
);
211,7 → 227,12
}
 
field_ID = q.record().indexOf(tr("ID"));
if (q.size() <= 0) return;
title_item = new QTreeWidgetItem(parent_object_item);
title_item->setFont(0, font);
title_item->setText(0, className);
 
 
while(q.next()){
if (q.record().count() > 1)
{
220,7 → 241,8
QTreeWidgetItem * itm;
ID_tmp = q.value(field_ID).toString(); // îïðåäåëÿåì èäåíòèôèêàòîð îáúåêòà
value_tmp = q.value(1).toString(); // îïðåäåëÿåì èìÿ îáúåêòà (äîëæíî õðàíèòüñÿ â ïåðâîì ïîëå)
itm = new QTreeWidgetItem(parent_object_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó
// itm = new QTreeWidgetItem(parent_object_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó
itm = new QTreeWidgetItem(title_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó
itm->setText(0, value_tmp);
 
for (int i=0; i < model_item->childCount(); i++) // ïðîâåðÿåì, åñòü ëè ó êëàññà äî÷åðíèå êëàññû