Doc: mention that disconnecting all signals can be dangerous

Task-number: QTBUG-83387
Change-Id: I55c0a267e5490ba0226fd6858c18fd88cc3b8d59
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
This commit is contained in:
Mitch Curtis 2020-10-19 08:42:14 +02:00
parent 4ea99db8f3
commit 24a0303b9e
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,34 @@
/****************************************************************************
**
** Copyright (C) 2020 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$
**
****************************************************************************/
//! [disconnect-all]
\note Disconnecting all signal-slot connections will also disconnect the
\l QObject::destroyed() signal if it is connected. Doing so can adversely
affect classes that rely on this signal for cleaning up resources. It is
recommended to disconnect only the specific signals that were connected by
application code.
//! [disconnect-all]

View File

@ -2960,6 +2960,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
if \a receiver is left out, so you cannot disconnect a
specifically-named slot on all objects.
\include includes/qobject.qdocinc disconnect-all
\sa connect()
*/
bool QObject::disconnect(const QObject *sender, const char *signal,
@ -3095,6 +3097,8 @@ bool QObject::disconnect(const QObject *sender, const char *signal,
In the same way \nullptr can be used for \a receiver in the meaning "any receiving object".
In this case method should also be QMetaMethod(). \a sender parameter should be never \nullptr.
\include includes/qobject.qdocinc disconnect-all
\sa disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
*/
bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
@ -3172,6 +3176,8 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
A signal-slot connection is removed when either of the objects
involved are destroyed.
\include includes/qobject.qdocinc disconnect-all
*/
/*!