<QOverload>

Funzioni per la risoluzione dei casi di sovraccarico. Altro...

Header: #include <QOverload>

Funzioni

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

Descrizione dettagliata

Documentazione delle funzioni

template <typename T> auto qConstOverload(T memberFunctionPointer)

Restituisce il puntatore memberFunctionPointer a una funzione membro costante:

    struct Foo {
        void overloadedFunction(int, const QString &);
        void overloadedFunction(int, const QString &) const;
    };
    auto ptr_1 = qConstOverload<int, const QString &>(&Foo::overloadedFunction);
    auto ptr_2 = qNonConstOverload<int, const QString &>(&Foo::overloadedFunction);

Vedi anche qOverload, qNonConstOverload e Differenze tra connessioni basate su stringhe e connessioni basate su funtori.

template <typename T> auto qNonConstOverload(T memberFunctionPointer)

Restituisce il puntatore memberFunctionPointer a una funzione membro non costante:

    struct Foo {
        void overloadedFunction(int, const QString &);
        void overloadedFunction(int, const QString &) const;
    };
    auto ptr_1 = qConstOverload<int, const QString &>(&Foo::overloadedFunction);
    auto ptr_2 = qNonConstOverload<int, const QString &>(&Foo::overloadedFunction);

Vedi anche qOverload, qConstOverload e Differenze tra connessioni basate su stringhe e connessioni basate su funtori.

template <typename T> auto qOverload(T functionPointer)

Restituisce un puntatore a una funzione sovraccaricata. Il parametro del template è l'elenco dei tipi degli argomenti della funzione. functionPointer è il puntatore alla funzione (membro):

struct Foo {
    void overloadedFunction();
    void overloadedFunction(int, const QString &);
};
auto ptr_1 = qOverload<>(&Foo::overloadedFunction);
auto ptr_2 = qOverload<int, const QString &>(&Foo::overloadedFunction);

Se una funzione membro è anche sovraccaricata con const, è necessario utilizzare qConstOverload e qNonConstOverload.

Vedi anche qConstOverload(), qNonConstOverload() e Differenze tra connessioni basate su stringhe e connessioni basate su funtori.

© 2026 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.