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

📄 helpviewer-main-cpp.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
{    <a href="qmainwindow.html#0eb7bc">menuBar</a>()-&gt;setItemEnabled( backwardId, b);}void <a name="135"></a>HelpWindow::setForwardAvailable( bool b){    <a href="qmainwindow.html#0eb7bc">menuBar</a>()-&gt;setItemEnabled( forwardId, b);}void <a name="136"></a>HelpWindow::textChanged(){    if ( browser-&gt;documentTitle().isNull() ) {        <a href="qwidget.html#d6a291">setCaption</a>( "Qt Example - Helpviewer - " + browser-&gt;context() );        selectedURL = browser-&gt;context();    }    else {        <a href="qwidget.html#d6a291">setCaption</a>( "Qt Example - Helpviewer - " + browser-&gt;documentTitle() ) ;        selectedURL = browser-&gt;documentTitle();    }    if ( !selectedURL.isEmpty() &amp;&amp; pathCombo ) {        bool exists = FALSE;        int i;        for ( i = 0; i &lt; pathCombo-&gt;count(); ++i ) {            if ( pathCombo-&gt;text( i ) == selectedURL ) {                exists = TRUE;                break;            }        }        if ( !exists ) {            pathCombo-&gt;insertItem( selectedURL, 0 );            pathCombo-&gt;setCurrentItem( 0 );            mHistory[ hist-&gt;insertItem( selectedURL ) ] = selectedURL;        } else            pathCombo-&gt;setCurrentItem( i );        selectedURL = QString::null;    }}HelpWindow::~HelpWindow(){    history.clear();    <a href="qmap.html">QMap</a>&lt;int, QString&gt;::Iterator it = mHistory.begin();    for ( ; it != mHistory.end(); ++it )        history.append( *it );    <a href="qfile.html">QFile</a> f( <a href="qdir.html#2ec6fd">QDir::currentDirPath</a>() + "/.history" );    f.<a href="qfile.html#255995">open</a>( IO_WriteOnly );    <a href="qdatastream.html">QDataStream</a> s( &amp;f );    s &lt;&lt; history;    f.<a href="qfile.html#64e640">close</a>();    bookmarks.clear();    <a href="qmap.html">QMap</a>&lt;int, QString&gt;::Iterator it2 = mBookmarks.begin();    for ( ; it2 != mBookmarks.end(); ++it2 )        bookmarks.append( *it2 );    <a href="qfile.html">QFile</a> f2( <a href="qdir.html#2ec6fd">QDir::currentDirPath</a>() + "/.bookmarks" );    f2.<a href="qfile.html#255995">open</a>( IO_WriteOnly );    <a href="qdatastream.html">QDataStream</a> s2( &amp;f2 );    s2 &lt;&lt; bookmarks;    f2.<a href="qfile.html#64e640">close</a>();}void <a name="137"></a>HelpWindow::about(){    <a href="qmessagebox.html#f6c3cd">QMessageBox::about</a>( this, "HelpViewer Example",                        "&lt;p&gt;This example implements a simple HTML help viewer "                        "using Qt's rich text capabilities&lt;/p&gt;"                        "&lt;p&gt;It's just about 100 lines of C++ code, so don't expect too much :-)&lt;/p&gt;"                        );}void <a name="138"></a>HelpWindow::aboutQt(){    <a href="qmessagebox.html#b72270">QMessageBox::aboutQt</a>( this, "QBrowser" );}void <a name="139"></a>HelpWindow::openFile(){#ifndef QT_NO_FILEDIALOG    <a href="qstring.html">QString</a> fn = QFileDialog::getOpenFileName( QString::null, QString::null, this );    if ( !fn.<a href="qstring.html#c62623">isEmpty</a>() )        browser-&gt;setSource( fn );#endif}void <a name="140"></a>HelpWindow::newWindow(){    ( new HelpWindow(browser-&gt;source(), "qbrowser") )-&gt;show();}void <a name="141"></a>HelpWindow::print(){#ifndef QT_NO_PRINTER    <a href="qprinter.html">QPrinter</a> printer;    printer.<a href="qprinter.html#ec440a">setFullPage</a>(TRUE);    if ( printer.<a href="qprinter.html#c3cd23">setup</a>() ) {        <a href="qpainter.html">QPainter</a> p( &amp;printer );        <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> metrics(p.<a href="qpainter.html#82920f">device</a>());        int dpix = metrics.<a href="qpaintdevicemetrics.html#a15e9e">logicalDpiX</a>();        int dpiy = metrics.<a href="qpaintdevicemetrics.html#b13b26">logicalDpiY</a>();        const int margin = 72; // pt        <a href="qrect.html">QRect</a> body(margin*dpix/72, margin*dpiy/72,                   metrics.<a href="qpaintdevicemetrics.html#95eb7b">width</a>()-margin*dpix/72*2,                   metrics.<a href="qpaintdevicemetrics.html#d4fedb">height</a>()-margin*dpiy/72*2 );        <a href="qfont.html">QFont</a> font("times", 10);        <a href="qsimplerichtext.html">QSimpleRichText</a> richText( browser-&gt;text(), font, browser-&gt;context(), browser-&gt;styleSheet(),                                  browser-&gt;mimeSourceFactory(), body.<a href="qrect.html#581ab8">height</a>() );        richText.<a href="qsimplerichtext.html#6f02c2">setWidth</a>( &amp;p, body.<a href="qrect.html#45fe95">width</a>() );        <a href="qrect.html">QRect</a> view( body );        int page = 1;        for (;;) {            p.<a href="qpainter.html#898839">setClipRect</a>( body );            richText.<a href="qsimplerichtext.html#4e026f">draw</a>( &amp;p, body.<a href="qrect.html#369cab">left</a>(), body.<a href="qrect.html#4dd27e">top</a>(), view, <a href="qwidget.html#d92bf4">colorGroup</a>() );            p.<a href="qpainter.html#79ea5e">setClipping</a>( FALSE );            view.<a href="qrect.html#3de222">moveBy</a>( 0, body.<a href="qrect.html#581ab8">height</a>() );            p.<a href="qpainter.html#eb778c">translate</a>( 0 , -body.<a href="qrect.html#581ab8">height</a>() );            p.<a href="qpainter.html#998df2">setFont</a>( font );            p.<a href="qpainter.html#0f088f">drawText</a>( view.<a href="qrect.html#896e32">right</a>() - p.<a href="qpainter.html#73b2e5">fontMetrics</a>().width( <a href="qstring.html#1cd85f">QString::number</a>(page) ),                        view.<a href="qrect.html#2de4b0">bottom</a>() + p.<a href="qpainter.html#73b2e5">fontMetrics</a>().ascent() + 5, QString::number(page) );            if ( view.<a href="qrect.html#4dd27e">top</a>()  &gt;= richText.<a href="qsimplerichtext.html#428651">height</a>() )                break;            printer.<a href="qprinter.html#d4f693">newPage</a>();            page++;        }    }#endif}void <a name="142"></a>HelpWindow::pathSelected( const QString &amp;_path ){    browser-&gt;setSource( _path );    <a href="qmap.html">QMap</a>&lt;int, QString&gt;::Iterator it = mHistory.begin();    bool exists = FALSE;    for ( ; it != mHistory.end(); ++it ) {        if ( *it == _path ) {            exists = TRUE;            break;        }    }    if ( !exists )        mHistory[ hist-&gt;insertItem( _path ) ] = _path;}void <a name="143"></a>HelpWindow::readHistory(){    if ( <a href="qfile.html#900285">QFile::exists</a>( <a href="qdir.html#2ec6fd">QDir::currentDirPath</a>() + "/.history" ) ) {        <a href="qfile.html">QFile</a> f( <a href="qdir.html#2ec6fd">QDir::currentDirPath</a>() + "/.history" );        f.<a href="qfile.html#255995">open</a>( IO_ReadOnly );        <a href="qdatastream.html">QDataStream</a> s( &amp;f );        s &gt;&gt; history;        f.<a href="qfile.html#64e640">close</a>();        while ( history.count() &gt; 20 )            history.remove( history.begin() );    }}void <a name="144"></a>HelpWindow::readBookmarks(){    if ( <a href="qfile.html#900285">QFile::exists</a>( <a href="qdir.html#2ec6fd">QDir::currentDirPath</a>() + "/.bookmarks" ) ) {        <a href="qfile.html">QFile</a> f( <a href="qdir.html#2ec6fd">QDir::currentDirPath</a>() + "/.bookmarks" );        f.<a href="qfile.html#255995">open</a>( IO_ReadOnly );        <a href="qdatastream.html">QDataStream</a> s( &amp;f );        s &gt;&gt; bookmarks;        f.<a href="qfile.html#64e640">close</a>();    }}void <a name="145"></a>HelpWindow::histChosen( int i ){    if ( mHistory.contains( i ) )        browser-&gt;setSource( mHistory[ i ] );}void <a name="146"></a>HelpWindow::bookmChosen( int i ){    if ( mBookmarks.contains( i ) )        browser-&gt;setSource( mBookmarks[ i ] );}void <a name="147"></a>HelpWindow::addBookmark(){    mBookmarks[ bookm-&gt;insertItem( <a href="qwidget.html#f852bc">caption</a>() ) ] = caption();}</pre>  <hr>/*! \example qdir/qdir.cpp  <h1 align=center>QDir</h1><br clear="all">  ???  <hr>  Main:<pre>/****************************************************************************** &#36;Id&#58; qt/examples/helpviewer/main.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 name="qapplication.h"></a><a href="qapplication-h.html">qapplication.h</a>&gt;#include &lt;<a name="qwindowsstyle.h"></a><a href="qwindowsstyle-h.html">qwindowsstyle.h</a>&gt;#include &lt;<a name="qstylesheet.h"></a><a href="qstylesheet-h.html">qstylesheet.h</a>&gt;#include &lt;stdlib.h&gt;int main( int argc, char ** argv ){    <a name="QApplication::setColorSpec"></a><a href="qapplication.html#1ee2d1">QApplication::setColorSpec</a>( QApplication::ManyColor );    <a name="QApplication"></a><a href="qapplication.html">QApplication</a> a(argc, argv);    <a name="QString"></a><a href="qstring.html">QString</a> home;    if (argc &gt; 1)        home = argv[1];    else        home = QString(getenv("QTDIR")) + "/doc/html/index.html";    HelpWindow *help = new HelpWindow(home, ".", 0, "help viewer");    help-&gt;<a name="setCaption"></a><a href="qwidget.html#d6a291">setCaption</a>("Qt Example - Helpviewer");    if ( <a name="QApplication::desktop"></a><a href="qapplication.html#d8ed8c">QApplication::desktop</a>()-&gt;width() &gt; 400         &amp;&amp; <a href="qapplication.html#d8ed8c">QApplication::desktop</a>()-&gt;height() &gt; 500 )        help-&gt;<a name="show"></a><a href="qmainwindow.html#eb53e3">show</a>();    else        help-&gt;<a name="showMaximized"></a><a href="qwidget.html#b6e000">showMaximized</a>();    <a name="QObject::connect"></a><a href="qobject.html#7f8e37">QObject::connect</a>( &amp;a, SIGNAL(lastWindowClosed()),                      &amp;a, SLOT(quit()) );    return a.<a name="exec"></a><a href="qapplication.html#84c7bf">exec</a>();}</pre><p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright 

⌨️ 快捷键说明

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