Qt:Документация 4.3.2/qslider

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

QSlider Class Reference
[модуль QtGui ]

The QSlider widget provides a vertical or horizontal slider. More...

 #include <QSlider>

Inherits QAbstractSlider.

Открытые типы

  • enum TickPosition { NoTicks, TicksBothSides, TicksAbove, TicksBelow, TicksLeft, TicksRight }

Свойства

  • 11 свойства унаследованных от QAbstractSlider
  • 56 свойства унаследованных от QWidget
  • 1 свойство унаследованное от QObject

Открытые функции

  • 22 открытых функций унаследованных от QAbstractSlider
  • 201 открытых функций унаследованных от QWidget
  • 29 открытых функций унаследованных от QObject
  • 12 открытых функций унаследованных от QPaintDevice

Защищенные функции

  • 3 защищенных функций унаследованных от QAbstractSlider
  • 38 защищенных функций унаследованных от QWidget
  • 7 защищенных функций унаследованных от QObject
  • 1 защищенная функция унаследованна от QPaintDevice

Дополнительные унаследованные члены

  • 2 открытых слотов унаследованных от QAbstractSlider
  • 19 открытых слотов унаследованных от QWidget
  • 1 открытый слот унаследованный от QObject
  • 6 сигнала унаследованных от QAbstractSlider
  • 1 сигнал унаследованный от QWidget
  • 1 сигнал унаследованный от QObject
  • 4 статических открытых члена унаследованных от QWidget
  • 5 статических открытых члена унаследованных от QObject
  • 1 защищенный слот унаследованный от QWidget

Подробное описание

The QSlider widget provides a vertical or horizontal slider.

The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical groove and translates the handle's position into an integer value within the legal range.

QSlider has very few of its own functions; most of the functionality is in QAbstractSlider. The most useful functions are setValue() to set the slider directly to some value; triggerAction() to simulate the effects of clicking (useful for shortcut keys); setSingleStep(), setPageStep() to set the steps; and setMinimum() and setMaximum() to define the range of the scroll bar.

QSlider provides methods for controlling tickmarks. You can use setTickPosition() to indicate where you want the tickmarks to be, setTickInterval() to indicate how many of them you want. the currently set tick position and interval can be queried using the tickPosition() and tickInterval() functions, respectively.

QSlider inherits a comprehensive set of signals:


Signal Description
valueChanged() Emitted when the slider's value has changed. The tracking() determines whether this signal is emitted during user interaction.
sliderPressed() Emitted when the user starts to drag the slider.
sliderMoved() Emitted when the user drags the slider.
sliderReleased() Emitted when the user releases the slider.

QSlider only provides integer ranges. Note that although QSlider handles very large numbers, it becomes difficult for users to use a slider accurately for very large ranges.

A slider accepts focus on Tab and provides both a mouse wheel and a keyboard interface. The keyboard interface is the following:

  • Left/Right move a horizontal slider by one single step.
  • Up/Down move a vertical slider by one single step.
  • PageUp moves up one page.
  • PageDown moves down one page.
  • Home moves to the start (mininum).
  • End moves to the end (maximum).


center A slider shown in the Macintosh widget style.
center A slider shown in the Windows XP widget style.
Файл:Plastique-slider.png A slider shown in the Plastique widget style.

See also QScrollBar, QSpinBox, QDial, GUI Design Handbook: Slider, and Sliders Example.


Описание типов членов

enum QSlider::TickPosition

This enum specifies where the tick marks are to be drawn relative to the slider's groove and the handle the user moves.


Constant Value Description
QSlider::NoTicks 0 Do not draw any tick marks.
QSlider::TicksBothSides 3 Draw tick marks on both sides of the groove.
QSlider::TicksAbove 1 Draw tick marks above the (horizontal) slider
QSlider::TicksBelow 2 Draw tick marks below the (horizontal) slider
QSlider::TicksLeft TicksAbove Draw tick marks to the left of the (vertical) slider
QSlider::TicksRight TicksBelow Draw tick marks to the right of the (vertical) slider

Описание свойств

tickInterval : int

This property holds the interval between tickmarks.

This is a value interval, not a pixel interval. If it is 0, the slider will choose between lineStep() and pageStep().

The default value is 0.

Функции доступа:

  • int tickInterval () const
  • void setTickInterval ( int ti )

See also tickPosition, lineStep(), and pageStep().

tickPosition : TickPosition

This property holds the tickmark position for this slider.

The valid values are described by the QSlider::TickPosition enum.

The default value is QSlider::NoTicks.

Функции доступа:

  • TickPosition tickPosition () const
  • void setTickPosition ( TickPosition position )

See also tickInterval.


Описание функций-членов

QSlider::QSlider ( QWidget * parent = 0 )

Constructs a vertical slider with the given parent.

QSlider::QSlider ( Qt::Orientation orientation, QWidget * parent = 0 )

Constructs a slider with the given parent. The orientation parameter determines whether the slider is horizontal or vertical; the valid values are Qt::Vertical and Qt::Horizontal.

QSlider::~QSlider ()

Destroys this slider.

void QSlider::initStyleOption ( QStyleOptionSlider * option ) const [protected]

Initialize option with the values from this QSlider. This method is useful for subclasses when they need a QStyleOptionSlider, but don't want to fill in all the information themselves.

See also QStyleOption::initFrom().


Copyright © 2007 Trolltech Trademarks
Qt 4.3.2