diff options
Diffstat (limited to 'src/corelib/doc/src/objectmodel/signalsandslots.qdoc')
-rw-r--r-- | src/corelib/doc/src/objectmodel/signalsandslots.qdoc | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index 85fe4df2ce..f0eeb20048 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** 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. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page signalsandslots.html @@ -32,7 +8,7 @@ \ingroup qt-basic-concepts \brief An overview of Qt's signals and slots inter-object communication mechanism. - + \ingroup explanations-basics Signals and slots are used for communication between objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by @@ -133,8 +109,7 @@ when the signal is emitted. Signals are automatically generated by the \l moc and must not be - implemented in the \c .cpp file. They can never have return types - (i.e. use \c void). + implemented in the \c .cpp file. A note about arguments: Our experience shows that signals and slots are more reusable if they do not use special types. If @@ -321,8 +296,7 @@ callbacks, you'd have to find five different names and keep track of the types yourself. - \sa QLCDNumber, QObject::connect(), {Digital Clock Example}, - {Tetrix Example} + \sa QLCDNumber, QObject::connect() \section1 Signals And Slots With Default Arguments @@ -412,8 +386,12 @@ \section2 Using Qt with 3rd Party Signals and Slots It is possible to use Qt with a 3rd party signal/slot mechanism. - You can even use both mechanisms in the same project. Just add the - following line to your qmake project (.pro) file. + You can even use both mechanisms in the same project. To do that, + write the following into your CMake project file: + + \snippet code/doc_src_containers.cpp cmake_no_keywords + + In a qmake project (.pro) file, you need to write: \snippet code/doc_src_containers.cpp 22 @@ -423,4 +401,19 @@ with the \c{no_keywords} flag, simply replace all uses of the Qt moc keywords in your sources with the corresponding Qt macros Q_SIGNALS (or Q_SIGNAL), Q_SLOTS (or Q_SLOT), and Q_EMIT. -*/ + + \section2 Signals and slots in Qt-based libraries + + The public API of Qt-based libraries should use the keywords + \c{Q_SIGNALS} and \c{Q_SLOTS} instead of \c{signals} and + \c{slots}. Otherwise it is hard to use such a library in a project + that defines \c{QT_NO_KEYWORDS}. + + To enforce this restriction, the library creator may set the + preprocessor define \c{QT_NO_SIGNALS_SLOTS_KEYWORDS} when building + the library. + + This define excludes signals and slots without affecting whether + other Qt-specific keywords can be used in the library + implementation. + */ |