Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qscrollarea.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSCROLLAREA_H
5#define QSCROLLAREA_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractscrollarea.h>
9
11
12QT_BEGIN_NAMESPACE
13
14class QScrollAreaPrivate;
15
16class Q_WIDGETS_EXPORT QScrollArea : public QAbstractScrollArea
17{
18 Q_OBJECT
19 Q_PROPERTY(bool widgetResizable READ widgetResizable WRITE setWidgetResizable)
20 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
21
22public:
23 explicit QScrollArea(QWidget *parent = nullptr);
24 ~QScrollArea();
25
26 QWidget *widget() const;
27 void setWidget(QWidget *widget);
28 QWidget *takeWidget();
29
30 bool widgetResizable() const;
31 void setWidgetResizable(bool resizable);
32
33 QSize sizeHint() const override;
34
35 bool focusNextPrevChild(bool next) override;
36
37 Qt::Alignment alignment() const;
38 void setAlignment(Qt::Alignment);
39
40 void ensureVisible(int x, int y, int xmargin = 50, int ymargin = 50);
41 void ensureWidgetVisible(QWidget *childWidget, int xmargin = 50, int ymargin = 50);
42
43protected:
44 QScrollArea(QScrollAreaPrivate &dd, QWidget *parent = nullptr);
45 bool event(QEvent *) override;
46 bool eventFilter(QObject *, QEvent *) override;
47 void resizeEvent(QResizeEvent *) override;
48 void scrollContentsBy(int dx, int dy) override;
49
50 QSize viewportSizeHint() const override;
51
52private:
53 Q_DECLARE_PRIVATE(QScrollArea)
54 Q_DISABLE_COPY(QScrollArea)
55};
56
57QT_END_NAMESPACE
58
59#endif // QSCROLLAREA_H
The QScrollArea class provides a scrolling view onto another widget.
Definition qscrollarea.h:17
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(scrollarea)