Created
April 13, 2016 09:40
-
-
Save ArthurSonzogni/7c379708d9ee09b09fe429e7442d6692 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ---------------------------------------------------------- | |
/// Author : ArthurSonzogni | |
/// License : MIT | |
/// Description : wrap a QVboxLayout into a QScrollArea | |
/// if the QVBoxLayout is to big, a scroll bar | |
/// appear and let the user scroll | |
/// ---------------------------------------------------------- | |
#ifndef BUILDSCROLLABLEWIDGETLIST_H | |
#define BUILDSCROLLABLEWIDGETLIST_H | |
#include <QScrollArea> | |
#include <QVBoxLayout> | |
#include <QWidget> | |
static inline QScrollArea* buildScrollableWidgetList(QVBoxLayout* list) | |
{ | |
auto scroll = new QScrollArea; | |
scroll->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); | |
scroll->setWidgetResizable(true); | |
auto w = new QWidget; | |
w->setLayout(list); | |
scroll->setWidget(w); | |
return scroll; | |
} | |
#endif /* end of include guard: BUILDSCROLLABLEWIDGETLIST_H */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment