Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 115 → Rev 116

/trunk/DBViewer/database.cpp
339,8 → 339,32
if (item_type == tr("object"))
{
QString class_id;
QString ID;
QString inctance;
QString filtr_tmp;
class_id = parent_item->text(2);
i++;
ID = item->text(2);
inctance = parent_item->text(3);
delete sql_mogel;
sql_mogel = new QSqlTableModel();
// sql_mogel = new QSqlTableModel(this);
sql_mogel->setTable(inctance);
sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
 
filtr_tmp.append(tr("`"));
filtr_tmp.append(tr("ID"));
filtr_tmp.append(tr("`"));
filtr_tmp.append(tr(" = '"));
filtr_tmp.append(ID);
filtr_tmp.append(tr("'"));
sql_mogel->setFilter(filtr_tmp);
sql_mogel->select();
ui->tableView->setModel(sql_mogel);
 
//sql_mogel->clear();
//sql_mogel->select();
// ui->tableView->setVisible(false);
// i++;
}
if (item_type == tr("class"))
{
349,26 → 373,34
QString inctance;
QString pointer_name;
QString filtr_tmp;
// sql_mogel->clear();
 
parent_object_id = parent_item->text(2);
class_id = item->text(2);
inctance = item->text(3);
pointer_name = parent_item->text(4);
 
filtr_tmp.append(tr("`"));
filtr_tmp.append(pointer_name);
filtr_tmp.append(tr("`"));
filtr_tmp.append(tr(" = '"));
filtr_tmp.append(parent_object_id);
filtr_tmp.append(tr("'"));
 
 
sql_mogel = new QSqlTableModel(this);
delete sql_mogel;
sql_mogel = new QSqlTableModel();
// sql_mogel = new QSqlTableModel(this);
sql_mogel->setTable(inctance);
sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
sql_mogel->setFilter(filtr_tmp);
 
if (!parent_object_id.isEmpty())
{
filtr_tmp.append(tr("`"));
filtr_tmp.append(pointer_name);
filtr_tmp.append(tr("`"));
filtr_tmp.append(tr(" = '"));
filtr_tmp.append(parent_object_id);
filtr_tmp.append(tr("'"));
sql_mogel->setFilter(filtr_tmp);
}
sql_mogel->select();
 
ui->tableView->setModel(sql_mogel);
 
// ui->tableView->setVisible(true);;
i++;
}