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  · 

Using qt.conf

The qt.conf file overrides the hard-coded paths that are compiled into the Qt library. These paths are accessible using the QLibraryInfo class. Without qt.conf, the functions in QLibraryInfo return these hard-coded paths; otherwise they return the paths as specified in qt.conf.

Without qt.conf, the Qt libraries will use the hard-coded paths to look for plugins, translations, and so on. These paths may not exist on the target system, or they may not be accesssible. Because of this, you need qt.conf to make the Qt libraries look elsewhere.

QLibraryInfo will load qt.conf from one of the following locations:

  1. :/qt/etc/qt.conf using the resource system
  2. on Mac OS X, in the Resource directory inside the appliction bundle, for example assistant.app/Contents/Resources/qt.conf
  3. in the directory containing the application executable, i.e. QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"

The qt.conf file is an INI text file, as described in the QSettings documentation. The file should have a Paths group which contains the entries that correspond to each value of the QLibraryInfo::LibraryLocation enum. See the QLibraryInfo documentation for details on the meaning of the various locations.

EntryDefault Value
PrefixQCoreApplication::applicationDirPath()
Documentationdoc
Headersinclude
Librarieslib
Binariesbin
Pluginsplugins
Data.
Translationstranslations
Settings.
Examples.
Demos.

Absolute paths are used as specified in the qt.conf file. All paths are relative to the Prefix. On Windows and X11, the Prefix is relative to the directory containing the application executable (QCoreApplication::applicationDirPath()). On Mac OS X, the Prefix is relative to the Contents in the application bundle. For example, application.app/Contents/plugins/ is the default location for loading Qt plugins. Note that the plugins need to be placed in specific sub-directories under the plugins directory (see How to Create Qt Plugins for details).

For example, a qt.conf file could contain the following:

 [Paths]
 Prefix = /some/path
 Translations = i18n

Subgroups of the Paths group may be used to specify locations for specific versions of the Qt libraries. Such subgroups are of the form Paths/x.y.z, where x is the major version of the Qt libraries, y the minor, and z the patch level. The subgroup that most closely matches the current Qt version is used. If no subgroup matches, the Paths group is used as the fallback. The minor and patch level values may be omitted, in which case they default to zero.

For example, given the following groups:

 Paths
 Paths/4
 Paths/4.1
 Paths/4.2.5
 Paths/6

The current version will be matched as shown:

  • 4.0.1 matches Paths/4
  • 4.1.5 matches Paths/4.1
  • 4.6.3 matches Paths/4.2.5
  • 5.0.0 matches Paths
  • 6.0.2 matches Paths/6

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 53
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  4. 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
  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. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Labs au hasard

Logo

Le coût des commodités

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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.5
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