diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /examples/rangecontrols | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
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 000000000..bc2fa2896 --- /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 TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include "rangecontrols.h" +#include <qapplication.h> + +int main( int argc, char **argv ) +{ + TQApplication a( argc, argv ); + + RangeControls rangecontrols; + rangecontrols.resize( 500, 300 ); + rangecontrols.setCaption( "TQt 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 000000000..82d61673c --- /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 TQt. 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( TQWidget *parent, const char *name ) + : TQVBox( parent, name ) +{ + TQHBox *row1 = new TQHBox( this ); + + TQVBox *cell2 = new TQVBox( row1 ); + cell2->setMargin( 10 ); + cell2->setFrameStyle( TQFrame::WinPanel | TQFrame::Sunken ); + + (void)new TQWidget( cell2 ); + + TQLabel *label1 = new TQLabel( TQString( "Enter a value between\n%1 and %2:" ).arg( -INT_MAX ).arg( INT_MAX ), cell2 ); + label1->setMaximumHeight( label1->sizeHint().height() ); + TQSpinBox *sb1 = new TQSpinBox( -INT_MAX, INT_MAX, 1, cell2 ); + sb1->setValue( 0 ); + + TQLabel *label2 = new TQLabel( "Enter a zoom value:", cell2 ); + label2->setMaximumHeight( label2->sizeHint().height() ); + TQSpinBox *sb2 = new TQSpinBox( 0, 1000, 10, cell2 ); + sb2->setSuffix( " %" ); + sb2->setSpecialValueText( "Automatic" ); + + TQLabel *label3 = new TQLabel( "Enter a price:", cell2 ); + label3->setMaximumHeight( label3->sizeHint().height() ); + TQSpinBox *sb3 = new TQSpinBox( 0, INT_MAX, 1, cell2 ); + sb3->setPrefix( "$" ); + sb3->setValue( 355 ); + + (void)new TQWidget( cell2 ); + + TQHBox *row2 = new TQHBox( this ); + + TQVBox *cell3 = new TQVBox( row2 ); + cell3->setMargin( 10 ); + cell3->setFrameStyle( TQFrame::WinPanel | TQFrame::Sunken ); + TQSlider *hslider = new TQSlider( 0, 64, 1, 33, TQt::Horizontal, cell3, "horizontal_s" ); + TQLCDNumber *lcd2 = new TQLCDNumber( 2, cell3 ); + lcd2->display( 33 ); + lcd2->setSegmentStyle( TQLCDNumber::Filled ); + connect( hslider, SIGNAL( valueChanged( int ) ), lcd2, SLOT( display( int ) ) ); + + TQHBox *cell4 = new TQHBox( row2 ); + cell4->setFrameStyle( TQFrame::WinPanel | TQFrame::Sunken ); + cell4->setMargin( 10 ); + TQSlider *vslider = new TQSlider( 0, 64, 1, 8, TQt::Vertical, cell4 ); + TQLCDNumber *lcd3 = new TQLCDNumber( 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 000000000..3fc3323c3 --- /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 000000000..549815c0d --- /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 TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#ifndef RANGECONTROLS_H +#define RANGECONTROLS_H + +#include <qvbox.h> + +class TQCheckBox; + +class RangeControls : public TQVBox +{ + Q_OBJECT + +public: + RangeControls( TQWidget *parent = 0, const char *name = 0 ); + +private: + TQCheckBox *notches, *wrapping; +}; + +#endif diff --git a/examples/rangecontrols/rangecontrols.pro b/examples/rangecontrols/rangecontrols.pro new file mode 100644 index 000000000..21c1a5ddc --- /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 |