QShortcut: fix build under QT_NO_CONTEXTLESS_CONNECT
QShortcut has a constructor that takes a _parent_ object and a function to invoke, and it will internally connect its activated() signal to that function. This connection will not provide a context object (the parent is not used to this purpose). Given it's not clear what the context should be if any (the parent? `this`?), I'm not at ease at just supplying "something" as the context. Instead, hide the constructor if we're under QT_NO_CONTEXTLESS_CONNECT. There's another constructor where the caller can supply a context. Change-Id: I21befcc86eeb07e65eadee1222757ecc5bab1d2c Pick-to: 6.9 6.8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
39df9e1858
commit
ade3bb1c52
@ -71,6 +71,7 @@ public:
|
||||
const QObject *context2, FunctorAmbiguous functorAmbiguous,
|
||||
Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
|
||||
#else
|
||||
#ifndef QT_NO_CONTEXTLESS_CONNECT
|
||||
template<typename Func1>
|
||||
QShortcut(const QKeySequence &key, QObject *parent,
|
||||
Func1 slot1,
|
||||
@ -79,6 +80,7 @@ public:
|
||||
{
|
||||
connect(this, &QShortcut::activated, std::move(slot1));
|
||||
}
|
||||
#endif
|
||||
template<class Obj1, typename Func1>
|
||||
QShortcut(const QKeySequence &key, QObject *parent,
|
||||
const Obj1 *object1, Func1 slot1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user