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  · 

QDocumentSelectorService Class Reference
[QtBaseModule]

The QDocumentSelectorService class provides an interface for low-privilege applications to open to user selected documents. More...

    #include <QDocumentSelectorService>

Inherits QObject.

Public Functions

  • 29 public functions inherited from QObject

Public Slots

  • 1 public slot inherited from QObject

Signals

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QDocumentSelectorService class provides an interface for low-privilege applications to open to user selected documents.

Applications with insufficient permissions to access the Qt Extended Document System directly may use the document selector service to request that a server application open files on their behalf. Rather that opening a document specified by the application, the server displays a document selector for the user to select a document which is then opened and read access granted to the application.

Documents may also write to files by requesting permission to either save an already open document or create a new document. In both cases the user must confirm they wish to save the document before the server will open it in write-only mode.

Only one document may be opened by the service at a time. The currently opened document may be retrieved using the selectedDocument() method and the selectedDocumentData() method returns a QIODevice through the the document may be read from or written to.

See also QDocumentSelector.


Member Function Documentation

QDocumentSelectorService::QDocumentSelectorService ( QObject * parent = 0 )

Contructs a new document selector service with the given parent.

QDocumentSelectorService::~QDocumentSelectorService ()   [virtual]

Destroys the document selector service.

void QDocumentSelectorService::close ()   [slot]

Closes the selected document QIODevice and clears the selected document.

If the service is displaying a dialog that will also be closed.

To close the document without clearing the selection close the QIODevice returned by selectedDocumentData() instead.

void QDocumentSelectorService::documentOpened ( const QContent & document, QIODevice * data )   [signal]

Signals that a document has been opened and it may be read from or written to using data.

After this signal has been emitted the values of document and data may be acquired from the selectedDocument() and selectedDocumentData() methods.

QContentFilter QDocumentSelectorService::filter () const

Returns the services document selector's content filter.

See also setFilter().

bool QDocumentSelectorService::newDocument ( const QString & name, const QString & type, QWidget * widget = 0 )

Attempts to create a new document.

The user will be prompted with a suggested name and the type to save the document as. Returns true if the user accepts and the document was succesfully created; false otherwise.

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in write-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

bool QDocumentSelectorService::newDocument ( const QString & name, const QStringList & types, QWidget * widget = 0 )

This is an overloaded member function, provided for convenience.

Attempts to create a new document.

The user will be prompted with a suggested name and possible mime types to save the document as. Returns true if the user accepts and the document was succesfully created; false otherwise.

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in write-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

bool QDocumentSelectorService::openDocument ( QWidget * widget = 0 )

Prompts the user to select a document to open in read-only mode. Returns true if the user selects a document and it is successfully opened; false otherwise.

The content displayed in the selector may be altered by setting the content filter with setFilter() and the sort order with sortOrder().

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in read-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

bool QDocumentSelectorService::saveDocument ( QWidget * widget = 0 )

Tries to open the last opened document in write only mode so changes can be saved.

The user will be prompted before the document is opened. Returns true if the user accepts and the document was succesfully opened; false otherwise.

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in write-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

QContent QDocumentSelectorService::selectedDocument () const

Returns the last selected document.

QIODevice * QDocumentSelectorService::selectedDocumentData ()

Returns a pointer to the data of the selected document.

The service retains ownership of the returned QIODevice.

See also selectedDocument().

void QDocumentSelectorService::setFilter ( const QContentFilter & filter )

Sets the service document selector's content filter.

See also filter().

void QDocumentSelectorService::setSortCriteria ( const QContentSortCriteria & sort )

Sets the sort criteria of the service document selector.

See also sortCriteria().

QContentSortCriteria QDocumentSelectorService::sortCriteria () const

Returns the sort mode of the service document selector.

See also setSortCriteria().

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 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 7
Page suivante

Le Qt Quarterly au hasard

Logo

Un plugin pour QImage

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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 qtextended4.4
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