diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:24:15 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:24:15 -0500 |
commit | bd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch) | |
tree | 7a520322212d48ebcb9fbe1087e7fca28b76185c /examples/rangecontrols | |
download | qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip |
Add Qt3 development HEAD version
Diffstat (limited to 'examples/rangecontrols')
-rw-r--r-- | examples/rangecontrols/main.cpp | 24 | ||||
-rw-r--r-- | examples/rangecontrols/rangecontrols.cpp | 70 | ||||
-rw-r--r-- | examples/rangecontrols/rangecontrols.doc | 28 | ||||
-rw-r--r-- | examples/rangecontrols/rangecontrols.h | 28 | ||||
-rw-r--r-- | examples/rangecontrols/rangecontrols.pro | 11 |
5 files changed, 161 insertions, 0 deletions
diff --git a/examples/rangecontrols/main.cpp b/examples/rangecontrols/main.cpp new file mode 100644 index 0000000..64f15f4 --- /dev/null +++ b/examples/rangecontrols/main.cpp @@ -0,0 +1,24 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for Qt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include "rangecontrols.h" +#include <qapplication.h> + +int main( int argc, char **argv ) +{ + QApplication a( argc, argv ); + + RangeControls rangecontrols; + rangecontrols.resize( 500, 300 ); + rangecontrols.setCaption( "Qt Example - Range Control Widgets" ); + a.setMainWidget( &rangecontrols ); + rangecontrols.show(); + + return a.exec(); +} diff --git a/examples/rangecontrols/rangecontrols.cpp b/examples/rangecontrols/rangecontrols.cpp new file mode 100644 index 0000000..6a11ac9 --- /dev/null +++ b/examples/rangecontrols/rangecontrols.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for Qt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include "rangecontrols.h" + +#include <qhbox.h> +#include <qlcdnumber.h> +#include <qspinbox.h> +#include <qlabel.h> +#include <qstring.h> +#include <qslider.h> +#include <qcheckbox.h> + +#include <limits.h> + +RangeControls::RangeControls( QWidget *parent, const char *name ) + : QVBox( parent, name ) +{ + QHBox *row1 = new QHBox( this ); + + QVBox *cell2 = new QVBox( row1 ); + cell2->setMargin( 10 ); + cell2->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); + + (void)new QWidget( cell2 ); + + QLabel *label1 = new QLabel( QString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 ); + label1->setMaximumHeight( label1->sizeHint().height() ); + QSpinBox *sb1 = new QSpinBox( -INT_MAX, INT_MAX, 1, cell2 ); + sb1->setValue( 0 ); + + QLabel *label2 = new QLabel( "Enter a zoom value:", cell2 ); + label2->setMaximumHeight( label2->sizeHint().height() ); + QSpinBox *sb2 = new QSpinBox( 0, 1000, 10, cell2 ); + sb2->setSuffix( " %" ); + sb2->setSpecialValueText( "Automatic" ); + + QLabel *label3 = new QLabel( "Enter a price:", cell2 ); + label3->setMaximumHeight( label3->sizeHint().height() ); + QSpinBox *sb3 = new QSpinBox( 0, INT_MAX, 1, cell2 ); + sb3->setPrefix( "$" ); + sb3->setValue( 355 ); + + (void)new QWidget( cell2 ); + + QHBox *row2 = new QHBox( this ); + + QVBox *cell3 = new QVBox( row2 ); + cell3->setMargin( 10 ); + cell3->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); + QSlider *hslider = new QSlider( 0, 64, 1, 33, Qt::Horizontal, cell3, "horizontal_s" ); + QLCDNumber *lcd2 = new QLCDNumber( 2, cell3 ); + lcd2->display( 33 ); + lcd2->setSegmentStyle( QLCDNumber::Filled ); + connect( hslider, SIGNAL( valueChanged( int ) ), lcd2, SLOT( display( int ) ) ); + + QHBox *cell4 = new QHBox( row2 ); + cell4->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); + cell4->setMargin( 10 ); + QSlider *vslider = new QSlider( 0, 64, 1, 8, Qt::Vertical, cell4 ); + QLCDNumber *lcd3 = new QLCDNumber( 3, cell4 ); + lcd3->display( 8 ); + connect( vslider, SIGNAL( valueChanged( int ) ), lcd3, SLOT( display( int ) ) ); +} diff --git a/examples/rangecontrols/rangecontrols.doc b/examples/rangecontrols/rangecontrols.doc new file mode 100644 index 0000000..3fc3323 --- /dev/null +++ b/examples/rangecontrols/rangecontrols.doc @@ -0,0 +1,28 @@ +/* +*/ +/*! \page rangecontrols-example.html + + \ingroup examples + \title Range controls + + This examples shows various types of range controls that + are supported by Qt: dials, spin boxes and sliders. + + <hr> + + Header file: + + \include rangecontrols/rangecontrols.h + + <hr> + + Implementation: + + \include rangecontrols/rangecontrols.cpp + + <hr> + + Main: + + \include rangecontrols/main.cpp +*/ diff --git a/examples/rangecontrols/rangecontrols.h b/examples/rangecontrols/rangecontrols.h new file mode 100644 index 0000000..d1d0594 --- /dev/null +++ b/examples/rangecontrols/rangecontrols.h @@ -0,0 +1,28 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for Qt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#ifndef RANGECONTROLS_H +#define RANGECONTROLS_H + +#include <qvbox.h> + +class QCheckBox; + +class RangeControls : public QVBox +{ + Q_OBJECT + +public: + RangeControls( QWidget *parent = 0, const char *name = 0 ); + +private: + QCheckBox *notches, *wrapping; +}; + +#endif diff --git a/examples/rangecontrols/rangecontrols.pro b/examples/rangecontrols/rangecontrols.pro new file mode 100644 index 0000000..21c1a5d --- /dev/null +++ b/examples/rangecontrols/rangecontrols.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +TARGET = rangecontrols + +CONFIG += qt warn_on release +DEPENDPATH = ../../include + +REQUIRES = large-config + +HEADERS = rangecontrols.h +SOURCES = main.cpp \ + rangecontrols.cpp |