summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/droprectangle/window.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-07-08 09:41:53 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-07-12 15:16:11 +0000
commit35528215515c880625d22e616514f02e59d61b2d (patch)
treeb981fc8eb34ccd39d374fd69082b824a345d84de /src/gui/doc/snippets/droprectangle/window.cpp
parent505bdd07c03712194f776718d2516a388c6d44ea (diff)
QObject: make new-style-connects SFINAE-friendly
SFINAE out the new-style connect() overloads for const char* functions. Before, we detected the problem in the body of connect(), by failing the static_assert for signal/slot argument compatibility, but that's too late. We don't want to select that overload at all, because we want that decltype(QObject::connect(QAction*, &QAction::triggered, QObject*, SLOT(something())) SFINAEs instead of returning QMetaObject::Connect, because then all the classes that provide convenience new-style connect syntax by wrapping the QObject::connect() call can just use that decltype() to accept anything that will succeed in the wrapped connect() call instead of manually trying (and failing) to provide proper overloads themselves. [ChangeLog][QtCore][Potentially Source-Incompatible Changes] QObject::connect(sender, pointer-to-member, [receiver, ], SLOT(~~~)) is now SFINAEd out instead of triggering a static_assert(). That means it is now possible to use Expression SFINAE (decltype(QObject::connect(<sender>, <signal>, std::declval<Args>()...) to properly wrap new-style QObject::connect() calls with a single wrapper function, greatly simplifying the implementation, incl. passing Qt::ConnectionType arguments. For more information on how to use this in your own code, see the sources of QWidget::addAction(). Change-Id: I4052a49eacd63a432a9648a667adc435744a633d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/gui/doc/snippets/droprectangle/window.cpp')
0 files changed, 0 insertions, 0 deletions