source: trunk/examples/rangecontrols/rangecontrols.cpp@ 68

Last change on this file since 68 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1/****************************************************************************
2** $Id: rangecontrols.cpp 2 2005-11-16 15:49:26Z dmik $
3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5**
6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation.
8**
9*****************************************************************************/
10
11#include "rangecontrols.h"
12
13#include <qhbox.h>
14#include <qlcdnumber.h>
15#include <qspinbox.h>
16#include <qlabel.h>
17#include <qstring.h>
18#include <qslider.h>
19#include <qcheckbox.h>
20
21#include <limits.h>
22
23RangeControls::RangeControls( QWidget *parent, const char *name )
24 : QVBox( parent, name )
25{
26 QHBox *row1 = new QHBox( this );
27
28 QVBox *cell2 = new QVBox( row1 );
29 cell2->setMargin( 10 );
30 cell2->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
31
32 (void)new QWidget( cell2 );
33
34 QLabel *label1 = new QLabel( QString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 );
35 label1->setMaximumHeight( label1->sizeHint().height() );
36 QSpinBox *sb1 = new QSpinBox( -INT_MAX, INT_MAX, 1, cell2 );
37 sb1->setValue( 0 );
38
39 QLabel *label2 = new QLabel( "Enter a zoom value:", cell2 );
40 label2->setMaximumHeight( label2->sizeHint().height() );
41 QSpinBox *sb2 = new QSpinBox( 0, 1000, 10, cell2 );
42 sb2->setSuffix( " %" );
43 sb2->setSpecialValueText( "Automatic" );
44
45 QLabel *label3 = new QLabel( "Enter a price:", cell2 );
46 label3->setMaximumHeight( label3->sizeHint().height() );
47 QSpinBox *sb3 = new QSpinBox( 0, INT_MAX, 1, cell2 );
48 sb3->setPrefix( "$" );
49 sb3->setValue( 355 );
50
51 (void)new QWidget( cell2 );
52
53 QHBox *row2 = new QHBox( this );
54
55 QVBox *cell3 = new QVBox( row2 );
56 cell3->setMargin( 10 );
57 cell3->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
58 QSlider *hslider = new QSlider( 0, 64, 1, 33, Qt::Horizontal, cell3, "horizontal_s" );
59 QLCDNumber *lcd2 = new QLCDNumber( 2, cell3 );
60 lcd2->display( 33 );
61 lcd2->setSegmentStyle( QLCDNumber::Filled );
62 connect( hslider, SIGNAL( valueChanged( int ) ), lcd2, SLOT( display( int ) ) );
63
64 QHBox *cell4 = new QHBox( row2 );
65 cell4->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
66 cell4->setMargin( 10 );
67 QSlider *vslider = new QSlider( 0, 64, 1, 8, Qt::Vertical, cell4 );
68 QLCDNumber *lcd3 = new QLCDNumber( 3, cell4 );
69 lcd3->display( 8 );
70 connect( vslider, SIGNAL( valueChanged( int ) ), lcd3, SLOT( display( int ) ) );
71}
Note: See TracBrowser for help on using the repository browser.