qt5base-lts/tests/auto
Giuseppe D'Angelo 11b8c46d2a QObject: add a single shot connection flag
If one needed to listen to a signal just once, one had to
store the QMetaObject::Connection object returned by connect()
and use it to disconnect the slot after the first signal
activation.

This has led to a proliferation of using wrappers (and enough
TMP); they usually look like this:

1) create a shared_ptr<QMO::Connection>, allocating its payload;
2) create a lambda, capturing the shared_ptr by value;
3) in the lambda, disconnect the connection (through the shared_ptr),
   and call the actual slot;
4) connect the signal to the lambda, storing the returned
   QMO::Connection into the shared_ptr.

This is expensive, error prone for newcomers, and tricky to
support as a general facility inside one's projects.
We can do better, just support single shot connections right
in QObject.

[ChangeLog][QtCore][QObject] Added the Qt::SingleShotConnection
flag. When a connection is established with this flag set,
the slot is going to be activated at most once; when the signal
is emitted, the connection gets automatically broken by Qt.

Change-Id: I5f5feeae7f76c9c3d6323d841efba81c8f98ce7e
Fixes: QTBUG-44219
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2020-09-01 17:59:36 +02:00
..
cmake CMake: Fix configuration of CMake tests in-build-tree 2020-07-20 18:12:23 +02:00
concurrent QtConcurrent: Introduce runWithPromise() 2020-08-19 12:46:10 +02:00
corelib QObject: add a single shot connection flag 2020-09-01 17:59:36 +02:00
dbus Deprecate the static int based API in QMetaType 2020-08-24 00:19:05 +02:00
gui Qpagedpaintdevice: Use marginsF instead of internal struct margins 2020-09-01 04:57:48 +08:00
guiapplauncher Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
installed_cmake Add a unit test for testing Qt in its install location. 2013-07-02 23:08:54 +02:00
network Remove QFtp sources etc. in favor of alternate distribution 2020-08-27 18:58:21 +02:00
opengl Remove tst_QGL 2020-08-28 11:43:11 +02:00
other Take the right lock before using a connection's receiver 2020-09-01 02:48:40 +02:00
printsupport Qpagedpaintdevice: Use marginsF instead of internal struct margins 2020-09-01 04:57:48 +08:00
shared QWindowsFontDatabase: Check preferred family names for all fonts 2019-11-29 09:31:21 +01:00
sql QSqlite: Don't crash after binding too many placeholders 2020-08-24 13:50:55 +02:00
testlib Remove QVariant(int type, void *data, ...) constructor 2020-08-15 10:56:29 +02:00
tools Use OpenType font weights 2020-08-28 07:26:54 +02:00
widgets Deprecate and remove uses of AA_DisableHighDpiScaling 2020-08-31 19:14:55 +02:00
xml Disable deprecation warnings in some tests 2020-07-29 14:33:23 +02:00
.prev_CMakeLists.txt CMake: Regenerate subdir test projects 2020-07-09 09:38:39 +02:00
auto.pro CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
CMakeLists.txt CMake: Get tests/auto/cmake tests working 2020-07-17 09:43:04 +02:00
network-settings.h Revert "QAbstractSocket: deprecate 'error' member-function" 2020-02-26 23:07:52 +03:00