Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQScrollBar Class Reference

The TQScrollBar widget provides a vertical or horizontal scroll bar. More...

#include <qscrollbar.h>

Inherits TQWidget and TQRangeControl.

List of all member functions.

Public Members

Public Slots

Signals

Properties

Protected Members


Detailed Description

The TQScrollBar widget provides a vertical or horizontal scroll bar.

A scroll bar allows the user to control a value within a program-definable range and gives users a visible indication of the current value of a range control.

Scroll bars include four separate controls:

TQScrollBar has very few of its own functions; it mostly relies on TQRangeControl. 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 (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. TQScrollBar has a convenience constructor with which you can set most of these properties.

Some GUI styles (for example, the Windows and Motif styles provided with TQt), also use the pageStep() value to calculate the size of the slider.

In addition to the access functions from TQRangeControl, TQScrollBar provides a comprehensive set of signals:

Signal Emitted when
valueChanged() the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction.
sliderPressed() the user starts to drag the slider.
sliderMoved() the user drags the slider.
sliderReleased() the user releases the slider.
nextLine() the scroll bar has moved one line down or right. Line is defined in TQRangeControl.
prevLine() the scroll bar has moved one line up or left.
nextPage() the scroll bar has moved one page down or right.
prevPage() the scroll bar has moved one page up or left.

TQScrollBar only provides integer ranges. Note that although TQScrollBar 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.

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 TQScrollView class, which encapsulates the common uses for scroll bars.

See also TQSlider, TQSpinBox, TQScrollView, GUI Design Handbook: Scroll Bar, and Basic Widgets.


Member Function Documentation

TQScrollBar::TQScrollBar ( TQWidget * parent, const char * name = 0 )

Constructs a vertical scroll bar.

The parent and name arguments are sent on to the TQWidget 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.

TQScrollBar::TQScrollBar ( Orientation orientation, TQWidget * parent, const char * name = 0 )

Constructs a scroll bar.

The orientation must be TQt::Vertical or TQt::Horizontal.

The parent and name arguments are sent on to the TQWidget 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.

TQScrollBar::TQScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, TQWidget * 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()).

If orientation is Vertical the scroll bar is vertical and if it is Horizontal the scroll bar is horizontal.

The parent and name arguments are sent on to the TQWidget constructor.

TQScrollBar::~TQScrollBar ()

Destructor.

bool TQScrollBar::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 TQScrollBar::hideEvent ( TQHideEvent * ) [virtual protected]

This function is called when the scrollbar is hidden.

Reimplemented from TQWidget.

int TQScrollBar::lineStep () const

Returns the line step. See the "lineStep" property for details.

int TQScrollBar::maxValue () const

Returns the scroll bar's maximum value. See the "maxValue" property for details.

int TQScrollBar::minValue () const

Returns the scroll bar's minimum value. See the "minValue" property for details.

void TQScrollBar::nextLine () [signal]

This signal is emitted when the scroll bar scrolls one line down or right.

void TQScrollBar::nextPage () [signal]

This signal is emitted when the scroll bar scrolls one page down or right.

Orientation TQScrollBar::orientation () const

Returns the orientation of the scroll bar. See the "orientation" property for details.

int TQScrollBar::pageStep () const

Returns the page step. See the "pageStep" property for details.

void TQScrollBar::prevLine () [signal]

This signal is emitted when the scroll bar scrolls one line up or left.

void TQScrollBar::prevPage () [signal]

This signal is emitted when the scroll bar scrolls one page up or left.

void TQScrollBar::setLineStep ( int )

Sets the line step. See the "lineStep" property for details.

void TQScrollBar::setMaxValue ( int )

Sets the scroll bar's maximum value. See the "maxValue" property for details.

void TQScrollBar::setMinValue ( int )

Sets the scroll bar's minimum value. See the "minValue" property for details.

void TQScrollBar::setOrientation ( Orientation ) [virtual]

Sets the orientation of the scroll bar. See the "orientation" property for details.

void TQScrollBar::setPageStep ( int )

Sets the page step. See the "pageStep" property for details.

void TQScrollBar::setPalette ( const TQPalette & p ) [virtual]

Reimplements the virtual function TQWidget::setPalette().

Sets the background color to the mid color for Motif style scroll bars using palette p.

Reimplemented from TQWidget.

void TQScrollBar::setTracking ( bool enable ) [virtual]

Sets whether scroll bar tracking is enabled to enable. See the "tracking" property for details.

void TQScrollBar::setValue ( int ) [slot]

Sets the scroll bar's value. See the "value" property for details.

void TQScrollBar::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.

See also tracking, valueChanged(), nextLine(), prevLine(), nextPage(), and prevPage().

void TQScrollBar::sliderPressed () [signal]

This signal is emitted when the user presses the slider with the mouse.

TQRect TQScrollBar::sliderRect () const

Returns the scroll bar slider rectangle.

See also sliderStart().

void TQScrollBar::sliderReleased () [signal]

This signal is emitted when the user releases the slider with the mouse.

int TQScrollBar::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.

bool TQScrollBar::tracking () const

Returns TRUE if scroll bar tracking is enabled; otherwise returns FALSE. See the "tracking" property for details.

int TQScrollBar::value () const

Returns the scroll bar's value. See the "value" property for details.

void TQScrollBar::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().

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.

See also setSteps(), TQRangeControl::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 TQScrollBar::minValue is adjusted if necessary to ensure that the range remains valid.

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 TQScrollBar::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().

Orientation orientation

This property holds the orientation of the scroll bar.

The orientation must be TQt::Vertical (the default) or TQt::Horizontal.

Set this property's value with setOrientation() and get this property's value with orientation().

int pageStep

This property holds the page step.

When setting pageStep, the virtual stepChange() function will be called if the new page step is different from the previous setting.

See also TQRangeControl::setSteps(), lineStep, and setRange().

Set this property's value with setPageStep() and get this property's value with pageStep().

bool tracking

This property holds whether scroll bar tracking is enabled.

If tracking is enabled (the default), the scroll bar emits the valueChanged() signal while the slider is being dragged. If tracking is disabled, the scroll bar emits the valueChanged() signal only when the user releases the mouse button after moving the slider.

Set this property's value with setTracking() and get this property's value with tracking().

int value

This property holds the scroll bar's value.

Set this property's value with setValue() and get this property's value with value().

See also TQRangeControl::value() and prevValue().


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8