formated some alignment to Qt::AlignRight size,completed and speed

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@320 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-01-29 13:03:18 +00:00
parent 798e19d58c
commit 204fbd300b

View File

@ -95,7 +95,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case REMAINING: case REMAINING:
remaining = index.data().toLongLong(); remaining = index.data().toLongLong();
@ -135,14 +135,14 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
multi *= 1024.0; multi *= 1024.0;
} }
} }
painter->drawText(option.rect, Qt::AlignCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case DLSPEED: case DLSPEED:
dlspeed = index.data().toDouble(); dlspeed = index.data().toDouble();
temp.clear(); temp.clear();
temp.sprintf("%.2f", dlspeed/1024.); temp.sprintf("%.2f", dlspeed/1024.);
temp += " KB/s"; temp += " KB/s";
painter->drawText(option.rect, Qt::AlignCenter, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case PROGRESS: case PROGRESS:
progress = index.data().toDouble(); progress = index.data().toDouble();
@ -183,6 +183,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const QSize DLListDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
{ {
return QSize(50,17);
QVariant value = index.data(Qt::FontRole); QVariant value = index.data(Qt::FontRole);
QFont fnt = value.isValid() ? qvariant_cast<QFont>(value) : option.font; QFont fnt = value.isValid() ? qvariant_cast<QFont>(value) : option.font;
QFontMetrics fontMetrics(fnt); QFontMetrics fontMetrics(fnt);