QtBase
v6.3.1
|
The QScrollBar widget provides a vertical or horizontal scroll bar. More...
#include <qscrollbar.h>
Friends | |
class | QAbstractScrollAreaPrivate |
Q_WIDGETS_EXPORT QStyleOptionSlider | qt_qscrollbarStyleOption (QScrollBar *scrollBar) |
Additional Inherited Members | |
Public Types inherited from QAbstractSlider | |
enum | SliderAction { SliderNoAction , SliderSingleStepAdd , SliderSingleStepSub , SliderPageStepAdd , SliderPageStepSub , SliderToMinimum , SliderToMaximum , SliderMove } |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Slots inherited from QAbstractSlider | |
void | setValue (int) |
void | setOrientation (Qt::Orientation) |
void | setRange (int min, int max) |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
virtual void | setVisible (bool visible) |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals inherited from QAbstractSlider | |
void | valueChanged (int value) |
void | sliderPressed () |
void | sliderMoved (int position) |
void | sliderReleased () |
void | rangeChanged (int min, int max) |
void | actionTriggered (int action) |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Static Public Member Functions inherited from QWidget | |
static void | setTabOrder (QWidget *, QWidget *) |
static QWidget * | mouseGrabber () |
static QWidget * | keyboardGrabber () |
static QWidget * | find (WId) |
static QWidget * | createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags()) |
Static Public Member Functions inherited from QObject | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
static QMetaObject::Connection ::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot) |
static QMetaObject::Connection ::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot) |
template<typename Func1 , typename Func2 > | |
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
Static Public Member Functions inherited from QPaintDevice | |
static qreal | devicePixelRatioFScale () |
Protected Types inherited from QAbstractSlider | |
enum | SliderChange { SliderRangeChange , SliderOrientationChange , SliderStepsChange , SliderValueChange } |
Protected Slots inherited from QWidget | |
void | updateMicroFocus (Qt::InputMethodQuery query=Qt::ImQueryAll) |
Protected Attributes inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Protected Attributes inherited from QPaintDevice | |
ushort | painters |
Properties inherited from QAbstractSlider | |
int | minimum |
the sliders's minimum value More... | |
int | maximum |
the slider's maximum value More... | |
int | singleStep |
the single step. More... | |
int | pageStep |
the page step. More... | |
int | value |
the slider's current value More... | |
int | sliderPosition |
the current slider position More... | |
bool | tracking |
whether slider tracking is enabled More... | |
Qt::Orientation | orientation |
the orientation of the slider More... | |
bool | invertedAppearance |
whether or not a slider shows its values inverted. More... | |
bool | invertedControls |
whether or not the slider inverts its wheel and key events. More... | |
bool | sliderDown |
whether the slider is pressed down. More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Related Functions inherited from QWidget | |
setupUi (QWidget *widget) | |
Related Functions inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
The QScrollBar widget provides a vertical or horizontal scroll bar.
\inmodule QtWidgets
A scroll bar is a control that enables the user to access parts of a document that is larger than the widget used to display it. It provides a visual indication of the user's current position within the document and the amount of the document that is visible. Scroll bars are usually equipped with other controls that enable more accurate navigation. Qt displays scroll bars in a way that is appropriate for each platform.
If you need to provide a scrolling view onto another widget, it may be more convenient to use the QScrollArea class because this provides a viewport widget and scroll bars. QScrollBar is useful if you need to implement similar functionality for specialized widgets using QAbstractScrollArea; for example, if you decide to subclass QAbstractItemView. For most other situations where a slider control is used to obtain a value within a given range, the QSlider class may be more appropriate for your needs.
\table \row
\list
Each scroll bar has a value that indicates how far the slider is from the start of the scroll bar; this is obtained with value() and set with setValue(). This value always lies within the range of values defined for the scroll bar, from \l{QAbstractSlider::minimum()}{minimum()} to \l{QAbstractSlider::minimum()}{maximum()} inclusive. The range of acceptable values can be set with setMinimum() and setMaximum(). At the minimum value, the top edge of the slider (for a vertical scroll bar) or left edge (for a horizontal scroll bar) will be at the top (or left) end of the scroll bar. At the maximum value, the bottom (or right) edge of the slider will be at the bottom (or right) end of the scroll bar.
The length of the slider is usually related to the value of the page step, and typically represents the proportion of the document area shown in a scrolling view. The page step is the amount that the value changes by when the user presses the \uicontrol{Page Up} and \uicontrol{Page Down} keys, and is set with setPageStep(). Smaller changes to the value defined by the line step are made using the cursor keys, and this quantity is set with \l{QAbstractSlider::}{setSingleStep()}.
Note that the range of values used is independent of the actual size of the scroll bar widget. You do not need to take this into account when you choose values for the range and the page step.
The range of values specified for the scroll bar are often determined differently to those for a QSlider because the length of the slider needs to be taken into account. If we have a document with 100 lines, and we can only show 20 lines in a widget, we may wish to construct a scroll bar with a page step of 20, a minimum value of 0, and a maximum value of 80. This would give us a scroll bar with five "pages".
\table \row
QScrollBar only provides integer ranges. Note that although QScrollBar handles very large numbers, scroll bars on current screens cannot usefully represent ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the slider using either the keyboard or the mouse, and the scroll arrows will have limited use.
ScrollBar inherits a comprehensive set of signals from QAbstractSlider: \list
A scroll bar can be controlled by the keyboard, but it has a default focusPolicy() of Qt::NoFocus. Use setFocusPolicy() to enable keyboard interaction with the scroll bar: \list
The slider itself can be controlled by using the \l{QAbstractSlider::triggerAction()}{triggerAction()} function to simulate user interaction with the scroll bar controls. This is useful if you have many different widgets that use a common range of values.
Most GUI styles use the pageStep() value to calculate the size of the slider.
Definition at line 55 of file qscrollbar.h.
Constructs a vertical scroll bar.
The parent argument is sent to the QWidget constructor.
The \l {QAbstractSlider::minimum} {minimum} defaults to 0, the \l {QAbstractSlider::maximum} {maximum} to 99, with a \l {QAbstractSlider::singleStep} {singleStep} size of 1 and a \l {QAbstractSlider::pageStep} {pageStep} size of 10, and an initial \l {QAbstractSlider::value} {value} of 0.
Definition at line 341 of file qscrollbar.cpp.
|
explicit |
Constructs a scroll bar with the given orientation.
The parent argument is passed to the QWidget constructor.
The \l {QAbstractSlider::minimum} {minimum} defaults to 0, the \l {QAbstractSlider::maximum} {maximum} to 99, with a \l {QAbstractSlider::singleStep} {singleStep} size of 1 and a \l {QAbstractSlider::pageStep} {pageStep} size of 10, and an initial \l {QAbstractSlider::value} {value} of 0.
Definition at line 357 of file qscrollbar.cpp.
QScrollBar::~QScrollBar | ( | ) |
Destroys the scroll bar.
Definition at line 369 of file qscrollbar.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 393 of file qscrollbar.cpp.
|
overridevirtual |
\reimp
Reimplemented from QAbstractSlider.
Definition at line 463 of file qscrollbar.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 713 of file qscrollbar.cpp.
|
protectedvirtual |
Initialize option with the values from this QScrollBar. This method is useful for subclasses when they need a QStyleOptionSlider, but don't want to fill in all the information themselves.
Definition at line 303 of file qscrollbar.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 626 of file qscrollbar.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 545 of file qscrollbar.cpp.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
\reimp
\reimp
Reimplemented from QWidget.
Definition at line 525 of file qscrollbar.cpp.
|
overridevirtual |
\reimp
Reimplemented from QWidget.
Definition at line 437 of file qscrollbar.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractSlider.
Definition at line 455 of file qscrollbar.cpp.
|
friend |
Definition at line 83 of file qscrollbar.h.
|
friend |
Definition at line 725 of file qscrollbar.cpp.