QScrollBar(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’… 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 step
  • int maxValue β€” the scroll bar's maximum value
  • int minValue β€” the scroll bar's minimum value
  • Orientation orientation β€” the orientation of the scroll bar
  • int pageStep β€” the page step
  • bool tracking β€” whether scroll bar tracking is enabled
  • int 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 also QRangeControl::setSteps(), lineStep, and setRange(). πŸ‘‘
  • 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 also QRangeControl::value() and prevValue(). 🧚

🌈 SEE ALSO 🌈


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