Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 201 → Rev 202

/trunk/DBViewer/mymodel.cpp
125,8 → 125,12
QVariant value = QSqlTableModel::data(index, role);
QList <int> keys;
QStringList values;
QList <int> files_keys;
QStringList files_values;
keys = pointers_map.keys(); // ñïèñîê ñòîëáöîâ ñ óêàçàòåëÿìè
values = pointers_map.values(); // ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ
files_keys = files_map.keys(); // ñïèñîê íîìåðîâ ñòîëáöîâ, õðàíÿùèõ ôàéëû
files_values = files_map.values(); // ñïèñîê èìåò ñòîëáöîâ, õðàíÿùèõ ôàéëû
 
switch (role) {
case Qt::DisplayRole:
140,7 → 144,19
int index_of_list;
index_of_list = keys.indexOf(index.column());
 
if (index_of_list == -1) return value;
if (index_of_list == -1){ // ñòîëáåö íå ÿâëÿåòñÿ óêàçàòåëåì, ïðîâåðèì, ìîæåò îí õðàíèò ôàéë
index_of_list = files_keys.indexOf(index.column());
if (index_of_list == -1) return value; // íåò, ñòîëáåö íå õðàíèò ôàéë
QString file_name;
QByteArray data_tmp;
data_tmp = value.toByteArray();
if (data_tmp.isEmpty() || data_tmp.isNull()) return value;
else {
QDataStream out (&data_tmp,QIODevice::ReadOnly);
out >> file_name;
return file_name;
}
}
else {
QString parentInctance;
QSqlQuery q;