Archived:How to use QSpinBox and QSlider
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
Article Metadata
Tested with
Devices(s): Emulator
Compatibility
Platform(s): S60 3rd Edition, S60 5th Edition
Platform Security
Signing Required: Self-Signed
Capabilities: None
Article
Keywords: QSpinBox,QSlider
Created: kamaljaiswal
(21 Dec 2008)
Last edited: hamishwillee
(11 Oct 2012)
QSpinBox and the QSlider are rendered inside the QWidget ie QSpinBox and QSlider are compound controls.
Various Function For SpinBox
- To set the minimum and maximun range of spin box.
spinBox->setMinimum(0); spinBox->setMaximum(100);
- This property is used to display spinBox prefix For example $50 .
spinBox->setPrefix("$");
ScreenShot
- This property is used to display spinBox suffix ,Example 100Km.
spinBox->setSuffix(" Km");
Various Function For Slider
- Used to fix the tick interval.
slider->setTickInterval ( 5 );
- This property is generally used to tickmark the position of slider.
slider->setTickPosition(QSlider::TicksBothSides);
ScreenShot
Specifying the range.
spinBox->setRange(0, 130);
slider->setRange(0, 130);
Catching the event generated by the Slider and SpinBox.
Setting a default value
spinBox->setValue(35);
Alignment
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinBox);
layout->addWidget(slider);
window->setLayout(layout);



(no comments yet)