From 3d9d7d54d5c1e11696445247fb954d48c6aa1b85 Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 22 Oct 2020 23:46:36 +0200 Subject: [PATCH] added missing file --- src/util/LayoutHelper.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/util/LayoutHelper.cpp diff --git a/src/util/LayoutHelper.cpp b/src/util/LayoutHelper.cpp new file mode 100644 index 000000000..ab42fadcc --- /dev/null +++ b/src/util/LayoutHelper.cpp @@ -0,0 +1,34 @@ +#include "util/LayoutHelper.hpp" + +#include +#include + +namespace chatterino { + +QWidget *wrapLayout(QLayout *layout) +{ + auto widget = new QWidget; + widget->setLayout(layout); + return widget; +} + +QScrollArea *makeScrollArea(LayoutItem item) +{ + auto area = new QScrollArea(); + + switch (item.which()) + { + case 0: + area->setWidget(boost::get(item)); + break; + case 1: + area->setWidget(wrapLayout(boost::get(item))); + break; + } + + area->setWidgetResizable(true); + + return area; +} + +} // namespace chatterino