110,10 → 110,31 |
|
case Qt::SizeHintRole: |
{ |
// QSize size(200,100); |
|
int height = value.toSize().height(); |
int widht = value.toSize().width(); |
if(index.column() == 5) { |
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; |
|
} |
|
|
// QSize size(200,100); |
|
return value; |
// return QVariant(size); |
// return QVariant(size); |
} |
|
case Qt::DecorationRole: { |