<QOverload>

オーバーロードの解決に関する関数。詳細...

Header: #include <QOverload>

関数

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

詳細な説明

関数のドキュメント

template <typename T> auto qConstOverload(T memberFunctionPointer)

定数メンバ関数へのmemberFunctionPointer ポインタを返します:

    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);

「 qOverload 」、「qNonConstOverload 」、および「文字列ベースの接続とファンクタベースの接続の違い」も参照してください 。

template <typename T> auto qNonConstOverload(T memberFunctionPointer)

非定数メンバ関数へのmemberFunctionPointer ポインタを返します:

    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);

「 qOverload 」、「qConstOverload 」、および「文字列ベースの接続とファンクタベースの接続の違い」も参照してください 。

template <typename T> auto qOverload(T functionPointer)

オーバーロードされた関数へのポインタを返します。テンプレートパラメータは、その関数の引数型のリストです。functionPointer は、(メンバ)関数へのポインタです:

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

メンバ関数が const オーバーロードされている場合は、qConstOverload およびqNonConstOverload を使用する必要があります。

qConstOverload()、qNonConstOverload()、および「文字列ベースの接続とファンクタベースの接続の違い」も参照してください 。

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