diff options
Diffstat (limited to 'examples/designer/doc/src/taskmenuextension.qdoc')
-rw-r--r-- | examples/designer/doc/src/taskmenuextension.qdoc | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/examples/designer/doc/src/taskmenuextension.qdoc b/examples/designer/doc/src/taskmenuextension.qdoc index f3e92ce86..440c2b28b 100644 --- a/examples/designer/doc/src/taskmenuextension.qdoc +++ b/examples/designer/doc/src/taskmenuextension.qdoc @@ -71,30 +71,21 @@ TicTacToeDialog class before we take a quick look at the \c TicTacToe widget's class definition. - \section1 The Project File: taskmenuextension.pro + \section1 Project files - The project file must contain some additional information to - ensure that the plugin will work as expected: + \section2 CMake - \snippet taskmenuextension/taskmenuextension.pro 0 - \snippet taskmenuextension/taskmenuextension.pro 1 - - The \c TEMPLATE variable's value makes \c qmake create the custom - widget as a library. Later, we will ensure that the widget will be - recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro to - export the relevant widget information. - - The \c CONFIG variable is set to \c plugin, which ensures that \c qmake - considers the custom widget a plugin library. + The project files need to state that a plugin linking + to the \QD libraries is to be built: - The \c QT variable contains the value \c designer. Since the plugin uses - components supplied with \QD that require linkage, this value ensures - that our plugin links against \QD's library (\c libQtDesigner.so). + \snippet taskmenuextension/CMakeLists.txt 0 + \codeline + \snippet taskmenuextension/CMakeLists.txt 2 - The header and source files for the widget are declared in the - usual way: + The following example shows how to add the header and source files of the + widget: - \snippet taskmenuextension/taskmenuextension.pro 2 + \snippet taskmenuextension/CMakeLists.txt 1 We provide an implementation of the plugin interface so that \QD can use the custom widget. In this particular example we also @@ -106,21 +97,33 @@ target path for the project and adding it to the list of items to install: - \snippet doc/snippets/doc_src_examples_taskmenuextension.pro 0 + \snippet taskmenuextension/CMakeLists.txt 3 + \snippet taskmenuextension/CMakeLists.txt 4 - The task menu extension is created as a library, and will be + The task menu extension is created as a library. It will be installed alongside the other \QD plugins when the project is - installed (using \c{make install} or an equivalent installation + installed (using \c{ninja install} or an equivalent installation procedure). - Note that if you want the plugins to appear in a Visual Studio - integration, the plugins must be built in release mode and their - libraries must be copied into the plugin directory in the install - path of the integration (for an example, see \c {C:/program - files/trolltech as/visual studio integration/plugins}). + For more information about plugins, see the + \l {How to Create Qt Plugins} documentation. + + \section2 qmake - For more information about plugins, see the \l {How to Create Qt - Plugins} documentation. + The following example shows how to link a plugin to the \QD libraries: + + \snippet taskmenuextension/taskmenuextension.pro 0 + \codeline + \snippet taskmenuextension/taskmenuextension.pro 1 + + The following example shows how to add the header and source files of the + widget: + + \snippet taskmenuextension/taskmenuextension.pro 2 + + The following example shows how to install a plugin to the \QD's plugin path: + + \snippet taskmenuextension/taskmenuextension.pro 3 \section1 TicTacToePlugin Class Definition @@ -129,7 +132,10 @@ {customwidgetplugin}{Custom Widget Plugin} example's plugin class which is explained in detail. The only part of the class definition that is specific to this particular custom widget - is the class name: + is the class name. + + To ensure that Qt recognizes the widget as a plugin, export relevant + information about the widget by adding the \c Q_PLUGIN_METADATA() macro: \snippet taskmenuextension/tictactoeplugin.h 0 |