mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 18:57:35 +00:00
LibGUI: Convert GProgressBar to ObjectPtr
This commit is contained in:
parent
3476a63415
commit
ceb5508fea
4 changed files with 7 additions and 5 deletions
|
@ -68,7 +68,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto statusbar = GStatusBar::construct(widget);
|
||||
|
||||
auto* progressbar = new GProgressBar(statusbar);
|
||||
auto progressbar = GProgressBar::construct(statusbar);
|
||||
progressbar->set_caption("Generating thumbnails: ");
|
||||
progressbar->set_format(GProgressBar::Format::ValueSlashMax);
|
||||
progressbar->set_visible(false);
|
||||
|
|
|
@ -43,8 +43,8 @@ int main(int argc, char** argv)
|
|||
auto* button2 = new GButton("GButton 2", main_widget);
|
||||
button2->set_enabled(false);
|
||||
|
||||
auto* progress1 = new GProgressBar(main_widget);
|
||||
auto timer = CTimer::create(100, [progress1] {
|
||||
auto progress1 = GProgressBar::construct(main_widget);
|
||||
auto timer = CTimer::create(100, [&] {
|
||||
progress1->set_value(progress1->value() + 1);
|
||||
if (progress1->value() == progress1->max())
|
||||
progress1->set_value(progress1->min());
|
||||
|
|
|
@ -100,7 +100,7 @@ static GWidget* build_gwidget(VBWidgetType type, GWidget* parent)
|
|||
return editor;
|
||||
}
|
||||
case VBWidgetType::GProgressBar: {
|
||||
auto* bar = new GProgressBar(parent);
|
||||
auto bar = GProgressBar::construct(parent);
|
||||
bar->set_format(GProgressBar::Format::NoText);
|
||||
bar->set_range(0, 100);
|
||||
bar->set_value(50);
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <LibGUI/GFrame.h>
|
||||
|
||||
class GProgressBar : public GFrame {
|
||||
C_OBJECT(GProgressBar)
|
||||
public:
|
||||
explicit GProgressBar(GWidget* parent);
|
||||
virtual ~GProgressBar() override;
|
||||
|
||||
void set_range(int min, int max);
|
||||
|
@ -28,6 +28,8 @@ public:
|
|||
void set_format(Format format) { m_format = format; }
|
||||
|
||||
protected:
|
||||
explicit GProgressBar(GWidget* parent);
|
||||
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue