mirror-chatterino2/src/util/LayoutHelper.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
632 B
C++
Raw Normal View History

2020-10-22 23:46:36 +02:00
#include "util/LayoutHelper.hpp"
#include <QScrollArea>
#include <QWidget>
namespace chatterino {
QWidget *wrapLayout(QLayout *layout)
{
auto widget = new QWidget;
widget->setLayout(layout);
return widget;
}
2020-10-23 09:32:45 +02:00
QScrollArea *makeScrollArea(WidgetOrLayout item)
2020-10-22 23:46:36 +02:00
{
auto area = new QScrollArea();
switch (item.which())
{
case 0:
area->setWidget(boost::get<QWidget *>(item));
break;
case 1:
area->setWidget(wrapLayout(boost::get<QLayout *>(item)));
break;
}
area->setWidgetResizable(true);
return area;
}
} // namespace chatterino