summaryrefslogtreecommitdiffstats
path: root/doc/html/chart-optionsform-cpp.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/chart-optionsform-cpp.html')
-rw-r--r--doc/html/chart-optionsform-cpp.html177
1 files changed, 177 insertions, 0 deletions
diff --git a/doc/html/chart-optionsform-cpp.html b/doc/html/chart-optionsform-cpp.html
new file mode 100644
index 0000000..7ac28a3
--- /dev/null
+++ b/doc/html/chart-optionsform-cpp.html
@@ -0,0 +1,177 @@
+<!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&nbsp;Classes</font></a>
+ | <a href="mainclasses.html">
+<font color="#004faf">Main&nbsp;Classes</font></a>
+ | <a href="annotated.html">
+<font color="#004faf">Annotated</font></a>
+ | <a href="groups.html">
+<font color="#004faf">Grouped&nbsp;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 &lt;<a href="qbuttongroup-h.html">qbuttongroup.h</a>&gt;
+#include &lt;<a href="qcombobox-h.html">qcombobox.h</a>&gt;
+#include &lt;<a href="qfontdialog-h.html">qfontdialog.h</a>&gt;
+#include &lt;<a href="qframe-h.html">qframe.h</a>&gt;
+#include &lt;<a href="qimage-h.html">qimage.h</a>&gt;
+#include &lt;<a href="qlabel-h.html">qlabel.h</a>&gt;
+#include &lt;<a href="qlayout-h.html">qlayout.h</a>&gt;
+#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
+#include &lt;<a href="qradiobutton-h.html">qradiobutton.h</a>&gt;
+#include &lt;<a href="qspinbox-h.html">qspinbox.h</a>&gt;
+
+#include "images/options_horizontalbarchart.xpm"
+#include "images/options_piechart.xpm"
+#include "images/options_verticalbarchart.xpm"
+
+
+<a name="f176"></a>OptionsForm::OptionsForm( <a href="qwidget.html">QWidget</a>* parent, const char* name,
+ bool modal, WFlags f )
+ : <a href="qdialog.html">QDialog</a>( parent, name, modal, f )
+{
+ <a href="qwidget.html#setCaption">setCaption</a>( "Chart -- Options" );
+ <a href="qwidget.html#resize">resize</a>( 320, 290 );
+
+ optionsFormLayout = new <a href="qvboxlayout.html">QVBoxLayout</a>( this, 11, 6 );
+
+ chartTypeLayout = new <a href="qhboxlayout.html">QHBoxLayout</a>( 0, 0, 6 );
+
+ chartTypeTextLabel = new <a href="qlabel.html">QLabel</a>( "&amp;Chart Type", this );
+ chartTypeLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( chartTypeTextLabel );
+
+ chartTypeComboBox = new <a href="qcombobox.html">QComboBox</a>( FALSE, this );
+ chartTypeComboBox-&gt;<a href="qcombobox.html#insertItem">insertItem</a>( QPixmap( options_piechart ), "Pie Chart" );
+ chartTypeComboBox-&gt;<a href="qcombobox.html#insertItem">insertItem</a>( QPixmap( options_verticalbarchart ),
+ "Vertical Bar Chart" );
+ chartTypeComboBox-&gt;<a href="qcombobox.html#insertItem">insertItem</a>( QPixmap( options_horizontalbarchart ),
+ "Horizontal Bar Chart" );
+ chartTypeLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( chartTypeComboBox );
+ optionsFormLayout-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( chartTypeLayout );
+
+ fontLayout = new <a href="qhboxlayout.html">QHBoxLayout</a>( 0, 0, 6 );
+
+ fontPushButton = new <a href="qpushbutton.html">QPushButton</a>( "&amp;Font...", this );
+ fontLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( fontPushButton );
+ <a href="qspaceritem.html">QSpacerItem</a>* spacer = new <a href="qspaceritem.html">QSpacerItem</a>( 0, 0,
+ QSizePolicy::Expanding,
+ QSizePolicy::Minimum );
+ fontLayout-&gt;<a href="qboxlayout.html#addItem">addItem</a>( spacer );
+
+ fontTextLabel = new <a href="qlabel.html">QLabel</a>( this ); // Must be set by caller via setFont()
+ fontLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( fontTextLabel );
+ optionsFormLayout-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( fontLayout );
+
+ addValuesFrame = new <a href="qframe.html">QFrame</a>( this );
+ addValuesFrame-&gt;<a href="qframe.html#setFrameShape">setFrameShape</a>( QFrame::StyledPanel );
+ addValuesFrame-&gt;<a href="qframe.html#setFrameShadow">setFrameShadow</a>( QFrame::Sunken );
+ addValuesFrameLayout = new <a href="qvboxlayout.html">QVBoxLayout</a>( addValuesFrame, 11, 6 );
+
+ addValuesButtonGroup = new <a href="qbuttongroup.html">QButtonGroup</a>( "Show Values", addValuesFrame );
+ addValuesButtonGroup-&gt;<a href="qgroupbox.html#setColumnLayout">setColumnLayout</a>(0, Qt::Vertical );
+ addValuesButtonGroup-&gt;<a href="qwidget.html#layout">layout</a>()-&gt;setSpacing( 6 );
+ addValuesButtonGroup-&gt;<a href="qwidget.html#layout">layout</a>()-&gt;setMargin( 11 );
+ addValuesButtonGroupLayout = new <a href="qvboxlayout.html">QVBoxLayout</a>(
+ addValuesButtonGroup-&gt;<a href="qwidget.html#layout">layout</a>() );
+ addValuesButtonGroupLayout-&gt;<a href="qlayoutitem.html#setAlignment">setAlignment</a>( Qt::AlignTop );
+
+ noRadioButton = new <a href="qradiobutton.html">QRadioButton</a>( "&amp;No", addValuesButtonGroup );
+ noRadioButton-&gt;<a href="qradiobutton.html#setChecked">setChecked</a>( TRUE );
+ addValuesButtonGroupLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( noRadioButton );
+
+ yesRadioButton = new <a href="qradiobutton.html">QRadioButton</a>( "&amp;Yes", addValuesButtonGroup );
+ addValuesButtonGroupLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( yesRadioButton );
+
+ asPercentageRadioButton = new <a href="qradiobutton.html">QRadioButton</a>( "As &amp;Percentage",
+ addValuesButtonGroup );
+ addValuesButtonGroupLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( asPercentageRadioButton );
+ addValuesFrameLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( addValuesButtonGroup );
+
+ decimalPlacesLayout = new <a href="qhboxlayout.html">QHBoxLayout</a>( 0, 0, 6 );
+
+ decimalPlacesTextLabel = new <a href="qlabel.html">QLabel</a>( "&amp;Decimal Places", addValuesFrame );
+ decimalPlacesLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( decimalPlacesTextLabel );
+
+ decimalPlacesSpinBox = new <a href="qspinbox.html">QSpinBox</a>( addValuesFrame );
+ decimalPlacesSpinBox-&gt;<a href="qspinbox.html#setMinValue">setMinValue</a>( 0 );
+ decimalPlacesSpinBox-&gt;<a href="qspinbox.html#setMaxValue">setMaxValue</a>( 9 );
+ decimalPlacesLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( decimalPlacesSpinBox );
+
+ addValuesFrameLayout-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( decimalPlacesLayout );
+
+ optionsFormLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( addValuesFrame );
+
+ buttonsLayout = new <a href="qhboxlayout.html">QHBoxLayout</a>( 0, 0, 6 );
+ spacer = new <a href="qspaceritem.html">QSpacerItem</a>( 0, 0,
+ QSizePolicy::Expanding, QSizePolicy::Minimum );
+ buttonsLayout-&gt;<a href="qboxlayout.html#addItem">addItem</a>( spacer );
+
+ okPushButton = new <a href="qpushbutton.html">QPushButton</a>( "OK", this );
+ okPushButton-&gt;<a href="qpushbutton.html#setDefault">setDefault</a>( TRUE );
+ buttonsLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( okPushButton );
+
+ cancelPushButton = new <a href="qpushbutton.html">QPushButton</a>( "Cancel", this );
+ buttonsLayout-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( cancelPushButton );
+ optionsFormLayout-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( buttonsLayout );
+
+ <a href="qobject.html#connect">connect</a>( fontPushButton, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ), this, SLOT( chooseFont() ) );
+ <a href="qobject.html#connect">connect</a>( okPushButton, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ), this, SLOT( <a href="qdialog.html#accept">accept</a>() ) );
+ <a href="qobject.html#connect">connect</a>( cancelPushButton, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ), this, SLOT( <a href="qdialog.html#reject">reject</a>() ) );
+
+ chartTypeTextLabel-&gt;<a href="qlabel.html#setBuddy">setBuddy</a>( chartTypeComboBox );
+ decimalPlacesTextLabel-&gt;<a href="qlabel.html#setBuddy">setBuddy</a>( decimalPlacesSpinBox );
+}
+
+
+void <a name="f177"></a>OptionsForm::chooseFont()
+{
+ bool ok;
+ <a href="qfont.html">QFont</a> font = QFontDialog::<a href="qfontdialog.html#getFont">getFont</a>( &amp;ok, m_font, this );
+ if ( ok )
+ <a href="qwidget.html#setFont">setFont</a>( font );
+}
+
+
+void OptionsForm::<a href="qwidget.html#setFont">setFont</a>( <a href="qfont.html">QFont</a> font )
+{
+ <a href="qstring.html">QString</a> label = font.<a href="qfont.html#family">family</a>() + " " +
+ QString::<a href="qstring.html#number">number</a>( font.<a href="qfont.html#pointSize">pointSize</a>() ) + "pt";
+ if ( font.<a href="qfont.html#bold">bold</a>() )
+ label += " Bold";
+ if ( font.<a href="qfont.html#italic">italic</a>() )
+ label += " Italic";
+ fontTextLabel-&gt;<a href="qlabel.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 &copy; 2007
+<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
+<td align=right><div align=right>Qt 3.3.8</div>
+</table></div></address></body>
+</html>