From 0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 4 Mar 2020 09:46:23 +0100 Subject: LibGUI: Use GUI::Window::set_main_widget() in clients --- Applications/QuickShow/main.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Applications/QuickShow') diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index df90187b08..1233fe8209 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -87,22 +87,21 @@ int main(int argc, char** argv) } auto window = GUI::Window::construct(); - auto widget = QSWidget::construct(); - widget->set_path(path); - widget->set_bitmap(*bitmap); + auto& widget = window->set_main_widget(); + widget.set_path(path); + widget.set_bitmap(*bitmap); auto update_window_title = [&](int scale) { - window->set_title(String::format("QuickShow: %s %s %d%%", widget->path().characters(), widget->bitmap()->size().to_string().characters(), scale)); + window->set_title(String::format("QuickShow: %s %s %d%%", widget.path().characters(), widget.bitmap()->size().to_string().characters(), scale)); }; window->set_double_buffering_enabled(true); update_window_title(100); window->set_rect(200, 200, bitmap->width(), bitmap->height()); - widget->on_scale_change = [&](int scale) { + widget.on_scale_change = [&](int scale) { update_window_title(scale); }; - window->set_main_widget(widget); window->show(); -- cgit v1.2.3