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  · 

Adding Qt Designer Plugins

You can use Qt APIs to create plugins that extend Qt applications. This allows you to add your own widgets to Qt Designer. The most flexible way to include a plugin with an application is to compile it into a dynamic library that is shipped separately, and detected and loaded at runtime.

The applications can detect plugins that are stored in the standard plugin subdirectories. For more information on how to create and locate plugins and to change the default plugin path, see How to Create Qt Plugins.

For more information about how to create plugins for Qt Designer, see Creating and Using Components for Qt Designer.

Locating Qt Designer Plugins

Qt Designer fetches plugins from the standard locations and loads the plugins that match its build key. Qt Designer is delivered both as a standalone application and as part of the SDK, where it is integrated into Qt Creator. The correct folder to place the plugins depends on which one you use.

The integrated Qt Designer fetches plugins from the %SDK%\bin\designer folder on Windows and Linux. For information about how to configure plugins on Mac OS, see Configuring Qt Designer Plugins on Mac OS.

To check which plugins were loaded successfully and which failed, choose Tools > Form Editor > About Qt Designer Plugins.

The standalone Qt Designer is part of the Qt library used for building projects, located under %SDK%\qt. Therefore, it fetches plugins from the following folder: %SDK%\qt\plugins\designer. To check which plugins were loaded successfully and which failed, choose Help > About Plugins.

Configuring Qt Designer Plugins on Mac OS

On the Mac, a GUI application must be built and run from a bundle. A bundle is a directory structure that appears as a single entity when viewed in the Finder. A bundle for an application typcially contains the executable and all the resources it needs.

Qt Creator uses its own set of Qt Libraries located in the bundle, and therefore, you need to configure the Qt Designer plugins that you want to use with Qt Creator. Fore more information about how to deploy applications on Mac OS, see Deploying an Application on Mac OS X.

The following example illustrates how to configure version 5.2.1 of the Qwt - Qt Widgets for Technical Applications library for use with Qt Creator:

  1. To check the paths used in the Qwt library, enter the following otool command:
     otool -L /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib

    The output for Qwt 5.2.1 indicates that the plugin uses Qt core libraries (QtDesigner, QtScript, QtXml, QtGui and QtCore) and libqwt.5.dylib:

     /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib:
             libqwt_designer_plugin.dylib (compatibility version 0.0.0, current version 0.0.0)
             libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1)
             QtDesigner.framework/Versions/4/QtDesigner (compatibility version 4.6.0, current version 4.6.2)
             QtScript.framework/Versions/4/QtScript (compatibility version 4.6.0, current version 4.6.2)
             QtXml.framework/Versions/4/QtXml (compatibility version 4.6.0, current version 4.6.2)
             QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
             QtCore.framework/Versions/4/QtCore (compatibility version 4.6.0, current version 4.6.2)
             /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
             /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0)
             /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)
  2. You must copy the Qt Designer plugin and the Qwt library files to the following locations:
    • libqwt_designer_plugin.dylib to QtCreator.app/Contents/MacOS/designer
    • libqwt.*.dylib to QtCreator.app/Contents/Frameworks

    Enter the following commands:

     sudo cp /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib \
             /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer
     sudo cp -R /usr/local/qwt-5.2.1/lib/*  \
             /Developer/Applications/Qt/Qt\ Creator.app/Contents/Frameworks/
  3. Enter the following otool command to check the libraries that are used by the Qwt library:
     otool -L /usr/local/qwt-5.2.1/lib/libqwt.5.dylib

    The command returns the following output:

     /usr/local/qwt-5.2.1/lib/libqwt.5.dylib:
             libqwt.5.dylib (compatibility version 5.2.0, current version 5.2.1)
             QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
             QtCore.framework/Versions/4/QtCore (compatibility version 4.6.0, current version 4.6.2)
             /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
             /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0)
             /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)
  4. Enter the following install_name_tool command to fix the references of the libraries:
     cd /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer
     sudo install_name_tool -change
         QtCore.framework/Versions/4/QtCore \
         @executable_path/../Frameworks/libQtCore.4.dylib \
         libqwt_designer_plugin.dylib
     sudo install_name_tool -change QtGui.framework/Versions/4/QtGui \
         @executable_path/../Frameworks/libQtGui.4.dylib \
         libqwt_designer_plugin.dylib
     sudo install_name_tool -change QtXml.framework/Versions/4/QtXml \
         @executable_path/../Frameworks/libQtXml.4.dylib \
         libqwt_designer_plugin.dylib
     sudo install_name_tool -change QtScript.framework/Versions/4/QtScript \
         @executable_path/../Frameworks/libQtScript.4.dylib \
         libqwt_designer_plugin.dylib
     sudo install_name_tool -change QtDesigner.framework/Versions/4/QtDesigner \
         @executable_path/../Frameworks/libQtDesigner.4.dylib \
         libqwt_designer_plugin.dylib
     sudo install_name_tool -change libqwt.5.dylib \
         @executable_path/../Frameworks/libqwt.5.dylib \
         libqwt_designer_plugin.dylib
    
     cd /Developer/Applications/Qt/Qt\ Creator.app/Contents/Frameworks
     sudo install_name_tool -change \
         QtCore.framework/Versions/4/QtCore \
         @executable_path/../Frameworks/libQtCore.4.dylib \
         libqwt.5.2.1.dylib
     sudo install_name_tool -change \
         QtGui.framework/Versions/4/QtGui \
         @executable_path/../Frameworks/libQtGui.4.dylib \
         libqwt.5.2.1.dylib

Matching Build Keys

The Qt Creator that is included in pre-built SDK packages on Windows is built with the Microsoft Visual Studio compiler, whereas the version of Qt shipped for building applications is configured and built to use the MinGW/g++ compiler. Plugins built by using this version of Qt cannot be loaded by Qt Creator because the build-keys do not match. The plugins can only be used in the standalone version of Qt Designer. Choose Help > About Qt Creator to check the Qt version Qt Creator was built with.

To use Qt Designer plugins that were built for the shipped Qt version, make sure that Qt Creator is built with the same compiler by either recompiling Qt Creator using MinGW or recompiling Qt with Microsoft Visual Studio, depending on which configuration you want to use for your applications.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
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 64
  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. 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 blog Digia au hasard

Logo

Créer des applications avec un style Metro avec Qt, exemples en QML et C++, un article de Digia Qt traduit par Thibaut Cuvelier

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 qtcreator-2.3
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