AProgressBar#
Progress bars show the progress of an operation.

| Header: | #include <AUI/View/AProgressBar.h> |
| CMake: | aui_link(my_target PUBLIC aui::views) |
Detailed Description#
Progress bars are visual indicators that show the completion progress of an operation, process, or task. Progress bars provide users with real-time feedback on progress of a defined operation.
Consider these three use cases where you might use a progress indicator:
- Loading content: While fetching content from a network, such as loading an image or data for a user profile.
- File upload: Give the user feedback on how long the upload might take.
- Long processing: While an app is processing a large amount of data, convey to the user how much of the total is complete.
Creating a basic progress bar#
The following code snippet shows a minimal progress bar implementation:
|
Key points about this code#
struct Stateholds a reactive propertyprogressrepresenting the progress bar's value. Whenprogresschanges, the UI updates reactively.- The
ProgressBarview binds.valueto the state's property, so the progress is kept in sync with the data. - Value ranges from
0.0f(0%) to1.0f(100%). - The UI updates automatically based on the state because of AUI's reactive system.
Styling#
Both AProgressBar and AProgressBar::Inner are exposed for styling purposes.
|
Examples#
examples/7guis/timer/src/main.cpp
7GUIs Timer - Timer example.
Vertical::Expanding {
Horizontal {
Label { "Elapsed Time:" },
Centered::Expanding {
_new<AProgressBar>() AUI_LET {
it & mElapsedTimeRatio;
it->setCustomStyle({ Expanding { 1, 0 } });
},
},
} AUI_WITH_STYLE { LayoutSpacing { 4_dp } },
Public Types#
Inner#
class AProgressBar::Inner
Empty structure.
Public Methods#
setValue#
- Arguments
valueprogress value, where `0.0f` = 0%, `1.0f` = 100%
Set progress bar value.
Examples:
examples/app/minesweeper/src/NewGameWindow.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
_new<AButton>("Cancel").connect(&AButton::clicked, me::close),
} AUI_WITH_STYLE { LayoutSpacing { 4_dp } },
} AUI_WITH_STYLE { LayoutSpacing { 4_dp } });
mWidth->setValue(gWidth);
mHeight->setValue(gHeight);
updateMinesMax();
mMines->setValue(gMines);
examples/app/fractal/src/FractalWindow.cpp
Fractal Example - Fractal viewer application demonstrating usage of custom shaders.
_new<ALabel>("Iterations:"),
_new<ANumberPicker>().connect(
&ANumberPicker::valueChanged, this, [fractal](int v) { fractal->setIterations(v); }) AUI_LET {
it->setMax(1000);
it->setValue(350);
},
} AUI_WITH_STYLE { LayoutSpacing { 4_dp } },
} AUI_WITH_STYLE { LayoutSpacing { 4_dp } });
fractal->focus();