Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QAssistantClient Class Reference

The QAssistantClient class provides a means of using Qt Assistant as an application's help tool. More...

 #include <QAssistantClient>

This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits QObject.


Properties

  • 1 property inherited from QObject

Public Functions

QAssistantClient ( const QString & path, QObject * parent = 0 )
~QAssistantClient ()
bool isOpen () const
void setArguments ( const QStringList & arguments )
  • 29 public functions inherited from QObject

Public Slots

virtual void closeAssistant ()
virtual void openAssistant ()
virtual void showPage ( const QString & page )
  • 1 public slot inherited from QObject

Signals

void assistantClosed ()
void assistantOpened ()
void error ( const QString & message )

Additional Inherited Members

  • 5 static public members inherited from QObject
  • 7 protected functions inherited from QObject

Detailed Description

The QAssistantClient class provides a means of using Qt Assistant as an application's help tool.

Note: This class is obsolete and only required when using the old Qt Assistant, now called assistant_adp. If you want to use the new Qt Assistant as a remote help viewer, simple create a QProcess instance and specify assistant as its executable. The following code shows how to start Qt Assistant and request a certain page to be shown:

         QProcess *process = new QProcess(this);
         QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath)
             + QLatin1String("/assistant");

         process->start(app, QStringList() << QLatin1String("-enableRemoteControl"));
         if (!process->waitForStarted()) {
             QMessageBox::critical(this, tr("Remote Control"),
                 tr("Could not start Qt Assistant from %1.").arg(app));
             return;
         }

         // show index page
         QTextStream str(process);
         str << QLatin1String("SetSource qthelp://mycompany.com/doc/index.html")
             << QLatin1Char('\0') << endl;
     }

For a complete example using the Qt Assistant remotely, see the Remote Control example.

In order to make Qt Assistant act as a customized help tool for your application, you must provide your application with a QAssistantClient object in addition to a Qt Assistant Document Profile (.adp file) and the associated documentation.

Note that the QAssistantClient class is not included in the Qt library. To use it you must add the following line to your pro file:

         CONFIG += assistant

A QAssistantClient instance can open or close Qt Assistant whenever it is required.

Once you have created a QAssistantClient instance, specifying the path to the Qt Assistant executable, using Qt Assistant is simple: You can either call the openAssistant() slot to show the defined start page of the documentation, or you can call the showPage() slot to show a particular help page. When you call openAssistant() and showPage(), Qt Assistant will be launched if it isn't already running. When Qt Assistant is running, the isOpen() function returns true.

When calling showPage() the Qt Assistant instance will also be brought to the foreground if its hidden. The showPage() slot can be called multiple times, while calling openAssistant() several times without closing the application in between, will have no effect.

You can close Qt Assistant at any time using the closeAssistant() slot. When you call openAssistant(), or you call showPage() without a previous call to openAssistant(), the assistantOpened() signal is emitted. Similarly when closeAssistant() is called, assistantClosed() is emitted. In either case, if an error occurs, error() is emitted.

One QAssistantClient instance interacts with one Qt Assistant instance, so every time you call openAssistant(), showPage() or closeAssistant() they are applied to the particular Qt Assistant instance associated with the QAssistantClient.

Qt Assistant's documentation set can be altered using the command line arguments that are passed to the application when it is launched. When started without any options, Qt Assistant displays a default set of documentation. When Qt is installed, the default documentation set in Qt Assistant contains the Qt reference documentation as well as the tools that come with Qt, such as Qt Designer and qmake.

Use the setArguments() function to specify the command line arguments. You can add or remove documentation from Qt Assistant by adding and removing the relevant content files: The command line arguments are -addContentFile file.dcf and -removeContentFile file.dcf respectively. You can make Qt Assistant run customized documentation sets that are separate from the Qt documentation, by specifying a profile: -profile myapplication.adp. The profile format can also be used to alter several of Qt Assistant's properties such as its title and startpage.

The Documentation Content File (.dcf) and Qt Assistant Documentation Profile (.adp) formats are documented in the Qt Assistant Manual.

For a complete example using the QAssistantClient class, see the Simple Text Viewer example. The example shows how you can make Qt Assistant act as a customized help tool for your application using the QAssistantClient class combined with a Qt Assistant Document Profile.

See also Qt Assistant Manual and Simple Text Viewer Example.


Property Documentation

open : const bool

This property holds whether Qt Assistant is open.

Access functions:

bool isOpen () const

Member Function Documentation

QAssistantClient::QAssistantClient ( const QString & path, QObject * parent = 0 )

Constructs an assistant client with the specified parent. For systems other than Mac OS, path specifies the path to the Qt Assistant executable. For Mac OS, path specifies a directory containing a valid assistant.app bundle. If path is the empty string, the system path (%PATH% or $PATH) is used.

QAssistantClient::~QAssistantClient ()

Destroys the assistant client object.

void QAssistantClient::assistantClosed ()   [signal]

This signal is emitted when the connection to Qt Assistant is closed. This happens when the user exits Qt Assistant, if an error in the server or client occurs, or if closeAssistant() is called.

See also closeAssistant().

void QAssistantClient::assistantOpened ()   [signal]

This signal is emitted when Qt Assistant is opened and the client-server communication is set up.

See also openAssistant() and showPage().

void QAssistantClient::closeAssistant ()   [virtual slot]

Closes the Qt Assistant instance.

See also openAssistant() and assistantClosed().

void QAssistantClient::error ( const QString & message )   [signal]

This signal is emitted if Qt Assistant cannot be started, or if an error occurs during the initialization of the connection between Qt Assistant and the calling application. The message provides an explanation of the error.

void QAssistantClient::openAssistant ()   [virtual slot]

Opens Qt Assistant, i.e. sets up the client-server communication between the application and Qt Assistant, and shows the start page specified by the current Qt Assistant Document Profile. If there is no specfied profile, and Qt is installed, the default start page is the Qt Reference Documentation's index page.

If the connection is already established, this function does nothing. Use the showPage() function to show another page. If an error occurs, the error() signal is emitted.

See also showPage() and assistantOpened().

void QAssistantClient::setArguments ( const QStringList & arguments )

Sets the command line arguments that are passed to Qt Assistant when it is launched.

The command line arguments can be used to alter Qt Assistant's documentation set. When started without any options, Qt Assistant displays a default set of documentation. When Qt is installed, the default documentation set in Qt Assistant contains the Qt reference documentation as well as the tools that come with Qt, such as Qt Designer and qmake.

void QAssistantClient::showPage ( const QString & page )   [virtual slot]

Brings Qt Assistant to the foreground showing the given page. The page parameter is a path to an HTML file (e.g., QLatin1String("/home/pasquale/superproduct/docs/html/intro.html")).

If Qt Assistant hasn't been opened yet, this function will call the openAssistant() slot with the specified page as the start page.

Note: The first time Qt Assistant is started, its window will open in front of the application's windows. Subsequent calls to this function will only load the specified pages in Qt Assistant and will not display its window in front of the application's windows.

See also openAssistant().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 44
  2. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web