⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helpviewer-main-cpp.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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 - helpviewer/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>Simple HTML Browser</h1><br clear="all">  The QBrowser example implements a simple HTML browser using Qt's Richtext widget.  <hr>  Header file: <pre>/****************************************************************************** &#36;Id&#58; qt/examples/helpviewer/helpwindow.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 HELPWINDOW_H#define HELPWINDOW_H#include &lt;<a href="qmainwindow-h.html">qmainwindow.h</a>&gt;#include &lt;<a href="qtextbrowser-h.html">qtextbrowser.h</a>&gt;#include &lt;<a href="qstringlist-h.html">qstringlist.h</a>&gt;#include &lt;<a href="qmap-h.html">qmap.h</a>&gt;#include &lt;<a href="qdir-h.html">qdir.h</a>&gt;class QComboBox;class QPopupMenu;class HelpWindow : public QMainWindow{    Q_OBJECTpublic:    HelpWindow( const QString&amp; home_,  const QString&amp; path, QWidget* parent = 0, const char *name=0 );    ~HelpWindow();private slots:    void setBackwardAvailable( bool );    void setForwardAvailable( bool );    void textChanged();    void about();    void aboutQt();    void openFile();    void newWindow();    void print();    void pathSelected( const QString &amp; );    void histChosen( int );    void bookmChosen( int );    void addBookmark();private:    void readHistory();    void readBookmarks();    <a href="qtextbrowser.html">QTextBrowser</a>* browser;    <a href="qcombobox.html">QComboBox</a> *pathCombo;    int backwardId, forwardId;    <a href="qstring.html">QString</a> selectedURL;    <a href="qstringlist.html">QStringList</a> history, bookmarks;    <a href="qmap.html">QMap</a>&lt;int, QString&gt; mHistory, mBookmarks;    <a href="qpopupmenu.html">QPopupMenu</a> *hist, *bookm;};#endif</pre>  <hr>  Implementation: <pre>/****************************************************************************** &#36;Id&#58; qt/examples/helpviewer/helpwindow.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 "helpwindow.h"#include &lt;<a href="qstatusbar-h.html">qstatusbar.h</a>&gt;#include &lt;<a href="qpixmap-h.html">qpixmap.h</a>&gt;#include &lt;<a href="qpopupmenu-h.html">qpopupmenu.h</a>&gt;#include &lt;<a href="qmenubar-h.html">qmenubar.h</a>&gt;#include &lt;<a href="qtoolbar-h.html">qtoolbar.h</a>&gt;#include &lt;<a href="qtoolbutton-h.html">qtoolbutton.h</a>&gt;#include &lt;<a href="qiconset-h.html">qiconset.h</a>&gt;#include &lt;<a href="qfile-h.html">qfile.h</a>&gt;#include &lt;<a href="qtextstream-h.html">qtextstream.h</a>&gt;#include &lt;<a href="qstylesheet-h.html">qstylesheet.h</a>&gt;#include &lt;<a href="qmessagebox-h.html">qmessagebox.h</a>&gt;#include &lt;<a href="qfiledialog-h.html">qfiledialog.h</a>&gt;#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;#include &lt;<a href="qcombobox-h.html">qcombobox.h</a>&gt;#include &lt;<a href="qevent-h.html">qevent.h</a>&gt;#include &lt;<a href="qlineedit-h.html">qlineedit.h</a>&gt;#include &lt;qobjectlist.h&gt;#include &lt;<a href="qfileinfo-h.html">qfileinfo.h</a>&gt;#include &lt;<a href="qfile-h.html">qfile.h</a>&gt;#include &lt;<a href="qdatastream-h.html">qdatastream.h</a>&gt;#include &lt;<a href="qprinter-h.html">qprinter.h</a>&gt;#include &lt;<a href="qsimplerichtext-h.html">qsimplerichtext.h</a>&gt;#include &lt;<a href="qpaintdevicemetrics-h.html">qpaintdevicemetrics.h</a>&gt;#include &lt;ctype.h&gt;HelpWindow::HelpWindow( const QString&amp; home_, const QString&amp; _path,                        <a href="qwidget.html">QWidget</a>* parent, const char *name )    : <a href="qmainwindow.html">QMainWindow</a>( parent, name, WDestructiveClose ),      pathCombo( 0 ), selectedURL(){    readHistory();    readBookmarks();    browser = new <a href="qtextbrowser.html">QTextBrowser</a>( this );    browser-&gt;mimeSourceFactory()-&gt;setFilePath( _path );    browser-&gt;setFrameStyle( QFrame::Panel | QFrame::Sunken );    connect( browser, SIGNAL( textChanged() ),             this, SLOT( textChanged() ) );    setCentralWidget( browser );    if ( !home_.isEmpty() )        browser-&gt;setSource( home_ );    connect( browser, SIGNAL( highlighted( const QString&amp;) ),             statusBar(), SLOT( message( const QString&amp;)) );    resize( 640,700 );    <a href="qpopupmenu.html">QPopupMenu</a>* file = new <a href="qpopupmenu.html">QPopupMenu</a>( this );    file-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("&amp;New Window"), this, SLOT( newWindow() ), ALT | Key_N );    file-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("&amp;Open File"), this, SLOT( openFile() ), ALT | Key_O );    file-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("&amp;Print"), this, SLOT( print() ), ALT | Key_P );    file-&gt;<a href="qmenudata.html#e34b79">insertSeparator</a>();    file-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("&amp;Close"), this, SLOT( close() ), ALT | Key_Q );    file-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("E&amp;xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );    // The same three icons are used twice each.    <a href="qiconset.html">QIconSet</a> icon_back( <a href="qpixmap.html">QPixmap</a>("back.xpm") );    <a href="qiconset.html">QIconSet</a> icon_forward( <a href="qpixmap.html">QPixmap</a>("forward.xpm") );    <a href="qiconset.html">QIconSet</a> icon_home( <a href="qpixmap.html">QPixmap</a>("home.xpm") );    <a href="qpopupmenu.html">QPopupMenu</a>* go = new <a href="qpopupmenu.html">QPopupMenu</a>( this );    backwardId = go-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( icon_back,                                 tr("&amp;Backward"), browser, SLOT( backward() ),                                 ALT | Key_Left );    forwardId = go-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( icon_forward,                                tr("&amp;Forward"), browser, SLOT( forward() ),                                ALT | Key_Right );    go-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( icon_home, tr("&amp;Home"), browser, SLOT( home() ) );    <a href="qpopupmenu.html">QPopupMenu</a>* help = new <a href="qpopupmenu.html">QPopupMenu</a>( this );    help-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("&amp;About ..."), this, SLOT( about() ) );    help-&gt;<a href="qmenudata.html#deddb9">insertItem</a>( tr("About &amp;<a href="qt.html">Qt</a> ..."), this, SLOT( aboutQt() ) );    hist = new <a href="qpopupmenu.html">QPopupMenu</a>( this );    QStringList::Iterator it = history.begin();    for ( ; it != history.end(); ++it )        mHistory[ hist-&gt;insertItem( *it ) ] = *it;    connect( hist, SIGNAL( activated( int ) ),             this, SLOT( histChosen( int ) ) );    bookm = new <a href="qpopupmenu.html">QPopupMenu</a>( this );    bookm-&gt;insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );    bookm-&gt;insertSeparator();    QStringList::Iterator it2 = bookmarks.begin();    for ( ; it2 != bookmarks.end(); ++it2 )        mBookmarks[ bookm-&gt;insertItem( *it2 ) ] = *it2;    connect( bookm, SIGNAL( activated( int ) ),             this, SLOT( bookmChosen( int ) ) );    menuBar()-&gt;insertItem( tr("&amp;File"), file );    menuBar()-&gt;insertItem( tr("&amp;Go"), go );    menuBar()-&gt;insertItem( tr( "History" ), hist );    menuBar()-&gt;insertItem( tr( "Bookmarks" ), bookm );    menuBar()-&gt;insertSeparator();    menuBar()-&gt;insertItem( tr("&amp;Help"), help );    menuBar()-&gt;setItemEnabled( forwardId, FALSE);    menuBar()-&gt;setItemEnabled( backwardId, FALSE);    connect( browser, SIGNAL( backwardAvailable( bool ) ),             this, SLOT( setBackwardAvailable( bool ) ) );    connect( browser, SIGNAL( forwardAvailable( bool ) ),             this, SLOT( setForwardAvailable( bool ) ) );    <a href="qtoolbar.html">QToolBar</a>* toolbar = new <a href="qtoolbar.html">QToolBar</a>( this );    addToolBar( toolbar, "Toolbar");    <a href="qtoolbutton.html">QToolButton</a>* button;    button = new <a href="qtoolbutton.html">QToolButton</a>( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );    connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );    button-&gt;<a href="qwidget.html#4b103c">setEnabled</a>( FALSE );    button = new <a href="qtoolbutton.html">QToolButton</a>( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );    connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );    button-&gt;<a href="qwidget.html#4b103c">setEnabled</a>( FALSE );    button = new <a href="qtoolbutton.html">QToolButton</a>( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );    toolbar-&gt;<a href="qtoolbar.html#af219d">addSeparator</a>();    pathCombo = new <a href="qcombobox.html">QComboBox</a>( TRUE, toolbar );    connect( pathCombo, SIGNAL( activated( const QString &amp; ) ),             this, SLOT( pathSelected( const QString &amp; ) ) );    toolbar-&gt;<a href="qtoolbar.html#7b948e">setStretchableWidget</a>( pathCombo );    setRightJustification( TRUE );    setDockEnabled( Left, FALSE );    setDockEnabled( Right, FALSE );    pathCombo-&gt;insertItem( home_ );    browser-&gt;setFocus();}void <a name="134"></a>HelpWindow::setBackwardAvailable( bool b)

⌨️ 快捷键说明

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