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  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Plug & Paint Extra Filters Example

The Extra Filters example is a plugin for the Plug & Paint example. It provides a set of filters in addition to those provided by the Basic Tools plugin.

Since the approach is identical to Basic Tools, we won't review the code here. The only part of interest is the .pro file, since Extra Filters is a dynamic plugin (Basic Tools is linked statically into the Plug & Paint executable).

Here's the project file for building the Extra Filters plugin:

 TEMPLATE      = lib
 CONFIG       += plugin
 INCLUDEPATH  += ../..
 HEADERS       = extrafiltersplugin.h
 SOURCES       = extrafiltersplugin.cpp
 OTHER_FILES  += extrafilters.json
 TARGET        = $$qtLibraryTarget(pnp_extrafilters)
 DESTDIR       = ../../plugandpaint/plugins

The .pro file differs from typical .pro files in many respects. First, it starts with a TEMPLATE entry specifying lib. (The default template is app.) It also adds plugin to the CONFIG variable. This is necessary on some platforms to avoid generating symbolic links with version numbers in the file name, which is appropriate for most dynamic libraries but not for plugins.

The INCLUDEPATH variable sets the search paths for global headers (i.e., header files included using #include <...>). We add Qt's examples/tools directory (strictly speaking, examples/tools/plugandpaintplugins/basictools/../..) to the list, so that we can include <plugandpaint/interfaces.h>.

The TARGET variable specifies which name we want to give the target library. We use pnp_ as the prefix to show that the plugin is designed to work with Plug & Paint. On Unix, lib is also prepended to that name. On all platforms, a platform-specific suffix is appended (e.g., .dll on Windows, .so on Linux).

The DESTDIR variable specifies where we want to install the plugin. We put it in Plug & Paint's plugins subdirectory, since that's where the application looks for dynamic plugins.

The CONFIG() code at the end is necessary for this example because the example is part of the Qt distribution and Qt can be configured to be built simultaneously in debug and in release modes. You don't need to for your own plugins.

Files:

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 5.0-snapshot
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