From 4381dd2640674c526742163eda9e4bc8489c707e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 21 Sep 2019 14:22:49 +0200 Subject: [PATCH] LibGUI: Make the GLabel constructors protected You should use GLabel::construct(...) to create new GLabels instead of invoking the constructor directly via "new". --- Libraries/LibGUI/GLabel.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Libraries/LibGUI/GLabel.h b/Libraries/LibGUI/GLabel.h index d98acdfa86..df819eb895 100644 --- a/Libraries/LibGUI/GLabel.h +++ b/Libraries/LibGUI/GLabel.h @@ -8,8 +8,6 @@ class GraphicsBitmap; class GLabel : public GFrame { C_OBJECT(GLabel) public: - explicit GLabel(GWidget* parent = nullptr); - GLabel(const StringView& text, GWidget* parent = nullptr); virtual ~GLabel() override; String text() const { return m_text; } @@ -27,9 +25,13 @@ public: void size_to_fit(); -private: +protected: + explicit GLabel(GWidget* parent = nullptr); + GLabel(const StringView& text, GWidget* parent = nullptr); + virtual void paint_event(GPaintEvent&) override; +private: String m_text; RefPtr m_icon; TextAlignment m_text_alignment { TextAlignment::Center };