summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qapplicationstatic.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-03-31 22:05:05 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-04-26 22:06:31 +0200
commit207aae5560aa2865ec55ddb9ecbb50048060c0c0 (patch)
tree78845d0cb0e855f9b2056f3a04af49a2c8c32450 /src/corelib/kernel/qapplicationstatic.h
parent1f27dc68717daf22ba5dab4634c60eda3eadab9c (diff)
Simplify the creation of APIs that take a callback
Functions in Qt that take a callback need to support callables with or without context objects, and member functions of an object. The implementation of those overloads follows a pattern that ultimately results in a QSlotObjectBase implementation being created and passed to an implementation helper that takes care of the logic. Factor that common pattern into a new helper template in QtPrivate that returns a suitable QSlotObjectBase after checking that the functor is compatible with the specified argument types. Use that new helper template in the implementation of QCoreApplication::requestPermission and QHostInfo::lookupHost. The only disadvantage of centralizing this logic is that we cannot print a more detailed error message indicating which argument types the caller expects. However, that information is visible from the detailed compiler errors anyway. Change-Id: I24cf0b2442217857b96ffc4d2d6c997c4fae34e0 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/kernel/qapplicationstatic.h')
0 files changed, 0 insertions, 0 deletions