diff options
-rw-r--r-- | Applications/FileManager/main.cpp | 2 | ||||
-rwxr-xr-x | Demos/WidgetGallery/main.cpp | 4 | ||||
-rw-r--r-- | DevTools/VisualBuilder/VBWidgetRegistry.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/GProgressBar.h | 4 |
4 files changed, 7 insertions, 5 deletions
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index ae0244b442..310f3a6ec5 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -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); diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp index 64cbe9657d..5c870c3646 100755 --- a/Demos/WidgetGallery/main.cpp +++ b/Demos/WidgetGallery/main.cpp @@ -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()); diff --git a/DevTools/VisualBuilder/VBWidgetRegistry.cpp b/DevTools/VisualBuilder/VBWidgetRegistry.cpp index 3852a9b9d9..8961b55690 100644 --- a/DevTools/VisualBuilder/VBWidgetRegistry.cpp +++ b/DevTools/VisualBuilder/VBWidgetRegistry.cpp @@ -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); diff --git a/Libraries/LibGUI/GProgressBar.h b/Libraries/LibGUI/GProgressBar.h index 0db9e5f529..da5db4a9a3 100644 --- a/Libraries/LibGUI/GProgressBar.h +++ b/Libraries/LibGUI/GProgressBar.h @@ -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: |