Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Fonctions  · 

QSlider Class Reference

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

#include <qslider.h>

Inherits QWidget and QRangeControl.

List of all member functions.

Public Members

Public Slots

Signals

Important Inherited Members

  • void setRange ( int minValue, int maxValue )

Properties

  • int lineStep - the current line step
  • int maxValue - the current maximum value of the slider
  • int minValue - the current minimum value of the slider
  • Orientation orientation - the slider's orientation
  • int pageStep - the current page step
  • int tickInterval - the interval between tickmarks
  • TickSetting tickmarks - the tickmark settings for this slider
  • bool tracking - whether slider tracking is enabled
  • int value - the current slider value

Protected Members


Detailed Description

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 along a horizontal or vertical groove and translates the slider's position into an integer value within the legal range.

QSlider inherits QRangeControl, which provides the "integer" side of the slider. setRange() and value() are likely to be used by practically all slider users; see the QRangeControl documentation for information about the many other functions that class provides.

The main functions offered by the slider itself are tickmark and orientation control; you can use setTickmarks() to indicate where you want the tickmarks to be, setTickInterval() to indicate how many of them you want and setOrientation() to indicate whether the slider is to be horizontal or vertical.

A slider accepts focus on Tab and uses the mouse wheel and a suitable keyboard interface.

See also QScrollBar, QSpinBox, GUI Design Handbook: Slider, and Basic Widgets.


Member Type Documentation

QSlider::TickSetting

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

  • QSlider::NoMarks - do not draw any tickmarks.
  • QSlider::Both - draw tickmarks on both sides of the groove.
  • QSlider::Above - draw tickmarks above the (horizontal) slider
  • QSlider::Below - draw tickmarks below the (horizontal) slider
  • QSlider::Left - draw tickmarks to the left of the (vertical) slider
  • QSlider::Right - draw tickmarks to the right of the (vertical) slider

Member Function Documentation

QSlider::QSlider ( QWidget * parent, const char * name = 0 )

Constructs a vertical slider.

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

QSlider::QSlider ( Orientation orientation, QWidget * parent, const char * name = 0 )

Constructs a slider.

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

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

QSlider::QSlider ( int minValue, int maxValue, int pageStep, int value, Orientation orientation, QWidget * parent, const char * name = 0 )

Constructs a slider whose value can never be smaller than minValue or greater than maxValue, whose page step size is pageStep and whose value is initially value (which is guaranteed to be in range using bound()).

If orientation is Qt::Vertical the slider is vertical and if it is Qt::Horizontal the slider is horizontal.

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

QSlider::~QSlider ()

Destructor.

void QSlider::addStep () [slot]

Moves the slider one pageStep() up or right.

int QSlider::lineStep () const

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

int QSlider::maxValue () const

Returns the current maximum value of the slider. See the "maxValue" property for details.

int QSlider::minValue () const

Returns the current minimum value of the slider. See the "minValue" property for details.

Orientation QSlider::orientation () const

Returns the slider's orientation. See the "orientation" property for details.

int QSlider::pageStep () const

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

void QSlider::rangeChange () [virtual protected]

Implements the virtual QRangeControl function.

Reimplemented from QRangeControl.

void QSlider::setLineStep ( int )

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

void QSlider::setMaxValue ( int )

Sets the current maximum value of the slider. See the "maxValue" property for details.

void QSlider::setMinValue ( int )

Sets the current minimum value of the slider. See the "minValue" property for details.

void QSlider::setOrientation ( Orientation ) [virtual]

Sets the slider's orientation. See the "orientation" property for details.

void QSlider::setPageStep ( int )

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

void QSlider::setPalette ( const QPalette & p ) [virtual]

Reimplements the virtual function QWidget::setPalette().

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

Reimplemented from QWidget.

void QRangeControl::setRange ( int minValue, int maxValue )

Sets the range control's minimum value to minValue and its maximum value to maxValue.

Calls the virtual rangeChange() function if one or both of the new minimum and maximum values are different from the previous setting. Calls the virtual valueChange() function if the current value is adjusted because it was outside the new range.

If maxValue is smaller than minValue, minValue becomes the only legal value.

See also minValue and maxValue.

Examples: listbox/listbox.cpp, t12/lcdrange.cpp, t5/main.cpp, t6/main.cpp, t8/lcdrange.cpp, and xform/xform.cpp.

void QSlider::setTickInterval ( int ) [virtual]

Sets the interval between tickmarks. See the "tickInterval" property for details.

void QSlider::setTickmarks ( TickSetting ) [virtual]

Sets the tickmark settings for this slider. See the "tickmarks" property for details.

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

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

void QSlider::setValue ( int ) [virtual slot]

Sets the current slider value. See the "value" property for details.

void QSlider::sliderMoved ( int value ) [signal]

This signal is emitted when the slider is dragged, with the new slider value as its argument.

void QSlider::sliderPressed () [signal]

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

QRect QSlider::sliderRect () const

Returns the slider handle rectangle. (This is the visual marker that the user can move.)

void QSlider::sliderReleased () [signal]

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

int QSlider::sliderStart () const

Returns the start position of the slider.

void QSlider::subtractStep () [slot]

Moves the slider one pageStep() down or left.

int QSlider::tickInterval () const

Returns the interval between tickmarks. See the "tickInterval" property for details.

TickSetting QSlider::tickmarks () const

Returns the tickmark settings for this slider. See the "tickmarks" property for details.

bool QSlider::tracking () const

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

int QSlider::value () const

Returns the current slider value. See the "value" property for details.

void QSlider::valueChange () [virtual protected]

Implements the virtual QRangeControl function.

Reimplemented from QRangeControl.

void QSlider::valueChanged ( int value ) [signal]

This signal is emitted when the slider value is changed, with the new slider value as its argument.

Examples: rangecontrols/rangecontrols.cpp, simple/main.cpp, t12/lcdrange.cpp, t5/main.cpp, t6/main.cpp, t7/lcdrange.cpp, and xform/xform.cpp.


Property Documentation

int lineStep

This property holds the current 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(), 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 current maximum value of the slider.

When setting this property, the QSlider::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 current minimum value of the slider.

When setting this property, the QSlider::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 slider's orientation.

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

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

int pageStep

This property holds the current 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 QRangeControl::setSteps(), lineStep, and setRange().

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

int tickInterval

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 initial value of tickInterval is 0.

See also QRangeControl::lineStep() and QRangeControl::pageStep().

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

TickSetting tickmarks

This property holds the tickmark settings for this slider.

The valid values are in QSlider::TickSetting. The default is NoMarks.

See also tickInterval.

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

bool tracking

This property holds whether slider tracking is enabled.

If tracking is enabled (the default), the slider emits the valueChanged() signal whenever the slider is being dragged. If tracking is disabled, the slider emits the valueChanged() signal when the user releases the mouse button (unless the value happens to be the same as before).

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

int value

This property holds the current slider value.

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

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


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

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 48
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 13
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Labs au hasard

Logo

Améliorer les performances de Qt lors du rendu avec plus de SIMD

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 3.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web