12345678910111213141516171819202122 |
- #include "verticalscrollarea.h"
- #include <QVBoxLayout>
-
- VerticalScrollArea::VerticalScrollArea(QWidget *parent) : QScrollArea(parent)
- {
- setWidgetResizable(true);
- }
-
- void VerticalScrollArea::setWidget(QWidget *widget)
- {
- if(widget != 0)
- widget->installEventFilter(this);
- QScrollArea::setWidget(widget);
- }
-
- bool VerticalScrollArea::eventFilter(QObject *o, QEvent *e)
- {
- if(o == widget() && e->type() == QEvent::Resize)
- setMinimumWidth(widget()->minimumSizeHint().width() + verticalScrollBar()->width());
-
- return false;
- }
|