Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 179 → Rev 187

/trunk/DBViewer/mymodel.cpp
4,6 → 4,7
QSqlTableModel(parent)
{
setEditStrategy(QSqlTableModel::OnManualSubmit);
icon_index = -1;
}
 
Qt::ItemFlags MyModel::flags(
223,8 → 224,32
}
}
 
case Qt::SizeHintRole:return value;
case Qt::SizeHintRole:
{
 
int height = value.toSize().height();
int widht = value.toSize().width();
if(index.column() == icon_index) {
QVariant currentImage = QSqlTableModel::data(index, 0);
QByteArray bytes = currentImage.toByteArray();
QPixmap pxmp;
 
 
if (currentImage.isValid()) {
pxmp.loadFromData(bytes);
if (height < pxmp.height()) height = pxmp.height() +10;
if (widht < pxmp.width()) widht = pxmp.width() +10;
return QVariant(QSize(widht, height));
 
}
else return value;
 
}
 
 
 
return value;
}
}
return value;
}