0.3.1
[qanava.git] / tests / simpleqtmodel / uiProgressQt.cpp
blob4e6fb43830b40ec93f711d8ee484c9801e3343a5
1 //-----------------------------------------------------------------------------
2 // This file is a part of the Qarte software.
3 //
4 // \file uiProgressQt.cpp
5 // \author Benoit Autheman (benoit@libqanava.org)
6 // \date 2004 July 08
7 //-----------------------------------------------------------------------------
10 // Qarte headers
11 #include "uiProgressQt.h"
14 namespace qan { // ::qan
15 namespace qui { // ::qan::qui
18 /* Progress Constructor/Destructor *///----------------------------------------
19 ProgressQt::ProgressQt( QWidget* widget, int maxProgress ) :
20 qan::utl::Progress( maxProgress ),
21 _progress( 0 )
23 // Setup progress dialog (Maximum is set to 100, since updateProgress() is called
24 // directly in percents)
25 _progress = new QProgressDialog( "Processing...", "Abort", 100,
26 widget, "progress", TRUE );
27 _progress->setMinimumDuration( 0 );
28 _progress->setProgress( 0 );
31 ProgressQt::~ProgressQt( )
33 if ( _progress != 0 )
34 delete _progress;
36 //-----------------------------------------------------------------------------
40 /* Views Management *///-------------------------------------------------------
41 bool ProgressQt::getCancel( )
43 if ( _progress != 0 )
44 return _progress->wasCancelled( );
45 return false;
48 void ProgressQt::updateProgress( int percent )
50 _progress->setProgress( percent );
52 //-----------------------------------------------------------------------------
54 } // ::qan::qui
55 } // ::qan