Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Q3ProgressBar Class Reference

The Q3ProgressBar widget provides a horizontal progress bar. More...

 #include <Q3ProgressBar>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits: QFrame.

Properties

  • 6 properties inherited from QFrame
  • 58 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

Q3ProgressBar ( QWidget * parent = 0, Qt::WindowFlags f = 0 )
Q3ProgressBar ( int totalSteps, QWidget * parent = 0, Qt::WindowFlags f = 0 )
bool centerIndicator () const
int margin () const
bool percentageVisible () const
int progress () const
const QString & progressString () const
void setCenterIndicator ( bool on )
void setMargin ( int margin )
void setPercentageVisible ( bool )
int totalSteps () const

Reimplemented Public Functions

virtual QSize minimumSizeHint () const
virtual void setVisible ( bool visible )
virtual QSize sizeHint () const
  • 14 public functions inherited from QFrame
  • 217 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 13 public functions inherited from QPaintDevice

Public Slots

void reset ()
virtual void setProgress ( int progress )
void setProgress ( int progress, int totalSteps )
virtual void setTotalSteps ( int totalSteps )
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Protected Functions

virtual bool setIndicator ( QString & indicator, int progress, int totalSteps )

Reimplemented Protected Functions

virtual void changeEvent ( QEvent * ev )
virtual void paintEvent ( QPaintEvent * )
  • 3 protected functions inherited from QFrame
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 1 signal inherited from QWidget
  • 1 signal inherited from QObject
  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 1 protected slot inherited from QWidget

Detailed Description

The Q3ProgressBar widget provides a horizontal progress bar.

A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application is still running.

The progress bar uses the concept of steps; you give it the total number of steps and the number of steps completed so far and it will display the percentage of steps that have been completed. You can specify the total number of steps in the constructor or later with setTotalSteps(). The current number of steps is set with setProgress(). The progress bar can be rewound to the beginning with reset().

If the total is given as 0 the progress bar shows a busy indicator instead of a percentage of steps. This is useful, for example, when using QFtp or QHttp to download items when they are unable to determine the size of the item being downloaded.

Screenshot in Motif style Screenshot in Windows style

See also QProgressDialog and QProgressDialog.

Property Documentation

centerIndicator : bool

This property holds whether the indicator string should be centered.

Access functions:

bool centerIndicator () const
void setCenterIndicator ( bool on )

percentageVisible : bool

This property holds whether the current progress value is displayed.

The default is true.

Access functions:

bool percentageVisible () const
void setPercentageVisible ( bool )

See also centerIndicator.

progress : int

This property holds the current amount of progress.

This property is -1 if progress counting has not started.

Access functions:

int progress () const
virtual void setProgress ( int progress )
void setProgress ( int progress, int totalSteps )

progressString : const QString

This property holds the amount of progress as a string.

This property is an empty string if progress counting has not started.

Access functions:

const QString & progressString () const

totalSteps : int

This property holds the total number of steps.

If totalSteps is 0, the progress bar will display a busy indicator.

Access functions:

int totalSteps () const
virtual void setTotalSteps ( int totalSteps )

Member Function Documentation

Q3ProgressBar::Q3ProgressBar ( QWidget * parent = 0, Qt::WindowFlags f = 0 )

Constructs a progress bar.

The total number of steps is set to 100 by default.

The parent, and widget flags, f, are passed on to the QFrame::QFrame() constructor.

See also setTotalSteps().

Q3ProgressBar::Q3ProgressBar ( int totalSteps, QWidget * parent = 0, Qt::WindowFlags f = 0 )

Constructs a progress bar.

The totalSteps is the total number of steps that need to be completed for the operation which this progress bar represents. For example, if the operation is to examine 50 files, this value would be 50. Before examining the first file, call setProgress(0); call setProgress(50) after examining the last file.

The parent, and widget flags, f, are passed to the QFrame::QFrame() constructor.

See also setTotalSteps() and setProgress().

void Q3ProgressBar::changeEvent ( QEvent * ev ) [virtual protected]

Reimplemented from QWidget::changeEvent().

int Q3ProgressBar::margin () const

Returns the width of the margin around the contents of the widget.

This function uses QWidget::getContentsMargins() to get the margin.

This function was introduced in Qt 4.2.

See also setMargin() and QWidget::getContentsMargins().

QSize Q3ProgressBar::minimumSizeHint () const [virtual]

Reimplemented from QWidget::minimumSizeHint().

void Q3ProgressBar::paintEvent ( QPaintEvent * ) [virtual protected]

Reimplemented from QWidget::paintEvent().

void Q3ProgressBar::reset () [slot]

Reset the progress bar. The progress bar "rewinds" and shows no progress.

bool Q3ProgressBar::setIndicator ( QString & indicator, int progress, int totalSteps ) [virtual protected]

This method is called to generate the text displayed in the center (or in some styles, to the left) of the progress bar.

The progress may be negative, indicating that the progress bar is in the "reset" state before any progress is set.

The default implementation is the percentage of completion or blank in the reset state. The percentage is calculated based on the progress and totalSteps. You can set the indicator text if you wish.

To allow efficient repainting of the progress bar, this method should return false if the string is unchanged from the last call to this function.

void Q3ProgressBar::setMargin ( int margin )

Sets the width of the margin around the contents of the widget to margin.

This function uses QWidget::setContentsMargins() to set the margin.

This function was introduced in Qt 4.2.

See also margin() and QWidget::setContentsMargins().

void Q3ProgressBar::setVisible ( bool visible ) [virtual]

Reimplemented from QWidget::setVisible().

QSize Q3ProgressBar::sizeHint () const [virtual]

Reimplemented from QWidget::sizeHint().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 53
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Quarterly au hasard

Logo

XQuery et la météo

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.7-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web