You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
9.8 KiB
178 lines
9.8 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/tutorial2.doc:13 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>chart/optionsform.cpp Example File</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>chart/optionsform.cpp Example File</h1>
|
|
|
|
|
|
<pre>#include "optionsform.h"
|
|
|
|
#include <<a href="tqbuttongroup-h.html">tqbuttongroup.h</a>>
|
|
#include <<a href="tqcombobox-h.html">tqcombobox.h</a>>
|
|
#include <<a href="tqfontdialog-h.html">tqfontdialog.h</a>>
|
|
#include <<a href="tqframe-h.html">tqframe.h</a>>
|
|
#include <<a href="tqimage-h.html">tqimage.h</a>>
|
|
#include <<a href="tqlabel-h.html">tqlabel.h</a>>
|
|
#include <<a href="tqlayout-h.html">tqlayout.h</a>>
|
|
#include <<a href="tqpushbutton-h.html">tqpushbutton.h</a>>
|
|
#include <<a href="tqradiobutton-h.html">tqradiobutton.h</a>>
|
|
#include <<a href="tqspinbox-h.html">tqspinbox.h</a>>
|
|
|
|
#include "images/options_horizontalbarchart.xpm"
|
|
#include "images/options_piechart.xpm"
|
|
#include "images/options_verticalbarchart.xpm"
|
|
|
|
|
|
<a name="f176"></a>OptionsForm::OptionsForm( <a href="tqwidget.html">TQWidget</a>* parent, const char* name,
|
|
bool modal, WFlags f )
|
|
: <a href="tqdialog.html">TQDialog</a>( parent, name, modal, f )
|
|
{
|
|
<a href="tqwidget.html#setCaption">setCaption</a>( "Chart -- Options" );
|
|
<a href="tqwidget.html#resize">resize</a>( 320, 290 );
|
|
|
|
optionsFormLayout = new <a href="tqvboxlayout.html">TQVBoxLayout</a>( this, 11, 6 );
|
|
|
|
chartTypeLayout = new <a href="tqhboxlayout.html">TQHBoxLayout</a>( 0, 0, 6 );
|
|
|
|
chartTypeTextLabel = new <a href="tqlabel.html">TQLabel</a>( "&Chart Type", this );
|
|
chartTypeLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( chartTypeTextLabel );
|
|
|
|
chartTypeComboBox = new <a href="tqcombobox.html">TQComboBox</a>( FALSE, this );
|
|
chartTypeComboBox-><a href="tqcombobox.html#insertItem">insertItem</a>( TQPixmap( options_piechart ), "Pie Chart" );
|
|
chartTypeComboBox-><a href="tqcombobox.html#insertItem">insertItem</a>( TQPixmap( options_verticalbarchart ),
|
|
"Vertical Bar Chart" );
|
|
chartTypeComboBox-><a href="tqcombobox.html#insertItem">insertItem</a>( TQPixmap( options_horizontalbarchart ),
|
|
"Horizontal Bar Chart" );
|
|
chartTypeLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( chartTypeComboBox );
|
|
optionsFormLayout-><a href="tqboxlayout.html#addLayout">addLayout</a>( chartTypeLayout );
|
|
|
|
fontLayout = new <a href="tqhboxlayout.html">TQHBoxLayout</a>( 0, 0, 6 );
|
|
|
|
fontPushButton = new <a href="tqpushbutton.html">TQPushButton</a>( "&Font...", this );
|
|
fontLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( fontPushButton );
|
|
<a href="tqspaceritem.html">TQSpacerItem</a>* spacer = new <a href="tqspaceritem.html">TQSpacerItem</a>( 0, 0,
|
|
TQSizePolicy::Expanding,
|
|
TQSizePolicy::Minimum );
|
|
fontLayout-><a href="tqboxlayout.html#addItem">addItem</a>( spacer );
|
|
|
|
fontTextLabel = new <a href="tqlabel.html">TQLabel</a>( this ); // Must be set by caller via setFont()
|
|
fontLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( fontTextLabel );
|
|
optionsFormLayout-><a href="tqboxlayout.html#addLayout">addLayout</a>( fontLayout );
|
|
|
|
addValuesFrame = new <a href="tqframe.html">TQFrame</a>( this );
|
|
addValuesFrame-><a href="tqframe.html#setFrameShape">setFrameShape</a>( TQFrame::StyledPanel );
|
|
addValuesFrame-><a href="tqframe.html#setFrameShadow">setFrameShadow</a>( TQFrame::Sunken );
|
|
addValuesFrameLayout = new <a href="tqvboxlayout.html">TQVBoxLayout</a>( addValuesFrame, 11, 6 );
|
|
|
|
addValuesButtonGroup = new <a href="tqbuttongroup.html">TQButtonGroup</a>( "Show Values", addValuesFrame );
|
|
addValuesButtonGroup-><a href="tqgroupbox.html#setColumnLayout">setColumnLayout</a>(0, TQt::Vertical );
|
|
addValuesButtonGroup-><a href="tqwidget.html#layout">layout</a>()->setSpacing( 6 );
|
|
addValuesButtonGroup-><a href="tqwidget.html#layout">layout</a>()->setMargin( 11 );
|
|
addValuesButtonGroupLayout = new <a href="tqvboxlayout.html">TQVBoxLayout</a>(
|
|
addValuesButtonGroup-><a href="tqwidget.html#layout">layout</a>() );
|
|
addValuesButtonGroupLayout-><a href="tqlayoutitem.html#setAlignment">setAlignment</a>( TQt::AlignTop );
|
|
|
|
noRadioButton = new <a href="tqradiobutton.html">TQRadioButton</a>( "&No", addValuesButtonGroup );
|
|
noRadioButton-><a href="tqradiobutton.html#setChecked">setChecked</a>( TRUE );
|
|
addValuesButtonGroupLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( noRadioButton );
|
|
|
|
yesRadioButton = new <a href="tqradiobutton.html">TQRadioButton</a>( "&Yes", addValuesButtonGroup );
|
|
addValuesButtonGroupLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( yesRadioButton );
|
|
|
|
asPercentageRadioButton = new <a href="tqradiobutton.html">TQRadioButton</a>( "As &Percentage",
|
|
addValuesButtonGroup );
|
|
addValuesButtonGroupLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( asPercentageRadioButton );
|
|
addValuesFrameLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( addValuesButtonGroup );
|
|
|
|
decimalPlacesLayout = new <a href="tqhboxlayout.html">TQHBoxLayout</a>( 0, 0, 6 );
|
|
|
|
decimalPlacesTextLabel = new <a href="tqlabel.html">TQLabel</a>( "&Decimal Places", addValuesFrame );
|
|
decimalPlacesLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( decimalPlacesTextLabel );
|
|
|
|
decimalPlacesSpinBox = new <a href="tqspinbox.html">TQSpinBox</a>( addValuesFrame );
|
|
decimalPlacesSpinBox-><a href="tqspinbox.html#setMinValue">setMinValue</a>( 0 );
|
|
decimalPlacesSpinBox-><a href="tqspinbox.html#setMaxValue">setMaxValue</a>( 9 );
|
|
decimalPlacesLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( decimalPlacesSpinBox );
|
|
|
|
addValuesFrameLayout-><a href="tqboxlayout.html#addLayout">addLayout</a>( decimalPlacesLayout );
|
|
|
|
optionsFormLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( addValuesFrame );
|
|
|
|
buttonsLayout = new <a href="tqhboxlayout.html">TQHBoxLayout</a>( 0, 0, 6 );
|
|
spacer = new <a href="tqspaceritem.html">TQSpacerItem</a>( 0, 0,
|
|
TQSizePolicy::Expanding, TQSizePolicy::Minimum );
|
|
buttonsLayout-><a href="tqboxlayout.html#addItem">addItem</a>( spacer );
|
|
|
|
okPushButton = new <a href="tqpushbutton.html">TQPushButton</a>( "OK", this );
|
|
okPushButton-><a href="tqpushbutton.html#setDefault">setDefault</a>( TRUE );
|
|
buttonsLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( okPushButton );
|
|
|
|
cancelPushButton = new <a href="tqpushbutton.html">TQPushButton</a>( "Cancel", this );
|
|
buttonsLayout-><a href="tqboxlayout.html#addWidget">addWidget</a>( cancelPushButton );
|
|
optionsFormLayout-><a href="tqboxlayout.html#addLayout">addLayout</a>( buttonsLayout );
|
|
|
|
<a href="tqobject.html#connect">connect</a>( fontPushButton, TQ_SIGNAL( <a href="tqbutton.html#clicked">clicked</a>() ), this, TQ_SLOT( chooseFont() ) );
|
|
<a href="tqobject.html#connect">connect</a>( okPushButton, TQ_SIGNAL( <a href="tqbutton.html#clicked">clicked</a>() ), this, TQ_SLOT( <a href="tqdialog.html#accept">accept</a>() ) );
|
|
<a href="tqobject.html#connect">connect</a>( cancelPushButton, TQ_SIGNAL( <a href="tqbutton.html#clicked">clicked</a>() ), this, TQ_SLOT( <a href="tqdialog.html#reject">reject</a>() ) );
|
|
|
|
chartTypeTextLabel-><a href="tqlabel.html#setBuddy">setBuddy</a>( chartTypeComboBox );
|
|
decimalPlacesTextLabel-><a href="tqlabel.html#setBuddy">setBuddy</a>( decimalPlacesSpinBox );
|
|
}
|
|
|
|
|
|
void <a name="f177"></a>OptionsForm::chooseFont()
|
|
{
|
|
bool ok;
|
|
<a href="tqfont.html">TQFont</a> font = TQFontDialog::<a href="tqfontdialog.html#getFont">getFont</a>( &ok, m_font, this );
|
|
if ( ok )
|
|
<a href="tqwidget.html#setFont">setFont</a>( font );
|
|
}
|
|
|
|
|
|
void OptionsForm::<a href="tqwidget.html#setFont">setFont</a>( <a href="tqfont.html">TQFont</a> font )
|
|
{
|
|
<a href="tqstring.html">TQString</a> label = font.<a href="tqfont.html#family">family</a>() + " " +
|
|
TQString::<a href="tqstring.html#number">number</a>( font.<a href="tqfont.html#pointSize">pointSize</a>() ) + "pt";
|
|
if ( font.<a href="tqfont.html#bold">bold</a>() )
|
|
label += " Bold";
|
|
if ( font.<a href="tqfont.html#italic">italic</a>() )
|
|
label += " Italic";
|
|
fontTextLabel-><a href="tqlabel.html#setText">setText</a>( label );
|
|
m_font = font;
|
|
}
|
|
</pre><!-- eof -->
|
|
<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|