API Documentation
Loading...
Searching...
No Matches
QCustomProgressBar Class Reference

Allows for showing of progress bar in horizontal format. Defaults to look and feel of system progress bar. More...

#include <QCustomProgressbar.h>

Inheritance diagram for QCustomProgressBar:
[legend]
Collaboration diagram for QCustomProgressBar:
[legend]

Public Member Functions

void addProgressColor (fltp08 percent, RGBColor color)
 
void clearProgressColors ()
 
bool isIndeterminateState () const
 
fltp08 percent () const
 
 QCustomProgressBar (QWidget *parent=nullptr)
 
void setDrawBackground (bool draw_background)
 
void setFormat (const String &format)
 
virtual void setIndeterminateAnimationTimespan (const TimeSpan &span)
 
virtual void setMessage (const TranslatedString &message)
 
virtual void setPercent (fltp08 percent)
 
void setProgressColor (RGBColor color)
 
void setProgressColors (const Buffer< RGBColor > &colors)
 
virtual void setToIndeterminateState (bool is_indeterminate)
 
virtual ~QCustomProgressBar () override
 

Protected Slots

void updateFromTimer ()
 

Protected Member Functions

QString customText () const
 
fltp08 indeterminatePercent () const
 
QSize minimumSizeHint () const override
 
void paintEvent (QPaintEvent *event) override
 
QSize sizeHint () const override
 
void updateProgressColor ()
 

Protected Attributes

bool m_draw_background
 
TimeSpan m_indeterminate_period = TimeSpan(1.0)
 
QString m_last_text
 
Buffer< std::pair< fltp08, RGBColor > > m_progress_colors
 
QTimer * m_update_timer
 

Detailed Description

Allows for showing of progress bar in horizontal format. Defaults to look and feel of system 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 percent from 0.0 to 1.0. It will display the percentage specified or can be set to an indeterminate or "spinning" state to indicate progress is occuring, but at an unknown rate.

Constructor & Destructor Documentation

◆ QCustomProgressBar()

QCustomProgressBar ( QWidget * parent = nullptr)
explicit

◆ ~QCustomProgressBar()

virtual ~QCustomProgressBar ( )
overridevirtual

Member Function Documentation

◆ addProgressColor()

void addProgressColor ( fltp08 percent,
RGBColor color )

called multiple times to form a gradiant. Parameters: percent - The percent where this color will be most prominant. color - The color use at the given percent

◆ clearProgressColors()

void clearProgressColors ( )

◆ customText()

QString customText ( ) const
nodiscardprotected

◆ indeterminatePercent()

fltp08 indeterminatePercent ( ) const
nodiscardprotected

◆ isIndeterminateState()

bool isIndeterminateState ( ) const
nodiscard

◆ minimumSizeHint()

QSize minimumSizeHint ( ) const
nodiscardoverrideprotected

◆ paintEvent()

void paintEvent ( QPaintEvent * event)
overrideprotected

◆ percent()

fltp08 percent ( ) const
nodiscard

◆ setDrawBackground()

void setDrawBackground ( bool draw_background)

Parameters: draw_background - Whether or not to draw the background

◆ setFormat()

void setFormat ( const String & format)

if progress is indeterminate. Untranslated version of setMessage.

Parameters: message - The message to display inside the progress widget

◆ setIndeterminateAnimationTimespan()

virtual void setIndeterminateAnimationTimespan ( const TimeSpan & span)
virtual

Parameters: span - The span of time between a complete rotation or color animation when the widget is set to indeterminate progress

Reimplemented in ProgressWidget.

◆ setMessage()

virtual void setMessage ( const TranslatedString & message)
virtual

if progress is indeterminate. Translated version of setFormat.

Parameters: message - The message to display inside the progress widget

◆ setPercent()

virtual void setPercent ( fltp08 percent)
virtual

percent - The percent that the progress bar is between 0.0 and 1.0. Invalid will set the value to indeterminate or "spinning" state

◆ setProgressColor()

void setProgressColor ( RGBColor color)

Parameters: color - The color to use as the progress bar

◆ setProgressColors()

void setProgressColors ( const Buffer< RGBColor > & colors)

Parameters: colors - The colors to use. Will be evenly spaced out across progress.

◆ setToIndeterminateState()

virtual void setToIndeterminateState ( bool is_indeterminate)
virtual

an animation to indicate something is happening, but that a percent could not be determined. Can also be triggered by setPercent using Invalid to make indeterminate or a real number to make progress. Parameters: is_indeterminate - whether to make the progress bar indeterminate

◆ sizeHint()

QSize sizeHint ( ) const
nodiscardoverrideprotected

◆ updateFromTimer

void updateFromTimer ( )
protectedslot

◆ updateProgressColor()

void updateProgressColor ( )
protected

Member Data Documentation

◆ m_draw_background

bool m_draw_background
protected

◆ m_indeterminate_period

TimeSpan m_indeterminate_period = TimeSpan(1.0)
protected

◆ m_last_text

QString m_last_text
protected

◆ m_progress_colors

Buffer<std::pair<fltp08, RGBColor> > m_progress_colors
protected

◆ m_update_timer

QTimer* m_update_timer
protected

The documentation for this class was generated from the following file: