<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qmetaobject.cpp --> <title>Qt 4.8: QMetaMethod Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qtcore.html">QtCore</a></li> <li>QMetaMethod</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QMetaMethod Class Reference</h1> <!-- $$$QMetaMethod-brief --> <p>The QMetaMethod class provides meta-data about a member function. <a href="#details">More...</a></p> <!-- @@@QMetaMethod --> <pre class="cpp"> <span class="preprocessor">#include <QMetaMethod></span></pre><ul> <li><a href="qmetamethod-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#Access-enum">Access</a></b> { Private, Protected, Public }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#MethodType-enum">MethodType</a></b> { Method, Signal, Slot, Constructor }</td></tr> </table> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Access </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#access">access</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#invoke">invoke</a></b> ( QObject * <i>object</i>, Qt::ConnectionType <i>connectionType</i>, QGenericReturnArgument <i>returnValue</i>, QGenericArgument <i>val0</i> = QGenericArgument( 0 ), QGenericArgument <i>val1</i> = QGenericArgument(), QGenericArgument <i>val2</i> = QGenericArgument(), QGenericArgument <i>val3</i> = QGenericArgument(), QGenericArgument <i>val4</i> = QGenericArgument(), QGenericArgument <i>val5</i> = QGenericArgument(), QGenericArgument <i>val6</i> = QGenericArgument(), QGenericArgument <i>val7</i> = QGenericArgument(), QGenericArgument <i>val8</i> = QGenericArgument(), QGenericArgument <i>val9</i> = QGenericArgument() ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#invoke-2">invoke</a></b> ( QObject * <i>object</i>, QGenericReturnArgument <i>returnValue</i>, QGenericArgument <i>val0</i> = QGenericArgument( 0 ), QGenericArgument <i>val1</i> = QGenericArgument(), QGenericArgument <i>val2</i> = QGenericArgument(), QGenericArgument <i>val3</i> = QGenericArgument(), QGenericArgument <i>val4</i> = QGenericArgument(), QGenericArgument <i>val5</i> = QGenericArgument(), QGenericArgument <i>val6</i> = QGenericArgument(), QGenericArgument <i>val7</i> = QGenericArgument(), QGenericArgument <i>val8</i> = QGenericArgument(), QGenericArgument <i>val9</i> = QGenericArgument() ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#invoke-3">invoke</a></b> ( QObject * <i>object</i>, Qt::ConnectionType <i>connectionType</i>, QGenericArgument <i>val0</i> = QGenericArgument( 0 ), QGenericArgument <i>val1</i> = QGenericArgument(), QGenericArgument <i>val2</i> = QGenericArgument(), QGenericArgument <i>val3</i> = QGenericArgument(), QGenericArgument <i>val4</i> = QGenericArgument(), QGenericArgument <i>val5</i> = QGenericArgument(), QGenericArgument <i>val6</i> = QGenericArgument(), QGenericArgument <i>val7</i> = QGenericArgument(), QGenericArgument <i>val8</i> = QGenericArgument(), QGenericArgument <i>val9</i> = QGenericArgument() ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#invoke-4">invoke</a></b> ( QObject * <i>object</i>, QGenericArgument <i>val0</i> = QGenericArgument( 0 ), QGenericArgument <i>val1</i> = QGenericArgument(), QGenericArgument <i>val2</i> = QGenericArgument(), QGenericArgument <i>val3</i> = QGenericArgument(), QGenericArgument <i>val4</i> = QGenericArgument(), QGenericArgument <i>val5</i> = QGenericArgument(), QGenericArgument <i>val6</i> = QGenericArgument(), QGenericArgument <i>val7</i> = QGenericArgument(), QGenericArgument <i>val8</i> = QGenericArgument(), QGenericArgument <i>val9</i> = QGenericArgument() ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#methodIndex">methodIndex</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> MethodType </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#methodType">methodType</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QByteArray> </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#parameterNames">parameterNames</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QByteArray> </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#parameterTypes">parameterTypes</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char * </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#signature">signature</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char * </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#tag">tag</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char * </td><td class="memItemRight bottomAlign"><b><a href="qmetamethod.html#typeName">typeName</a></b> () const</td></tr> </table> <a name="details"></a> <!-- $$$QMetaMethod-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QMetaMethod class provides meta-data about a member function.</p> <p>A QMetaMethod has a <a href="qmetamethod.html#methodType">methodType</a>(), a <a href="qmetamethod.html#signature">signature</a>(), a list of <a href="qmetamethod.html#parameterTypes">parameterTypes</a>() and <a href="qmetamethod.html#parameterNames">parameterNames</a>(), a return <a href="qmetamethod.html#typeName">typeName</a>(), a <a href="qmetamethod.html#tag">tag</a>(), and an <a href="qmetamethod.html#access">access</a>() specifier. You can use <a href="qmetamethod.html#invoke">invoke</a>() to invoke the method on an arbitrary <a href="qobject.html">QObject</a>.</p> <p>A method will only be registered with the meta-object system if it is a slot, a signal, or declared with the <a href="qobject.html#Q_INVOKABLE">Q_INVOKABLE</a> macro. Constructors can also be registered with <a href="qobject.html#Q_INVOKABLE">Q_INVOKABLE</a>.</p> </div> <p><b>See also </b><a href="qmetaobject.html">QMetaObject</a>, <a href="qmetaenum.html">QMetaEnum</a>, <a href="qmetaproperty.html">QMetaProperty</a>, and <a href="properties.html#qt-s-property-system">Qt's Property System</a>.</p> <!-- @@@QMetaMethod --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$Access$$$Private$$$Protected$$$Public --> <h3 class="fn"><a name="Access-enum"></a>enum QMetaMethod::<span class="name">Access</span></h3> <p>This enum describes the access level of a method, following the conventions used in C++.</p> <table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr> <tr><td class="topAlign"><tt>QMetaMethod::Private</tt></td><td class="topAlign"><tt>0</tt></td></tr> <tr><td class="topAlign"><tt>QMetaMethod::Protected</tt></td><td class="topAlign"><tt>1</tt></td></tr> <tr><td class="topAlign"><tt>QMetaMethod::Public</tt></td><td class="topAlign"><tt>2</tt></td></tr> </table> <!-- @@@Access --> <!-- $$$MethodType$$$Method$$$Signal$$$Slot$$$Constructor --> <h3 class="fn"><a name="MethodType-enum"></a>enum QMetaMethod::<span class="name">MethodType</span></h3> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QMetaMethod::Method</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">The function is a plain member function.</td></tr> <tr><td class="topAlign"><tt>QMetaMethod::Signal</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">The function is a signal.</td></tr> <tr><td class="topAlign"><tt>QMetaMethod::Slot</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">The function is a slot.</td></tr> <tr><td class="topAlign"><tt>QMetaMethod::Constructor</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">The function is a constructor.</td></tr> </table> <!-- @@@MethodType --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$access[overload1]$$$access --> <h3 class="fn"><a name="access"></a><span class="type"><a href="qmetamethod.html#Access-enum">Access</a></span> QMetaMethod::<span class="name">access</span> () const</h3> <p>Returns the access specification of this method (private, protected, or public).</p> <p>Signals are always protected, meaning that you can only emit them from the class or from a subclass.</p> <p><b>See also </b><a href="qmetamethod.html#methodType">methodType</a>().</p> <!-- @@@access --> <!-- $$$invoke[overload1]$$$invokeQObject*Qt::ConnectionTypeQGenericReturnArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgument --> <h3 class="fn"><a name="invoke"></a><span class="type">bool</span> QMetaMethod::<span class="name">invoke</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>object</i>, <span class="type"><a href="qt.html#ConnectionType-enum">Qt::ConnectionType</a></span> <i>connectionType</i>, <span class="type"><a href="qgenericreturnargument.html">QGenericReturnArgument</a></span> <i>returnValue</i>, <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val0</i> = QGenericArgument( 0 ), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val1</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val2</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val3</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val4</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val5</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val6</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val7</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val8</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val9</i> = QGenericArgument() ) const</h3> <p>Invokes this method on the object <i>object</i>. Returns true if the member could be invoked. Returns false if there is no such member or the parameters did not match.</p> <p>The invocation can be either synchronous or asynchronous, depending on the <i>connectionType</i>:</p> <ul> <li>If <i>connectionType</i> is <a href="qt.html#ConnectionType-enum">Qt::DirectConnection</a>, the member will be invoked immediately.</li> <li>If <i>connectionType</i> is <a href="qt.html#ConnectionType-enum">Qt::QueuedConnection</a>, a <a href="qevent.html">QEvent</a> will be posted and the member is invoked as soon as the application enters the main event loop.</li> <li>If <i>connectionType</i> is <a href="qt.html#ConnectionType-enum">Qt::AutoConnection</a>, the member is invoked synchronously if <i>object</i> lives in the same thread as the caller; otherwise it will invoke the member asynchronously.</li> </ul> <p>The return value of this method call is placed in <i>returnValue</i>. If the invocation is asynchronous, the return value cannot be evaluated. You can pass up to ten arguments (<i>val0</i>, <i>val1</i>, <i>val2</i>, <i>val3</i>, <i>val4</i>, <i>val5</i>, <i>val6</i>, <i>val7</i>, <i>val8</i>, and <i>val9</i>) to this method call.</p> <p><a href="qgenericargument.html">QGenericArgument</a> and <a href="qgenericreturnargument.html">QGenericReturnArgument</a> are internal helper classes. Because signals and slots can be dynamically invoked, you must enclose the arguments using the <a href="qmetaobject.html#Q_ARG">Q_ARG</a>() and <a href="qmetaobject.html#Q_RETURN_ARG">Q_RETURN_ARG</a>() macros. <a href="qmetaobject.html#Q_ARG">Q_ARG</a>() takes a type name and a const reference of that type; <a href="qmetaobject.html#Q_RETURN_ARG">Q_RETURN_ARG</a>() takes a type name and a non-const reference.</p> <p>To asynchronously invoke the <a href="qabstractbutton.html#animateClick">animateClick()</a> slot on a <a href="qpushbutton.html">QPushButton</a>:</p> <pre class="cpp"> <span class="type">int</span> methodIndex <span class="operator">=</span> pushButton<span class="operator">-</span><span class="operator">></span>metaObject()<span class="operator">-</span><span class="operator">></span>indexOfMethod(<span class="string">"animateClick()"</span>); <span class="type"><a href="qmetamethod.html">QMetaMethod</a></span> method <span class="operator">=</span> metaObject<span class="operator">-</span><span class="operator">></span>method(methodIndex); method<span class="operator">.</span>invoke(pushButton<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>QueuedConnection);</pre> <p>With asynchronous method invocations, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes. If you try to use a queued connection and get the error message</p> <pre class="cpp"> <span class="type"><a href="qmetamethod.html">QMetaMethod</a></span><span class="operator">::</span>invoke: Unable to handle unregistered datatype <span class="char">'MyType'</span></pre> <p>call <a href="qmetatype.html#qRegisterMetaType">qRegisterMetaType</a>() to register the data type before you call QMetaMethod::invoke().</p> <p>To synchronously invoke the <tt>compute(QString, int, double)</tt> slot on some arbitrary object <tt>obj</tt> retrieve its return value:</p> <pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> retVal; <span class="type"><a href="qbytearray.html">QByteArray</a></span> normalizedSignature <span class="operator">=</span> <span class="type"><a href="qmetaobject.html">QMetaObject</a></span><span class="operator">::</span>normalizedSignature(<span class="string">"compute(QString, int, double)"</span>); <span class="type">int</span> methodIndex <span class="operator">=</span> obj<span class="operator">-</span><span class="operator">></span>metaObject()<span class="operator">-</span><span class="operator">></span>indexOfMethod(normalizedSignature); <span class="type"><a href="qmetamethod.html">QMetaMethod</a></span> method <span class="operator">=</span> metaObject<span class="operator">-</span><span class="operator">></span>method(methodIndex); method<span class="operator">.</span>invoke(obj<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>DirectConnection<span class="operator">,</span> Q_RETURN_ARG(<span class="type"><a href="qstring.html">QString</a></span><span class="operator">,</span> retVal)<span class="operator">,</span> Q_ARG(<span class="type"><a href="qstring.html">QString</a></span><span class="operator">,</span> <span class="string">"sqrt"</span>)<span class="operator">,</span> Q_ARG(<span class="type">int</span><span class="operator">,</span> <span class="number">42</span>)<span class="operator">,</span> Q_ARG(<span class="type">double</span><span class="operator">,</span> <span class="number">9.7</span>));</pre> <p><a href="qmetaobject.html#normalizedSignature">QMetaObject::normalizedSignature</a>() is used here to ensure that the format of the signature is what invoke() expects. E.g. extra whitespace is removed.</p> <p>If the "compute" slot does not take exactly one <a href="qstring.html">QString</a>, one int and one double in the specified order, the call will fail.</p> <p><b>Warning:</b> this method will not test the validity of the arguments: <i>object</i> must be an instance of the class of the <a href="qmetaobject.html">QMetaObject</a> of which this <a href="qmetamethod.html">QMetaMethod</a> has been constructed with. The arguments must have the same type as the ones expected by the method, else, the behaviour is undefined.</p> <p><b>See also </b><a href="qmetaobject.html#Q_ARG">Q_ARG</a>(), <a href="qmetaobject.html#Q_RETURN_ARG">Q_RETURN_ARG</a>(), <a href="qmetatype.html#qRegisterMetaType">qRegisterMetaType</a>(), and <a href="qmetaobject.html#invokeMethod">QMetaObject::invokeMethod</a>().</p> <!-- @@@invoke --> <!-- $$$invoke$$$invokeQObject*QGenericReturnArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgument --> <h3 class="fn"><a name="invoke-2"></a><span class="type">bool</span> QMetaMethod::<span class="name">invoke</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>object</i>, <span class="type"><a href="qgenericreturnargument.html">QGenericReturnArgument</a></span> <i>returnValue</i>, <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val0</i> = QGenericArgument( 0 ), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val1</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val2</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val3</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val4</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val5</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val6</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val7</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val8</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val9</i> = QGenericArgument() ) const</h3> <p>This function overloads <a href="qmetamethod.html#invoke">invoke</a>().</p> <p>This overload always invokes this method using the connection type <a href="qt.html#ConnectionType-enum">Qt::AutoConnection</a>.</p> <!-- @@@invoke --> <!-- $$$invoke$$$invokeQObject*Qt::ConnectionTypeQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgument --> <h3 class="fn"><a name="invoke-3"></a><span class="type">bool</span> QMetaMethod::<span class="name">invoke</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>object</i>, <span class="type"><a href="qt.html#ConnectionType-enum">Qt::ConnectionType</a></span> <i>connectionType</i>, <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val0</i> = QGenericArgument( 0 ), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val1</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val2</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val3</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val4</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val5</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val6</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val7</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val8</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val9</i> = QGenericArgument() ) const</h3> <p>This function overloads <a href="qmetamethod.html#invoke">invoke</a>().</p> <p>This overload can be used if the return value of the member is of no interest.</p> <!-- @@@invoke --> <!-- $$$invoke$$$invokeQObject*QGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgumentQGenericArgument --> <h3 class="fn"><a name="invoke-4"></a><span class="type">bool</span> QMetaMethod::<span class="name">invoke</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>object</i>, <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val0</i> = QGenericArgument( 0 ), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val1</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val2</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val3</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val4</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val5</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val6</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val7</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val8</i> = QGenericArgument(), <span class="type"><a href="qgenericargument.html">QGenericArgument</a></span> <i>val9</i> = QGenericArgument() ) const</h3> <p>This function overloads <a href="qmetamethod.html#invoke">invoke</a>().</p> <p>This overload invokes this method using the connection type <a href="qt.html#ConnectionType-enum">Qt::AutoConnection</a> and ignores return values.</p> <!-- @@@invoke --> <!-- $$$methodIndex[overload1]$$$methodIndex --> <h3 class="fn"><a name="methodIndex"></a><span class="type">int</span> QMetaMethod::<span class="name">methodIndex</span> () const</h3> <p>Returns this method's index.</p> <p>This function was introduced in Qt 4.6.</p> <!-- @@@methodIndex --> <!-- $$$methodType[overload1]$$$methodType --> <h3 class="fn"><a name="methodType"></a><span class="type"><a href="qmetamethod.html#MethodType-enum">MethodType</a></span> QMetaMethod::<span class="name">methodType</span> () const</h3> <p>Returns the type of this method (signal, slot, or method).</p> <p><b>See also </b><a href="qmetamethod.html#access">access</a>().</p> <!-- @@@methodType --> <!-- $$$parameterNames[overload1]$$$parameterNames --> <h3 class="fn"><a name="parameterNames"></a><span class="type"><a href="qlist.html">QList</a></span><<span class="type"><a href="qbytearray.html">QByteArray</a></span>> QMetaMethod::<span class="name">parameterNames</span> () const</h3> <p>Returns a list of parameter names.</p> <p><b>See also </b><a href="qmetamethod.html#parameterTypes">parameterTypes</a>() and <a href="qmetamethod.html#signature">signature</a>().</p> <!-- @@@parameterNames --> <!-- $$$parameterTypes[overload1]$$$parameterTypes --> <h3 class="fn"><a name="parameterTypes"></a><span class="type"><a href="qlist.html">QList</a></span><<span class="type"><a href="qbytearray.html">QByteArray</a></span>> QMetaMethod::<span class="name">parameterTypes</span> () const</h3> <p>Returns a list of parameter types.</p> <p><b>See also </b><a href="qmetamethod.html#parameterNames">parameterNames</a>() and <a href="qmetamethod.html#signature">signature</a>().</p> <!-- @@@parameterTypes --> <!-- $$$signature[overload1]$$$signature --> <h3 class="fn"><a name="signature"></a>const <span class="type">char</span> * QMetaMethod::<span class="name">signature</span> () const</h3> <p>Returns the signature of this method (e.g., <tt>setValue(double)</tt>).</p> <p><b>See also </b><a href="qmetamethod.html#parameterTypes">parameterTypes</a>() and <a href="qmetamethod.html#parameterNames">parameterNames</a>().</p> <!-- @@@signature --> <!-- $$$tag[overload1]$$$tag --> <h3 class="fn"><a name="tag"></a>const <span class="type">char</span> * QMetaMethod::<span class="name">tag</span> () const</h3> <p>Returns the tag associated with this method.</p> <p>Tags are special macros recognized by <tt>moc</tt> that make it possible to add extra information about a method.</p> <p>Tag information can be added in the following way in the function declaration:</p> <pre class="cpp"> <span class="preprocessor">#define THISISTESTTAG // tag text</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="keyword">private</span> <span class="keyword">slots</span>: THISISTESTTAG <span class="type">void</span> testFunc();</pre> <p>and the information can be accessed by using:</p> <pre class="cpp"> MainWindow win; win<span class="operator">.</span>show(); <span class="type">int</span> functionIndex <span class="operator">=</span> win<span class="operator">.</span>metaObject()<span class="operator">-</span><span class="operator">></span>indexOfSlot(<span class="string">"testFunc()"</span>); <span class="type"><a href="qmetamethod.html">QMetaMethod</a></span> mm <span class="operator">=</span> metaObject()<span class="operator">-</span><span class="operator">></span>method(functionIndex); <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> mm<span class="operator">.</span>tag(); <span class="comment">// prints THISISTESTTAG</span></pre> <p>For the moment, <tt>moc</tt> doesn't support any special tags.</p> <!-- @@@tag --> <!-- $$$typeName[overload1]$$$typeName --> <h3 class="fn"><a name="typeName"></a>const <span class="type">char</span> * QMetaMethod::<span class="name">typeName</span> () const</h3> <p>Returns the return type of this method, or an empty string if the return type is <i>void</i>.</p> <!-- @@@typeName --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>