<QOverload> Proxy Page

Functions

auto qConstOverload(T memberFunctionPointer)
auto qNonConstOverload(T memberFunctionPointer)
auto qOverload(T functionPointer)

Function Documentation

template <typename T> auto qConstOverload(T memberFunctionPointer)

Returns the memberFunctionPointer pointer to a constant member function:

    struct Foo {
        void overloadedFunction(int, const QString &);
        void overloadedFunction(int, const QString &) const;
    };
    ... qConstOverload<int, const QString &>(&Foo::overloadedFunction)
    ... qNonConstOverload<int, const QString &>(&Foo::overloadedFunction)

See also qOverload, qNonConstOverload, and Differences between String-Based and Functor-Based Connections.

template <typename T> auto qNonConstOverload(T memberFunctionPointer)

Returns the memberFunctionPointer pointer to a non-constant member function:

    struct Foo {
        void overloadedFunction(int, const QString &);
        void overloadedFunction(int, const QString &) const;
    };
    ... qConstOverload<int, const QString &>(&Foo::overloadedFunction)
    ... qNonConstOverload<int, const QString &>(&Foo::overloadedFunction)

See also qOverload, qNonConstOverload, and Differences between String-Based and Functor-Based Connections.

template <typename T> auto qOverload(T functionPointer)

Returns a pointer to an overloaded function. The template parameter is the list of the argument types of the function. functionPointer is the pointer to the (member) function:

    struct Foo {
        void overloadedFunction();
        void overloadedFunction(int, const QString &);
    };
    ... qOverload<>(&Foo::overloadedFunction)
    ... qOverload<int, const QString &>(&Foo::overloadedFunction)

If a member function is also const-overloaded qConstOverload and qNonConstOverload need to be used.

See also qConstOverload(), qNonConstOverload(), and Differences between String-Based and Functor-Based Connections.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.