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. More...

#include <QCustomProgressbar.h>

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

Public Member Functions

 QCustomProgressBar (QWidget *parent=nullptr)
 
virtual ~QCustomProgressBar () override
 
void setProgressColor (RGBColor color)
 Wipes and custom colors and uses the defined color as the progress bar. Parameters:
 
void addProgressColor (fltp08 percent, RGBColor color)
 Sets the progress bar color to a given one as the progress aproaches the percent. Meant to be called multiple times to form a gradiant. Parameters: percent - The percent where this color will be most prominant.
 
void setProgressColors (const Buffer< RGBColor > &colors)
 Sets the progress bar to colors depending on the percent. Parameters:
 
void clearProgressColors ()
 
virtual void setPercent (fltp08 percent)
 
fltp08 percent () const
 
bool isIndeterminateState () const
 
void setDrawBackground (bool draw_background)
 Sets whether or not the background should be drawn (Default is true)
 
virtual void setMessage (const TranslatedString &message)
 Sets the translated message to be displayed. p% will be replaced with the current progress or removed if progress is indeterminate. Translated version of setFormat.
 
void setFormat (const String &format)
 Sets the format to be displayed. p% will be replaced with the current progress or removed if progress is indeterminate. Untranslated version of setMessage.
 
virtual void setToIndeterminateState (bool is_indeterminate)
 Sets whether the procress bar is indeterminate. An indeterminate progress bar will have an animation to indicate something is happening, but that a percent could not be determined. Can also be triggered by setPercent using NaN to make indeterminate or a real number to make progress. Parameters:
 
virtual void setIndeterminateAnimationTimespan (const TimeSpan &span)
 Sets the speed of animations when progress is undefined, or NaN.
 

Protected Slots

void updateFromTimer ()
 

Protected Member Functions

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

Protected Attributes

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

Detailed Description

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


bar.

Constructor & Destructor Documentation

◆ QCustomProgressBar()

QCustomProgressBar ( QWidget * parent = nullptr)
explicit

◆ ~QCustomProgressBar()

~QCustomProgressBar ( )
overridevirtual

Member Function Documentation

◆ addProgressColor()

void addProgressColor ( fltp08 percent,
RGBColor color )

Sets the progress bar color to a given one as the progress aproaches the percent. Meant to be called multiple times to form a gradiant. Parameters: percent - The percent where this color will be most prominant.


Fn: bool QCustomProgressBar::addProgressColor(fltp08 percent, const RGBColor& colors);

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

Fn: bool QCustomProgressBar::isIndeterminateState();

Returns whether or not the widget is in an undefined or "spinning" state.

◆ minimumSizeHint()

QSize minimumSizeHint ( ) const
nodiscardoverrideprotected

◆ paintEvent()

void paintEvent ( QPaintEvent * event)
overrideprotected

◆ percent()

fltp08 percent ( ) const
nodiscard

◆ setDrawBackground()

void setDrawBackground ( bool draw_background)

Sets whether or not the background should be drawn (Default is true)


Fn: void QCustomProgressBar::setDrawBackground(bool draw_background);

Parameters:

draw_background - Whether or not to draw the background

◆ setFormat()

void setFormat ( const String & format)

Sets the format to be displayed. p% will be replaced with the current progress or removed if progress is indeterminate. Untranslated version of setMessage.


Fn: void QCustomProgressBar::setFormat(const String& span);

Parameters:

message - The message to display inside the progress widget

◆ setIndeterminateAnimationTimespan()

void setIndeterminateAnimationTimespan ( const TimeSpan & span)
virtual

Sets the speed of animations when progress is undefined, or NaN.


Fn: void QCustomProgressBar::setIndeterminateAnimationTimespan(const TimeSpan& span);

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()

void setMessage ( const TranslatedString & message)
virtual

Sets the translated message to be displayed. p% will be replaced with the current progress or removed if progress is indeterminate. Translated version of setFormat.


Fn: void QCustomProgressBar::setMessage(const TranslatedString& span);

Parameters:

message - The message to display inside the progress widget

◆ setPercent()

void setPercent ( fltp08 percent)
virtual

Fn: bool QCustomProgressBar::setPercent(fltp08 percent); Parameters: percent - The percent that the progress bar is between 0.0 and 1.0. NaN will set the value to

indeterminate or "spinning" state

◆ setProgressColor()

void setProgressColor ( RGBColor color)

Wipes and custom colors and uses the defined color as the progress bar. Parameters:


Fn: bool QCustomProgressBar::setProgressColor(RGBColor color);

color - The color to use as the progress bar

◆ setProgressColors()

void setProgressColors ( const Buffer< RGBColor > & colors)

Sets the progress bar to colors depending on the percent. Parameters:


Fn: bool QCustomProgressBar::setProgressColors(const Buffer<RGBColor>& colors);

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

◆ setToIndeterminateState()

void setToIndeterminateState ( bool is_indeterminate)
virtual

Sets whether the procress bar is indeterminate. An indeterminate progress bar will have an animation to indicate something is happening, but that a percent could not be determined. Can also be triggered by setPercent using NaN to make indeterminate or a real number to make progress. Parameters:


Fn: bool QCustomProgressBar::setProgressColor(RGBColor color);

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 files: