Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qabstractscrollarea_p.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 QABSTRACTSCROLLAREA_P_H
5#define QABSTRACTSCROLLAREA_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "private/qframe_p.h"
20#include "qabstractscrollarea.h"
21#include <QtGui/private/qgridlayoutengine_p.h>
22
24
25#if QT_CONFIG(scrollarea)
26
27class QScrollBar;
28class QAbstractScrollAreaScrollBarContainer;
29
30class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate
31{
32 Q_DECLARE_PUBLIC(QAbstractScrollArea)
33
34public:
35 QAbstractScrollAreaPrivate();
36 ~QAbstractScrollAreaPrivate();
37
38 void replaceScrollBar(QScrollBar *scrollBar, Qt::Orientation orientation);
39
40 QHVContainer<QAbstractScrollAreaScrollBarContainer *> scrollBarContainers;
41 QScrollBar *hbar, *vbar;
42 Qt::ScrollBarPolicy vbarpolicy, hbarpolicy;
43
44 bool shownOnce;
45 bool inResize;
46 mutable QSize sizeHint;
47 QAbstractScrollArea::SizeAdjustPolicy sizeAdjustPolicy;
48
50 QWidget *cornerWidget;
51 QRect cornerPaintingRect;
52
53 int left, top, right, bottom; // viewport margin
54
55 int xoffset, yoffset;
56 QPoint overshoot;
57
58 void init();
59 void layoutChildren();
60 void layoutChildren_helper(bool *needHorizontalScrollbar, bool *needVerticalScrollbar);
61 virtual void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) {}
62 virtual bool canStartScrollingAt( const QPoint &startPos ) const;
63
64 void flashScrollBars();
65 void setScrollBarTransient(QScrollBar *scrollBar, bool transient);
66
67 void _q_hslide(int);
68 void _q_vslide(int);
69 void _q_showOrHideScrollBars();
70
71 virtual QPoint contentsOffset() const;
72
73 inline bool viewportEvent(QEvent *event)
74 { return q_func()->viewportEvent(event); }
75 QScopedPointer<QObject> viewportFilter;
76};
77
78class QAbstractScrollAreaFilter : public QObject
79{
81public:
82 QAbstractScrollAreaFilter(QAbstractScrollAreaPrivate *p) : d(p)
83 { setObjectName(QLatin1StringView("qt_abstractscrollarea_filter")); }
84 bool eventFilter(QObject *o, QEvent *e) override
85 { return (o == d->viewport ? d->viewportEvent(e) : false); }
86private:
87 QAbstractScrollAreaPrivate *d;
88};
89
90class QBoxLayout;
91class QAbstractScrollAreaScrollBarContainer : public QWidget
92{
93public:
94 enum LogicalPosition { LogicalLeft = 1, LogicalRight = 2 };
95
96 QAbstractScrollAreaScrollBarContainer(Qt::Orientation orientation, QWidget *parent);
97 void addWidget(QWidget *widget, LogicalPosition position);
98 QWidgetList widgets(LogicalPosition position);
99 void removeWidget(QWidget *widget);
100
103private:
104 int scrollBarLayoutIndex() const;
105
106 Qt::Orientation orientation;
107};
108
109#endif // QT_CONFIG(scrollarea)
110
112
113#endif // QABSTRACTSCROLLAREA_P_H
The QBoxLayout class lines up child widgets horizontally or vertically.
Definition qboxlayout.h:21
\inmodule QtCore
Definition qcoreevent.h:45
void init()
Definition qframe.cpp:33
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QScrollBar widget provides a vertical or horizontal scroll bar.
Definition qscrollbar.h:20
\inmodule QtCore
Definition qsize.h:25
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
object setObjectName("A new object name")
Combined button and popup list for selecting options.
Orientation
Definition qnamespace.h:98
ScrollBarPolicy
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLint GLint GLint yoffset
GLint left
GLint GLint bottom
GLint GLint xoffset
struct _cl_event * event
GLfloat GLfloat p
[1]
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_AUTOTEST_EXPORT
#define Q_OBJECT
QList< QWidget * > widgets
[11]
QVBoxLayout * layout
QScrollBar * scrollBar
view viewport() -> scroll(dx, dy, deviceRect)
gridLayout addWidget(nameLabel, 0, 0)