2011-09-27 11:59:26 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2018-07-11 13:53:28 +02:00
|
|
|
** Copyright (C) 2018 The Qt Company Ltd.
|
2016-01-15 14:51:16 +01:00
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-09-27 11:59:26 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** This file is part of the Qt Creator documentation.
|
2011-09-27 11:59:26 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-09-27 11:59:26 +02:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** GNU Free Documentation License Usage
|
2011-09-27 11:59:26 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
|
|
|
** Documentation License version 1.3 as published by the Free Software
|
2016-01-15 14:51:16 +01:00
|
|
|
** Foundation and appearing in the file included in the packaging of
|
|
|
|
|
** this file. Please review the following information to ensure
|
|
|
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
|
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
2011-09-27 11:59:26 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
// **********************************************************************
|
|
|
|
|
// NOTE: the sections are not ordered by their logical order to avoid
|
|
|
|
|
// reshuffling the file each time the index order changes (i.e., often).
|
|
|
|
|
// Run the fixnavi.pl script to adjust the links to the index order.
|
|
|
|
|
// **********************************************************************
|
|
|
|
|
|
|
|
|
|
/*!
|
2011-12-13 11:52:47 +01:00
|
|
|
\previouspage creator-using-qt-designer.html
|
2011-09-27 11:59:26 +02:00
|
|
|
\page adding-plugins.html
|
2020-10-26 10:27:22 +02:00
|
|
|
\nextpage creator-ui-best-practices.html
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
\title Adding Qt Designer Plugins
|
|
|
|
|
|
|
|
|
|
You can use Qt APIs to create plugins that extend Qt applications.
|
2011-12-13 11:52:47 +01:00
|
|
|
This enables you to add your own widgets to \QD.
|
2011-09-27 11:59:26 +02:00
|
|
|
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 \l{How to Create Qt Plugins}.
|
|
|
|
|
|
|
|
|
|
For more information about how to create plugins for \QD, see
|
2013-11-25 17:37:19 +01:00
|
|
|
\l{Using Custom Widgets with Qt Designer}.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
\section1 Locating Qt Designer Plugins
|
|
|
|
|
|
|
|
|
|
\QD fetches plugins from the standard locations and loads the plugins
|
|
|
|
|
that match its build key. \QD is delivered both as a standalone application
|
2014-03-14 16:02:01 +01:00
|
|
|
and integrated into \QC. The correct folder to place the plugins depends on
|
|
|
|
|
whether you use the standalone \QD or the integrated \QD.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2015-08-04 15:46:12 +02:00
|
|
|
The integrated \QD fetches plugins from the \c {\bin\plugins\designer}
|
|
|
|
|
directory in the \QC installation directory on Windows and Linux. For
|
2016-08-03 16:46:29 +02:00
|
|
|
information about how to configure plugins on \macos, see
|
|
|
|
|
\l{Configuring Qt Designer Plugins on \macos}.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2015-08-04 15:46:12 +02:00
|
|
|
To check which plugins were loaded successfully and which failed, choose
|
|
|
|
|
\uicontrol Tools > \uicontrol {Form Editor} >
|
|
|
|
|
\uicontrol {About Qt Designer Plugins}.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
The standalone \QD is part of the Qt library used for building projects,
|
2015-08-04 15:46:12 +02:00
|
|
|
located in \c {<Qt_version>\<compiler>\bin} in the Qt installation
|
|
|
|
|
directory. It fetches plugins from the \c {\plugins\designer} subdirectory
|
|
|
|
|
of \c bin. To check which plugins were loaded successfully and which failed,
|
|
|
|
|
choose \uicontrol Help > \uicontrol {About Plugins}.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2016-08-03 16:46:29 +02:00
|
|
|
\section2 Configuring Qt Designer Plugins on \macos
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2016-08-03 16:46:29 +02:00
|
|
|
On \macos, a GUI application must be built and run from a bundle. A bundle
|
2011-09-27 11:59:26 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
\QC uses its own set of Qt Libraries located in the bundle, and therefore,
|
|
|
|
|
you need to configure the \QD plugins that you want to use with \QC.
|
2016-08-03 16:46:29 +02:00
|
|
|
For more information about how to deploy applications to \macos, see
|
2016-08-18 10:18:55 +02:00
|
|
|
\l{Qt for macOS - Deployment}.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
The following example illustrates how to configure version 5.2.1 of the
|
|
|
|
|
\l{http://qwt.sourceforge.net/}{Qwt - Qt Widgets for Technical Applications}
|
|
|
|
|
library for use with \QC:
|
|
|
|
|
|
|
|
|
|
\list 1
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li To check the paths used in the Qwt library, enter the following
|
2011-09-27 11:59:26 +02:00
|
|
|
\c otool command:
|
|
|
|
|
|
2014-08-26 09:57:09 +02:00
|
|
|
\include doc_src_plugins.qdocinc 0
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
2014-08-26 09:57:09 +02:00
|
|
|
\include doc_src_plugins.qdocinc 1
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li You must copy the \QD plugin and the Qwt library files to the
|
2011-09-27 11:59:26 +02:00
|
|
|
following locations:
|
|
|
|
|
|
|
|
|
|
\list
|
|
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li \c {libqwt_designer_plugin.dylib} to
|
2015-09-07 10:45:41 +02:00
|
|
|
\c {Qt Creator.app/Contents/PlugIns/designer}
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2015-09-07 10:45:41 +02:00
|
|
|
\li \c {libqwt.*.dylib} to \c {Qt Creator.app/Contents/Frameworks}
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
Enter the following commands:
|
|
|
|
|
|
2014-08-26 09:57:09 +02:00
|
|
|
\include doc_src_plugins.qdocinc 4
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Enter the following \c otool command to check the libraries that are
|
2011-09-27 11:59:26 +02:00
|
|
|
used by the Qwt library:
|
|
|
|
|
|
2014-08-26 09:57:09 +02:00
|
|
|
\include doc_src_plugins.qdocinc 2
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
The command returns the following output:
|
|
|
|
|
|
2014-08-26 09:57:09 +02:00
|
|
|
\include doc_src_plugins.qdocinc 3
|
2011-09-27 11:59:26 +02:00
|
|
|
|
2013-02-06 08:50:23 +01:00
|
|
|
\li Enter the following \c install_name_tool command to fix the
|
2011-09-27 11:59:26 +02:00
|
|
|
references of the libraries:
|
|
|
|
|
|
2014-08-26 09:57:09 +02:00
|
|
|
\include doc_src_plugins.qdocinc 5
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
\endlist
|
|
|
|
|
|
|
|
|
|
\section1 Matching Build Keys
|
|
|
|
|
|
2014-03-14 16:02:01 +01:00
|
|
|
The \QC that is included in pre-built Qt packages on Windows is built with
|
2011-09-27 11:59:26 +02:00
|
|
|
the Microsoft Visual Studio compiler, whereas the version of Qt shipped for
|
2020-09-01 17:10:36 +02:00
|
|
|
building applications is configured and built to use the \MinGW/g++ compiler.
|
2011-09-27 11:59:26 +02:00
|
|
|
Plugins built by using this version of Qt cannot be loaded by \QC because
|
|
|
|
|
the build-keys do not match. The plugins can only be used in the standalone
|
2020-04-02 11:46:41 +02:00
|
|
|
version of \QD. Choose \uicontrol Help > \uicontrol {About \QC} to check the
|
|
|
|
|
Qt version \QC was built with.
|
2011-09-27 11:59:26 +02:00
|
|
|
|
|
|
|
|
To use \QD plugins that were built for the shipped Qt version, make sure
|
|
|
|
|
that \QC is built with the same compiler by either recompiling \QC using
|
2020-09-01 17:10:36 +02:00
|
|
|
\MinGW or recompiling Qt with Microsoft Visual Studio, depending on which
|
2011-09-27 11:59:26 +02:00
|
|
|
configuration you want to use for your applications.
|
|
|
|
|
|
|
|
|
|
*/
|