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 QSCROLLBAR_H
5#define QSCROLLBAR_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qwidget.h>
9
10#include <QtWidgets/qabstractslider.h>
11
12QT_REQUIRE_CONFIG(scrollbar);
13
14QT_BEGIN_NAMESPACE
15
16class QScrollBarPrivate;
17class QStyleOptionSlider;
18
19class Q_WIDGETS_EXPORT QScrollBar : public QAbstractSlider
20{
21 Q_OBJECT
22public:
23 explicit QScrollBar(QWidget *parent = nullptr);
24 explicit QScrollBar(Qt::Orientation, QWidget *parent = nullptr);
25 ~QScrollBar();
26
27 QSize sizeHint() const override;
28 bool event(QEvent *event) override;
29
30protected:
31#if QT_CONFIG(wheelevent)
32 void wheelEvent(QWheelEvent *) override;
33#endif
34 void paintEvent(QPaintEvent *) override;
35 void mousePressEvent(QMouseEvent *) override;
36 void mouseReleaseEvent(QMouseEvent *) override;
37 void mouseMoveEvent(QMouseEvent *) override;
38 void hideEvent(QHideEvent*) override;
39 void sliderChange(SliderChange change) override;
40#ifndef QT_NO_CONTEXTMENU
41 void contextMenuEvent(QContextMenuEvent *) override;
42#endif
43 virtual void initStyleOption(QStyleOptionSlider *option) const;
44
45
46private:
47 friend class QAbstractScrollAreaPrivate;
48 friend Q_WIDGETS_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar);
49
50 Q_DISABLE_COPY(QScrollBar)
51 Q_DECLARE_PRIVATE(QScrollBar)
52#if QT_CONFIG(itemviews)
53 friend class QTableView;
54 friend class QTreeViewPrivate;
55 friend class QCommonListViewBase;
56 friend class QListModeViewBase;
57 friend class QAbstractItemView;
58#endif
59};
60
61QT_END_NAMESPACE
62
63#endif // QSCROLLBAR_H
64

source code of qtbase/src/widgets/widgets/qscrollbar.h