added for Uploads progess xprogressbar

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@715 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-08-31 19:57:21 +00:00
parent 174c3f7377
commit 9ca175308d
2 changed files with 8 additions and 16 deletions

View File

@ -122,23 +122,14 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
painter->drawText(option.rect, Qt::AlignRight, temp); painter->drawText(option.rect, Qt::AlignRight, temp);
break; break;
case UPROGRESS: case UPROGRESS:
{
progress = index.data().toDouble(); progress = index.data().toDouble();
temp.clear(); // create a xProgressBar
temp.sprintf("%.2f", progress); xProgressBar progressBar(option.rect, painter); // the 3rd param is the color schema (0 is the default value)
temp += "%"; progressBar.setDisplayText(false); // should display % text?
newopt.rect = opt.rect; progressBar.setValue(progress); // set the progress value
//newopt.text = temp; progressBar.setVerticalSpan(1);
newopt.maximum = 100; progressBar.paint(); // paint the progress bar
newopt.minimum = 0;
newopt.progress = (int)progress;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = false;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
//We prefer to display text manually to control color/font/boldness
if (option.state & QStyle::State_Selected){
opt.palette.setColor(QPalette::Text, QColor("grey"));
painter->setPen(opt.palette.color(cg, QPalette::Text));
} }
painter->drawText(option.rect, Qt::AlignCenter, newopt.text); painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
break; break;

View File

@ -23,6 +23,7 @@
#define ULLISTDELEGATE_H #define ULLISTDELEGATE_H
#include <QAbstractItemDelegate> #include <QAbstractItemDelegate>
#include "xprogressbar.h"
// Defines for upload list list columns // Defines for upload list list columns
#define USERNAME 0 #define USERNAME 0