Qx v0.7
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::GroupedProgressManager Class Reference

The GroupedProgressManager class produces an overall progress value from a collection of progress groups. More...

Signals

void groupMaximumChanged (Qx::ProgressGroup *group, quint64 maximum)
 
void groupValueChanged (Qx::ProgressGroup *group, quint64 value)
 
void progressUpdated (quint64 currentValue)
 
void valueChanged (quint64 value)
 

Public Member Functions

 GroupedProgressManager (QObject *parent=nullptr)
 
ProgressGroupaddGroup (const QString &name)
 
void addGroup (ProgressGroup *progressGroup)
 
ProgressGroupgroup (const QString &name)
 
quint64 maximum () const
 
void removeGroup (const QString &name)
 
quint64 value () const
 

Properties

quint64 maximum
 The maximum value of the grouped progress manager.
 
quint64 value
 The current value of the grouped progress manager.
 

Detailed Description

A GroupedProgressManager is used to convert the relative percent completion of an arbitrary number of progress groups into a total completion value in accordance with their weights.

The weighting of each progress group can be used to limit a group's contribution towards overall progress to a certain proportion, regardless of that individual group's number of steps.

Qx::ProgressGroup* fileGroup = gpm.addGroup("File Copies");
fileGroup->setMaximum(100);
fileGroup->setValue(50); // 50% completion of "File Copies"
fileGroup->setWeight(3);
Qx::ProgressGroup* coolGroup = gpm.addGroup("Cool Stuff");
coolGroup->setMaximum(100);
coolGroup->setValue(0); // 0% completion of "Cool Stuff"
coolGroup->setWeight(7);
quint64 overallProgress = gpm.value(); // overallProgress = 15

The above example shows how even though the progress group "File Copies" is 50% complete, the progress reported by the grouped progress manager is only 15%, because the weighting of both groups dictates that "File Copies" only accounts for 3/(7 + 3) = 0.3 (or 30%) of overall progress.

A grouped progress manager always reports overall progress as a value from 0 to 100.

See also
ProgressGroup, QProgressBar

Constructor & Destructor Documentation

◆ GroupedProgressManager()

Qx::GroupedProgressManager::GroupedProgressManager ( QObject * parent = nullptr)
explicit

Constructs a GroupedProgressManager with the specified parent.

Member Function Documentation

◆ addGroup() [1/2]

ProgressGroup * Qx::GroupedProgressManager::addGroup ( const QString & name)

Adds a new progress group with the given name to the manager.

If a group with that name already exists, it will be replaced.

◆ addGroup() [2/2]

void Qx::GroupedProgressManager::addGroup ( ProgressGroup * progressGroup)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Adds progress group progressGroup to the manager.

If a group with the same name is already present, it will be replaced.

◆ group()

ProgressGroup * Qx::GroupedProgressManager::group ( const QString & name)

Returns a pointer to the progress group with the given name, or nullptr if it does not exist within the manager.

◆ groupMaximumChanged

void Qx::GroupedProgressManager::groupMaximumChanged ( Qx::ProgressGroup * group,
quint64 maximum )
signal

This signal is emitted whenever a managed group's maximum value changes. The group parameter will contain a pointer to the group whose maximum changed, while maximum will contain the new maximum.

See also
ProgressGroup::maximumChanged().

◆ groupValueChanged

void Qx::GroupedProgressManager::groupValueChanged ( Qx::ProgressGroup * group,
quint64 value )
signal

This signal is emitted whenever a managed group's value changes. The group parameter will contain a pointer to the group whose value changed, while value will contain the new value.

See also
ProgressGroup::valueChanged().

◆ maximum()

quint64 Qx::GroupedProgressManager::maximum ( ) const

Returns the maximum value of the manager.

This function will always return 100, and exists as a convenience method so that user code does not need to remember this.

◆ progressUpdated

void Qx::GroupedProgressManager::progressUpdated ( quint64 currentValue)
signal

This signal is emitted whenever the progress of any group handled by the manager changes, even if the change was too small to affect the weighted sum of the manager itself.

currentValue will contain the current value of the manager, which may not differ from the last time this signal was emitted.

This is useful if you need to be notified when progress has changed by any amount whatsoever.

Note
Since this value is recalculated every time a progress group is added to the manager, in manner that may result the value going up and down, it is recommended to not connect this signal to an observer until the manager has been fully initialized for a given use.
See also
valueChanged().

◆ removeGroup()

void Qx::GroupedProgressManager::removeGroup ( const QString & name)

Removes the group named name from the manager, if present.

◆ value()

quint64 Qx::GroupedProgressManager::value ( ) const

Returns the current value of the manager.

◆ valueChanged

void Qx::GroupedProgressManager::valueChanged ( quint64 value)
signal

This signal is emitted whenever the grouped progress manager's current value changes.

Note
Since this value is recalculated every time a progress group is added to the manager, in manner that may result the value going up and down, it is recommended to not connect this signal to an observer until the manager has been fully initialized for a given use.
See also
progressUpdated(), and groupValueChanged().

Property Documentation

◆ maximum

quint64 Qx::GroupedProgressManager::maximum
read

This value is always 100.

◆ value

quint64 Qx::GroupedProgressManager::value
read

This value will always be between 0 and 100.

The default is 0.


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