QScrollBar(3qt)
π
QScrollBar β the QScrollBar(3qt) manual, but make it cute π
okay so bestie, welcome to the glow-up of the QScrollBar(3qt) page β¨ this is part 1, and there's more coming, so don't go anywhere π«Ά
πΈ NAME πΈ
QScrollBar β vertical or horizontal scroll bar π
β¨ SYNOPSIS β¨
#include <qscrollbar.h>
Inherits QWidget and QRangeControl. two whole parents, main character energy fr fr π
π«Ά Public Members
QScrollBar ( QWidget * parent, const char * name = 0 )
QScrollBar ( Orientation orientation, QWidget * parent, const char * name = 0 )
QScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, QWidget * parent, const char * name = 0 )
~QScrollBar ()
virtual void setOrientation ( Orientation )
Orientation orientation () const
virtual void setTracking ( bool enable )
bool tracking () const
bool draggingSlider () const
virtual void setPalette ( const QPalette & p )
int minValue () const
int maxValue () const
void setMinValue ( int )
void setMaxValue ( int )
int lineStep () const
int pageStep () const
void setLineStep ( int )
void setPageStep ( int )
int value () const
int sliderStart () const
QRect sliderRect () const
π Public Slots
void setValue ( int )
π₯ Signals
void valueChanged ( int value )
void sliderPressed ()
void sliderMoved ( int value )
void sliderReleased ()
void nextLine ()
void prevLine ()
void nextPage ()
void prevPage ()
π Properties
bool draggingSliderβ whether the user has clicked the mouse on the slider and is currently dragging it (read only) πint lineStepβ the line stepint maxValueβ the scroll bar's maximum valueint minValueβ the scroll bar's minimum valueOrientation orientationβ the orientation of the scroll barint pageStepβ the page stepbool trackingβ whether scroll bar tracking is enabledint valueβ the scroll bar's value
π§ Protected Members
virtual void hideEvent ( QHideEvent * )
π DESCRIPTION π
The QScrollBar widget provides a vertical or horizontal scroll bar. that's it, that's the vibe π¦
A scroll bar lets the user control a value inside a range the program gets to define, and it gives users a visible little indicator of what the current value of that range control actually is. very demure, very mindful, very informative β¨
Scroll bars come with four separate controls, and yes we're listing all four, no skipping:
- The line-up and line-down controls are little buttons the user can tap to move one "line" up or down. The meaning of line is configurable. In editors and list boxes it means one line of text; in an image viewer it might mean 20 pixels. flexible queen π
- The slider is the handle that shows the current value of the scroll bar, and the user can drag it to change that value. This part of the scroll bar is sometimes called the "thumb". (thumb!! so cute π)
- The page-up/page-down control is the area the slider slides on β aka the scroll bar's background. Clicking here moves the scroll bar towards the click. The meaning of "page" is configurable too: in editors and list boxes it means as many lines as there's space for in the widget.
- (the fourth one is in spirit, bestie, we love them all π«Ά)
QScrollBar has very few functions of its own; it mostly rides on QRangeControl. The most useful functions are setValue() to set the scroll bar directly to some value; addPage(), addLine(), subtractPage(), and subtractLine() to simulate the effects of clicking (super useful for accelerator keys); setSteps() to define the values of pageStep() and lineStep(); and setRange() to set the minValue() and maxValue() of the scroll bar. QScrollBar also has a convenience constructor so you can set most of these properties in one go. obsessed with the convenience ngl π
Some GUI styles (for example, the Windows and Motif styles provided with Qt) also use the pageStep() value to calculate the size of the slider. lowkey iconic.
In addition to the access functions from QRangeControl, QScrollBar provides a comprehensive set of signals: (and right here the original page drops a diagram that literally renders as <center>.nf </center> β we're keeping that artifact for the culture πβ¨)
QScrollBar only provides integer ranges. Note that although QScrollBar handles very large numbers, scroll bars on current screens cannot usefully control ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the scroll bar using either the keyboard or the mouse. so like, giant numbers? technically supported, practically a struggle π
A scroll bar can be controlled by the keyboard, but it has a default focusPolicy() of NoFocus. Use setFocusPolicy() to enable keyboard focus. See keyPressEvent() for a list of key bindings. π
If you need to add scroll bars to an interface, consider using the QScrollView class, which encapsulates the common uses for scroll bars. it's giving "let the class do it for you" π
the original page has two images here and both are marked [Image Omitted] π so just imagine two very beautiful scroll bars, one vertical, one horizontal, absolutely serving.
See also QSlider, QSpinBox, QScrollView, GUI Design Handbook: Scroll Bar, and Basic Widgets. β¨
π MEMBER FUNCTION DOCUMENTATION π
QScrollBar::QScrollBar ( QWidget * parent, const char * name = 0 )
Constructs a vertical scroll bar. π
The parent and name arguments are sent on to the QWidget constructor.
The minValue defaults to 0, the maxValue to 99, with a lineStep size of 1 and a pageStep size of 10, and an initial value of 0. defaults, bestie, we love a good default π
QScrollBar::QScrollBar ( Orientation orientation, QWidget * parent, const char * name = 0 )
Constructs a scroll bar.
The orientation must be Qt::Vertical or Qt::Horizontal. pick a lane, any lane π¦
The parent and name arguments are sent on to the QWidget constructor.
The minValue defaults to 0, the maxValue to 99, with a lineStep size of 1 and a pageStep size of 10, and an initial value of 0.
QScrollBar::QScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, QWidget * parent, const char * name = 0 )
Constructs a scroll bar whose value can never be smaller than minValue or greater than maxValue, whose line step size is lineStep and page step size is pageStep, and whose value is initially value (which is guaranteed to be in range using bound()). no out-of-bounds nonsense here, the bound() said periodt π
If orientation is Vertical the scroll bar is vertical and if it is Horizontal the scroll bar is horizontal. (so simple, so elegant πΈ)
The parent and name arguments are sent on to the QWidget constructor.
QScrollBar::~QScrollBar ()
Destructor. bye bestie ππ
bool QScrollBar::draggingSlider () const
Returns TRUE if the user has clicked the mouse on the slider and is currently dragging it; otherwise returns FALSE. See the "draggingSlider" property for details. π±οΈ
void QScrollBar::hideEvent ( QHideEvent * ) [virtual protected]
This function is called when the scrollbar is hidden. peekaboo but the opposite π
Reimplemented from QWidget.
int QScrollBar::lineStep () const
Returns the line step. See the "lineStep" property for details.
int QScrollBar::maxValue () const
Returns the scroll bar's maximum value. See the "maxValue" property for details.
int QScrollBar::minValue () const
Returns the scroll bar's minimum value. See the "minValue" property for details.
void QScrollBar::nextLine () [signal]
This signal is emitted when the scroll bar scrolls one line down or right. β¬οΈβ‘οΈ
void QScrollBar::nextPage () [signal]
This signal is emitted when the scroll bar scrolls one page down or right.
Orientation QScrollBar::orientation () const
Returns the orientation of the scroll bar. See the "orientation" property for details.
int QScrollBar::pageStep () const
Returns the page step. See the "pageStep" property for details.
void QScrollBar::prevLine () [signal]
This signal is emitted when the scroll bar scrolls one line up or left. β¬οΈβ¬ οΈ
void QScrollBar::prevPage () [signal]
This signal is emitted when the scroll bar scrolls one page up or left.
void QScrollBar::setLineStep ( int )
Sets the line step. See the "lineStep" property for details.
void QScrollBar::setMaxValue ( int )
Sets the scroll bar's maximum value. See the "maxValue" property for details.
void QScrollBar::setMinValue ( int )
Sets the scroll bar's minimum value. See the "minValue" property for details.
void QScrollBar::setOrientation ( Orientation ) [virtual]
Sets the orientation of the scroll bar. See the "orientation" property for details.
void QScrollBar::setPageStep ( int )
Sets the page step. See the "pageStep" property for details.
void QScrollBar::setPalette ( const QPalette & p ) [virtual]
Reimplements the virtual function QWidget::setPalette().
Sets the background color to the mid color for Motif style scroll bars using palette p. very Motif of it π
Reimplemented from QWidget.
void QScrollBar::setTracking ( bool enable ) [virtual]
Sets whether scroll bar tracking is enabled to enable. See the "tracking" property for details.
void QScrollBar::setValue ( int ) [slot]
Sets the scroll bar's value. See the "value" property for details.
void QScrollBar::sliderMoved ( int value ) [signal]
This signal is emitted when the slider is dragged by the user, with the new scroll bar value as an argument. ποΈ
This signal is emitted even when tracking is turned off. no cap.
See also tracking, valueChanged(), nextLine(), prevLine(), nextPage(), and prevPage().
void QScrollBar::sliderPressed () [signal]
This signal is emitted when the user presses the slider with the mouse. click!! β¨
QRect QScrollBar::sliderRect () const
Returns the scroll bar slider rectangle. π
See also sliderStart().
void QScrollBar::sliderReleased () [signal]
This signal is emitted when the user releases the slider with the mouse. release the slider, release the serotonin π
int QScrollBar::sliderStart () const
Returns the pixel position where the scroll bar slider starts.
This is equivalent to sliderRect().y() for vertical scroll bars or sliderRect().x() for horizontal scroll bars. y for vertical, x for horizontal, keep it straight bestie π¦
bool QScrollBar::tracking () const
Returns TRUE if scroll bar tracking is enabled; otherwise returns FALSE. See the "tracking" property for details.
int QScrollBar::value () const
Returns the scroll bar's value. See the "value" property for details.
void QScrollBar::valueChanged ( int value ) [signal]
This signal is emitted when the scroll bar value has changed, with the new scroll bar value as an argument. π
π Property Documentation π
bool draggingSlider
This property holds whether the user has clicked the mouse on the slider and is currently dragging it.
Get this property's value with draggingSlider(). read only, so no setting it, it simply is π
int lineStep
This property holds the line step.
When setting lineStep, the virtual stepChange() function will be called if the new line step is different from the previous setting. it notices when things change, very observant π
See also setSteps(), QRangeControl::pageStep(), and setRange().
Set this property's value with setLineStep() and get this property's value with lineStep().
int maxValue
This property holds the scroll bar's maximum value.
When setting this property, the QScrollBar::minValue is adjusted if necessary to ensure that the range remains valid. it self-corrects, iconic behaviour β¨
See also setRange().
Set this property's value with setMaxValue() and get this property's value with maxValue().
int minValue
This property holds the scroll bar's minimum value.
When setting this property, the QScrollBar::maxValue is adjusted if necessary to ensure that the range remains valid.
See also setRange().
Set this property's value with setMinValue() and get this property's value with minValue().
okay bestie that's the end of part 1 π more scroll bar lore incoming, stay tuned π
πΈ Orientation orientation πΈ
This property is the literal vibe direction of your scroll bar β like, which way does it go? π
It has to be either Qt::Vertical (that's the default, bestie, the classic β¨) or Qt::Horizontal.
- Set it with
setOrientation()π - Read it back with
orientation()π¦
π int pageStep π
This property is your page step β the big-jump energy, not the lil baby line step. π«Ά
Heads up tho: when you set pageStep, the virtual stepChange() function gets called if the new page step is different from the previous setting. Like, only if it actually changed, okay? No cap.
See alsoQRangeControl::setSteps(),lineStep, andsetRange(). π
- Set it with
setPageStep()β¨ - Get it with
pageStep()π
π¦ bool tracking π¦
This property is whether scroll bar tracking is enabled or not. π
Here's the tea β:
- If tracking is enabled (which is the default, periodt), the scroll bar emits the
valueChanged()signal while the slider is being dragged. Live updates, main character energy. π - If tracking is disabled, the scroll bar emits the
valueChanged()signal only when the user releases the mouse button after moving the slider. Chill, patient, mysterious. π - Set it with
setTracking()π - Get it with
tracking()β
π int value π
This property is the scroll bar's value. That's it, that's the whole thing. Iconic. π
- Set it with
setValue()π - Get it with
value()β¨
See alsoQRangeControl::value()andprevValue(). π§
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. π
β¨ AUTHOR β¨
Generated automatically from the source code. (Not me tho, I wrote this version with my whole heart. π)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά (fr fr, they mean it)
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. π
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qscrollbar.3qt) and the Qt version (3.3.8). Bestie, please include those, they literally cannot help you without them. π
and that's the whole page, babe β¨ you ate it, you read the entire QScrollBar(3qt) man page and now you're lowkey a Qt scroll bar expert, slay π
This lil masterpiece came courtesy of Trolltech AS, dated 2 February 2007, and it's the QScrollBar(3qt) page. Go forth and scroll responsibly, queen. ππ
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms