<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qabstractitemmodel.cpp --> <title>Obsolete Members for QAbstractItemModel | Qt Core 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QAbstractItemModel</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Obsolete Members for QAbstractItemModel</h1> <p><b>The following members of class <a href="qabstractitemmodel.html">QAbstractItemModel</a> are obsolete.</b> They are provided to keep old source code working. We strongly advise against using them in new code.</p> <h2>Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> <code>(obsolete) </code>void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemmodel-obsolete.html#setSupportedDragActions">setSupportedDragActions</a></b>(Qt::DropActions <i>actions</i>)</td></tr> </table></div> <ul> <li class="fn">2 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> </ul> <h2>Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> <code>(obsolete) </code>void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemmodel-obsolete.html#reset">reset</a></b>()</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> <code>(obsolete) </code>void </td><td class="memItemRight bottomAlign"><b><a href="qabstractitemmodel-obsolete.html#setRoleNames">setRoleNames</a></b>(const QHash<int, QByteArray> &<i>roleNames</i>)</td></tr> </table></div> <h2>Member Function Documentation</h2> <!-- $$$reset[overload1]$$$reset --> <h3 class="fn" id="reset"><a name="reset"></a><code>[protected] </code><span class="type">void</span> QAbstractItemModel::<span class="name">reset</span>()</h3> <p>Resets the model to its original state in any attached views.</p> <p>This function emits the signals <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>() and <a href="qabstractitemmodel.html#modelReset">modelReset</a>().</p> <p><b>Note: </b>Use <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and <a href="qabstractitemmodel.html#endResetModel">endResetModel</a>() instead whenever possible. Use this method only if there is no way to call <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() before invalidating the model. Otherwise it could lead to unexpected behaviour, especially when used with proxy models.</p><p>For example, in this code both signals <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>() and <a href="qabstractitemmodel.html#modelReset">modelReset</a>() are emitted <i>after</i> the data changes:</p> <pre class="cpp"> myData<span class="operator">.</span>clear(); reset(); </pre> <p>Instead you should use:</p> <pre class="cpp"> beginResetModel(); myData<span class="operator">.</span>clear(); endResetModel(); </pre> <!-- @@@reset --> <!-- $$$setRoleNames[overload1]$$$setRoleNamesconstQHash<int,QByteArray>& --> <h3 class="fn" id="setRoleNames"><a name="setRoleNames"></a><code>[protected] </code><span class="type">void</span> QAbstractItemModel::<span class="name">setRoleNames</span>(const <span class="type"><a href="qhash.html">QHash</a></span><<span class="type">int</span>, <span class="type"><a href="qbytearray.html">QByteArray</a></span>> &<i>roleNames</i>)</h3> <p>This function is obsolete. Reimplement <a href="qabstractitemmodel.html#roleNames">roleNames</a>() instead.</p> <p>Sets the model's role names to <i>roleNames</i>.</p> <p>This function allows mapping of role identifiers to role property names in scripting languages.</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also </b><a href="qabstractitemmodel.html#roleNames">roleNames</a>().</p> <!-- @@@setRoleNames --> <!-- $$$setSupportedDragActions[overload1]$$$setSupportedDragActionsQt::DropActions --> <h3 class="fn" id="setSupportedDragActions"><a name="setSupportedDragActions"></a><span class="type">void</span> QAbstractItemModel::<span class="name">setSupportedDragActions</span>(<span class="type"><a href="qt.html#DropAction-enum">Qt::DropActions</a></span> <i>actions</i>)</h3> <p>This function is obsolete. Reimplement <a href="qabstractitemmodel.html#supportedDragActions">supportedDragActions</a>() instead.</p> <p>Sets the supported drag <i>actions</i> for the items in the model.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qabstractitemmodel.html#supportedDragActions">supportedDragActions</a>() and <a href="../qtwidgets/model-view-programming.html#using-drag-and-drop-with-item-views">Using drag and drop with item views</a>.</p> <!-- @@@setSupportedDragActions --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> 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.<br> 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. </p> </div> </body> </html>