diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-04 09:46:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-04 14:26:16 +0100 |
commit | 0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19 (patch) | |
tree | 3fc1f6f91d7e00783792e98bd23f226e591d99a3 /Applications/QuickShow | |
parent | 4697195645a4c66930761c85685f5752dc777bba (diff) | |
download | serenity-0f3e57a6fb037f6a8133e8ec2be8f0889ff9bc19.zip |
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
Diffstat (limited to 'Applications/QuickShow')
-rw-r--r-- | Applications/QuickShow/main.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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<QSWidget>(); + 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(); |