wizard-main-cpp.html

来自「qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人」· HTML 代码 · 共 338 行 · 第 1/2 页

HTML
338
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qt Toolkit - wizard/main.cpp example file</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }--></style></head><body bgcolor="#ffffff"><table width="100%"><tr><td><a href="index.html"><img width="100" height="100" src="qtlogo.png"alt="Home" border="0"><img width="100"height="100" src="face.png" alt="Home" border="0"></a><td valign="top"><div align="right"><img src="dochead.png" width="472" height="27"><br><a href="classes.html"><b>Classes</b></a>- <a href="annotated.html">Annotated</a>- <a href="hierarchy.html">Tree</a>- <a href="functions.html">Functions</a>- <a href="index.html">Home</a>- <a href="topicals.html"><b>Structure</b>  <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qte</font></a></div></table><h1 align=center>Wizard</h1><br clear="all">  This example shows the usage of Qt's wizard class. A wizard  should be used to help a user with complicated actions.  <hr>  Header file: <pre>/****************************************************************************** &#36;Id&#58; qt/examples/wizard/wizard.h   2.3.8   edited 2004-05-12 $**** Copyright (C) 1992-2000 Trolltech AS.  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 WIZARD_H#define WIZARD_H#include &lt;<a href="qwizard-h.html">qwizard.h</a>&gt;class QWidget;class QHBox;class QLineEdit;class QLabel;class Wizard : public QWizard{    Q_OBJECTpublic:    Wizard( <a href="qwidget.html">QWidget</a> *parent = 0, const char *name = 0 );    void showPage(<a href="qwidget.html">QWidget</a>* page);protected:    void setupPage1();    void setupPage2();    void setupPage3();    <a href="qhbox.html">QHBox</a> *page1, *page2, *page3;    <a href="qlineedit.html">QLineEdit</a> *key, *firstName, *lastName, *address, *phone, *email;    <a href="qlabel.html">QLabel</a> *lKey, *lFirstName, *lLastName, *lAddress, *lPhone, *lEmail;protected slots:    void keyChanged( const QString &amp; );    void dataChanged( const QString &amp; );};#endif</pre>  <hr>  Implementation: <pre>/****************************************************************************** &#36;Id&#58; qt/examples/wizard/wizard.cpp   2.3.8   edited 2004-05-12 $**** Copyright (C) 1992-2000 Trolltech AS.  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 "wizard.h"#include &lt;<a href="qwidget-h.html">qwidget.h</a>&gt;#include &lt;<a href="qhbox-h.html">qhbox.h</a>&gt;#include &lt;<a href="qvbox-h.html">qvbox.h</a>&gt;#include &lt;<a href="qlabel-h.html">qlabel.h</a>&gt;#include &lt;<a href="qlineedit-h.html">qlineedit.h</a>&gt;#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;#include &lt;<a href="qvalidator-h.html">qvalidator.h</a>&gt;#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;Wizard::Wizard( <a href="qwidget.html">QWidget</a> *parent, const char *name )    : <a href="qwizard.html">QWizard</a>( parent, name, TRUE ){    <a href=#46>setupPage1</a>();    <a href=#47>setupPage2</a>();    <a href=#48>setupPage3</a>();    key-&gt;setFocus();}void <a name="46"></a>Wizard::setupPage1(){    page1 = new <a href="qhbox.html">QHBox</a>( this );    page1-&gt;setSpacing(8);    <a href="qlabel.html">QLabel</a> *info = new <a href="qlabel.html">QLabel</a>( page1 );    info-&gt;<a href="qwidget.html#d7e4b9">setPalette</a>( yellow );    info-&gt;<a href="qlabel.html#bc5ea6">setText</a>( "Enter your personal\n"                   "key here.\n\n"                   "Your personal key\n"                   "consists of 4 digits" );    info-&gt;<a href="qlabel.html#9077ed">setIndent</a>( 8 );    info-&gt;<a href="qwidget.html#99d237">setMaximumWidth</a>( info-&gt;<a href="qlabel.html#f40fcc">sizeHint</a>().width() );    <a href="qvbox.html">QVBox</a> *page = new <a href="qvbox.html">QVBox</a>( page1 );    <a href="qhbox.html">QHBox</a> *row1 = new <a href="qhbox.html">QHBox</a>( page );    (void)new <a href="qlabel.html">QLabel</a>( "Key:", row1 );    key = new <a href="qlineedit.html">QLineEdit</a>( row1 );    key-&gt;setMaxLength( 4 );    key-&gt;setValidator( new QIntValidator( 9999, 0, key ) );    <a href="qobject.html#fbde73">connect</a>( key, SIGNAL( textChanged( const QString &amp; ) ), this, SLOT( <a href=#50>keyChanged</a>( const QString &amp; ) ) );    <a href="qwizard.html#f29492">addPage</a>( page1, "Personal Key" );    <a href="qwizard.html#03bd73">setNextEnabled</a>( page1, FALSE );    <a href="qwizard.html#058879">setHelpEnabled</a>( page1, FALSE );}void <a name="47"></a>Wizard::setupPage2(){    page2 = new <a href="qhbox.html">QHBox</a>( this );    page2-&gt;setSpacing(8);    <a href="qlabel.html">QLabel</a> *info = new <a href="qlabel.html">QLabel</a>( page2 );    info-&gt;<a href="qwidget.html#d7e4b9">setPalette</a>( yellow );    info-&gt;<a href="qlabel.html#bc5ea6">setText</a>( "\n"                   "  Enter your personal  \n"                   "  data here.  \n\n"                   "  The required fields are  \n"                   "  First Name, Last Name \n"                   "  and E-Mail.  \n" );    info-&gt;<a href="qlabel.html#9077ed">setIndent</a>(8);    info-&gt;<a href="qwidget.html#99d237">setMaximumWidth</a>( info-&gt;<a href="qlabel.html#f40fcc">sizeHint</a>().width() );    <a href="qvbox.html">QVBox</a> *page = new <a href="qvbox.html">QVBox</a>( page2 );    <a href="qhbox.html">QHBox</a> *row1 = new <a href="qhbox.html">QHBox</a>( page );    <a href="qhbox.html">QHBox</a> *row2 = new <a href="qhbox.html">QHBox</a>( page );    <a href="qhbox.html">QHBox</a> *row3 = new <a href="qhbox.html">QHBox</a>( page );    <a href="qhbox.html">QHBox</a> *row4 = new <a href="qhbox.html">QHBox</a>( page );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?