1 #include "ProgressBar.h"
2 #include "ObservedWidget.h"
4 #include <QProgressBar>
11 ProgressBar::ProgressBar( const QString &aTitle, bool aCancellable, QWidget *aParent ) :
14 qDebug() << "ProgressBar::ProgressBar( const QString &, bool, QWidget *)";
15 setWindowTitle( aTitle );
18 iProgress = new QProgressBar();
19 iProgress->setMinimumWidth( 200 );
20 iProgress->setRange( 0, 0 );
22 iProgress->setTextVisible( false );
24 QVBoxLayout *mainLayout = new QVBoxLayout;
25 iLabel = new QLabel();
26 mainLayout->addWidget( iLabel );
27 QHBoxLayout *subLayout = new QHBoxLayout;
28 subLayout->addWidget( iProgress );
30 iButton = new QPushButton( tr( "Cancel" ) );
31 subLayout->addSpacing( 5 );
32 subLayout->addWidget( iButton );
33 connect( iButton, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
35 iButton->setVisible( false );
38 mainLayout->addLayout( subLayout );
39 mainLayout->setAlignment( Qt::AlignCenter );
40 setLayout( mainLayout );
43 ProgressBar::~ProgressBar()
45 qDebug() << "ProgressBar::~ProgressBar()";
48 void ProgressBar::update( const QString &aMessage, const QString &aTitle )
50 qDebug() << "ProgressBar::update( const QString & )";
51 iLabel->setText( aMessage );
53 setWindowTitle( aTitle );
56 void ProgressBar::toggleCancellable( bool aEnable )
59 iButton->setVisible( true );
61 iButton->setVisible( false );