<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; }; ... qConstOverload<int, const QString &>(&Foo::overloadedFunction) ... 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; }; ... qConstOverload<int, const QString &>(&Foo::overloadedFunction) ... qNonConstOverload<int, const QString &>(&Foo::overloadedFunction)
另请参阅 qOverload, qNonConstOverload,以及基于字符串的连接与基于函数的连接的区别。
template <typename T> auto qOverload(T functionPointer)
返回重载函数的指针。模板参数是函数的参数类型列表。functionPointer 是指向(成员)函数的指针:
struct Foo { void overloadedFunction(); void overloadedFunction(int, const QString &); }; ... qOverload<>(&Foo::overloadedFunction) ... qOverload<int, const QString &>(&Foo::overloadedFunction)
如果成员函数也是 const-重载的,则需要使用qConstOverload 和qNonConstOverload 。
另请参阅 qConstOverload(),qNonConstOverload() 和基于字符串的连接与基于函数的连接的区别。
© 2025 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.