diff --git a/Widgets/Label.cpp b/Widgets/Label.cpp index 0f53fc50c4..5d23e84294 100644 --- a/Widgets/Label.cpp +++ b/Widgets/Label.cpp @@ -22,9 +22,9 @@ void Label::setText(String&& text) void Label::onPaint(PaintEvent&) { Painter painter(*this); - painter.fillRect({ 0, 0, width(), height() }, Color(0x0, 0x0, 0x0)); + painter.fillRect({ 0, 0, width(), height() }, backgroundColor()); if (!text().isEmpty()) - painter.drawText({ 4, 4, width(), height() }, text(), Painter::TextAlignment::TopLeft, Color(0xff, 0xff, 0xff)); + painter.drawText({ 4, 4, width(), height() }, text(), Painter::TextAlignment::TopLeft, foregroundColor()); } void Label::onMouseMove(MouseEvent& event) diff --git a/Widgets/test.cpp b/Widgets/test.cpp index 404b80f5fb..f27ced63e4 100644 --- a/Widgets/test.cpp +++ b/Widgets/test.cpp @@ -44,21 +44,27 @@ int main(int argc, char** argv) l4->setWindowRelativeRect({ 0, 60, 300, 20 }); l4->setText("!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~"); - auto* widgetTestWindow = new Window; - widgetTestWindow->setTitle("Widget test"); - widgetTestWindow->setRect({ 20, 40, 100, 100 }); + { + auto* widgetTestWindow = new Window; + widgetTestWindow->setTitle("Widget test"); + widgetTestWindow->setRect({ 20, 40, 100, 60 }); - auto* widgetTestWindowWidget = new Widget; - widgetTestWindowWidget->setWindowRelativeRect({ 0, 0, 100, 100 }); - widgetTestWindow->setMainWidget(widgetTestWindowWidget); - - auto* b = new Button(widgetTestWindowWidget); - b->setWindowRelativeRect({ 0, 0, 100, 30 }); - b->setCaption("Button"); + auto* widgetTestWindowWidget = new Widget; + widgetTestWindowWidget->setWindowRelativeRect({ 0, 0, 100, 100 }); + widgetTestWindow->setMainWidget(widgetTestWindowWidget); - auto* c = new CheckBox(widgetTestWindowWidget); - c->setWindowRelativeRect({ 0, 30, 100, 30 }); - c->setCaption("CheckBox"); + auto* l = new Label(widgetTestWindowWidget); + l->setWindowRelativeRect({ 0, 0, 100, 20 }); + l->setText("Label"); + + auto* b = new Button(widgetTestWindowWidget); + b->setWindowRelativeRect({ 0, 20, 100, 20 }); + b->setCaption("Button"); + + auto* c = new CheckBox(widgetTestWindowWidget); + c->setWindowRelativeRect({ 0, 40, 100, 20 }); + c->setCaption("CheckBox"); + } auto* win = new Window; win->setTitle("Console");