Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > b3a1f4d91c26f535919e39e25606614a > files > 1827

wt-doc-3.2.3-1.fc18.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Wt: Wt::WItemDelegate Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt
   &#160;<span id="projectnumber">3.2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespaceWt.html">Wt</a>      </li>
      <li class="navelem"><a class="el" href="classWt_1_1WItemDelegate.html">WItemDelegate</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">Wt::WItemDelegate Class Reference<div class="ingroups"><a class="el" href="group__modelview.html">Model/view system</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="Wt::WItemDelegate" --><!-- doxytag: inherits="Wt::WAbstractItemDelegate" -->
<p>Standard delegate class for rendering a view item.  
 <a href="classWt_1_1WItemDelegate.html#details">More...</a></p>

<p><code>#include &lt;Wt/WItemDelegate&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Wt::WItemDelegate:</div>
<div class="dyncontent">
<div class="center"><img src="classWt_1_1WItemDelegate__inherit__graph.png" border="0" usemap="#Wt_1_1WItemDelegate_inherit__map" alt="Inheritance graph"/></div>
<map name="Wt_1_1WItemDelegate_inherit__map" id="Wt_1_1WItemDelegate_inherit__map">
<area shape="rect" href="classWt_1_1WAbstractItemDelegate.html" title="Abstract delegate class for rendering an item in an item view." alt="" coords="5,80,189,107"/><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="49,5,145,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classWt_1_1WItemDelegate-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac016d3abb5a129df3a4a690fa9094bd0"></a><!-- doxytag: member="Wt::WItemDelegate::WItemDelegate" ref="ac016d3abb5a129df3a4a690fa9094bd0" args="(WObject *parent=0)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#ac016d3abb5a129df3a4a690fa9094bd0">WItemDelegate</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create an item delegate. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classWt_1_1WWidget.html">WWidget</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#a2cbc2240449a1000650f3c3b5e64bc8f">update</a> (<a class="el" href="classWt_1_1WWidget.html">WWidget</a> *widget, const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;index, WFlags&lt; <a class="el" href="namespaceWt.html#a8df2183a957c453839f3382e3db167d6">ViewItemRenderFlag</a> &gt; flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates or updates a widget that renders an item.  <a href="#a2cbc2240449a1000650f3c3b5e64bc8f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#a8d97be988b846205f61b646c3a424040">updateModelIndex</a> (<a class="el" href="classWt_1_1WWidget.html">WWidget</a> *widget, const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;index)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates the model index of a widget.  <a href="#a8d97be988b846205f61b646c3a424040"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#ad886d265dc00b95d9fb90c022a6322f9">setTextFormat</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;format)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the text format string.  <a href="#ad886d265dc00b95d9fb90c022a6322f9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#a378af3d59a2765edca259cd2fb75dc90">textFormat</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the text format string.  <a href="#a378af3d59a2765edca259cd2fb75dc90"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#a7f5f6ee8d506749f9e16463c5502f0f2">setModelData</a> (const boost::any &amp;editState, <a class="el" href="classWt_1_1WAbstractItemModel.html">WAbstractItemModel</a> *model, const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;index) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Saves the edited data to the model.  <a href="#a7f5f6ee8d506749f9e16463c5502f0f2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual boost::any&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#a4efa5822211a5791df55d2d464a5cd4e">editState</a> (<a class="el" href="classWt_1_1WWidget.html">WWidget</a> *editor) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current edit state.  <a href="#a4efa5822211a5791df55d2d464a5cd4e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#afacb5ea1866c2212ad3cf0a616c78857">setEditState</a> (<a class="el" href="classWt_1_1WWidget.html">WWidget</a> *editor, const boost::any &amp;value) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the editor data from the editor state.  <a href="#afacb5ea1866c2212ad3cf0a616c78857"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classWt_1_1WWidget.html">WWidget</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd">createEditor</a> (const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;index, WFlags&lt; <a class="el" href="namespaceWt.html#a8df2183a957c453839f3382e3db167d6">ViewItemRenderFlag</a> &gt; flags) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an editor for a data item.  <a href="#a832398b35176a47de56dce8fc89e58dd"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Standard delegate class for rendering a view item. </p>
<p>This class provides the standard implementation for rendering an item (as in a <a class="el" href="classWt_1_1WAbstractItemView.html" title="An abstract base class for item Views.">WAbstractItemView</a>), and renders data provided by the standard data roles (see ItemDataRole). It also provides default editing support using a line edit.</p>
<p>You may provide special editing support for an item by specializing the widget and reimplement <a class="el" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd" title="Creates an editor for a data item.">createEditor()</a>, <a class="el" href="classWt_1_1WItemDelegate.html#a7f5f6ee8d506749f9e16463c5502f0f2" title="Saves the edited data to the model.">setModelData()</a>, <a class="el" href="classWt_1_1WItemDelegate.html#a4efa5822211a5791df55d2d464a5cd4e" title="Returns the current edit state.">editState()</a>, and <a class="el" href="classWt_1_1WItemDelegate.html#afacb5ea1866c2212ad3cf0a616c78857" title="Sets the editor data from the editor state.">setEditState()</a>. </p>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a832398b35176a47de56dce8fc89e58dd"></a><!-- doxytag: member="Wt::WItemDelegate::createEditor" ref="a832398b35176a47de56dce8fc89e58dd" args="(const WModelIndex &amp;index, WFlags&lt; ViewItemRenderFlag &gt; flags) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> * Wt::WItemDelegate::createEditor </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">WFlags&lt; <a class="el" href="namespaceWt.html#a8df2183a957c453839f3382e3db167d6">ViewItemRenderFlag</a> &gt;&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates an editor for a data item. </p>
<p>The default implementation returns a <a class="el" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">WLineEdit</a> which edits the item's <a class="el" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068a6bc0da3ea683a06ee293a5a15f903cde" title="Role for the edited value.">Wt::EditRole</a> value.</p>
<p>You may reimplement this method to provide a suitable editor, or to attach a custom validator. In that case, you will probably also want to reimplement <a class="el" href="classWt_1_1WItemDelegate.html#a4efa5822211a5791df55d2d464a5cd4e" title="Returns the current edit state.">editState()</a>, <a class="el" href="classWt_1_1WItemDelegate.html#afacb5ea1866c2212ad3cf0a616c78857" title="Sets the editor data from the editor state.">setEditState()</a>, and <a class="el" href="classWt_1_1WItemDelegate.html#a7f5f6ee8d506749f9e16463c5502f0f2" title="Saves the edited data to the model.">setModelData()</a>.</p>
<p>The editor should not keep a reference to the model index (it does not need to since <a class="el" href="classWt_1_1WItemDelegate.html#a7f5f6ee8d506749f9e16463c5502f0f2" title="Saves the edited data to the model.">setModelData()</a> will provide the proper model index to save the data to the model). Otherwise, because model indexes may shift because of row or column insertions, you should reimplement <a class="el" href="classWt_1_1WItemDelegate.html#a8d97be988b846205f61b646c3a424040" title="Updates the model index of a widget.">updateModelIndex()</a>.</p>
<p>As an example of how to provide a specialized editor, consider the default implementation, which returns a <a class="el" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">WLineEdit</a>: </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component.">Wt::WWidget</a> *<a class="code" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd" title="Creates an editor for a data item.">WItemDelegate::createEditor</a>(<span class="keyword">const</span> <a class="code" href="classWt_1_1WModelIndex.html" title="A value class that describes an index to an item in a data model.">Wt::WModelIndex</a>&amp; index, WFlags&lt;ViewItemRenderFlag&gt; flags)<span class="keyword"> const</span>
<span class="keyword"> </span>{
   <a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a> *result = <span class="keyword">new</span> <a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a>();
   result-&gt;<a class="code" href="classWt_1_1WWebWidget.html#a270f7d4bec189c88842b47090ccb448c" title="Sets as selectable.">setSelectable</a>(<span class="keyword">true</span>);

   <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *lineEdit = <span class="keyword">new</span> <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a>();
   lineEdit-&gt;<a class="code" href="classWt_1_1WLineEdit.html#addb99c6ab5483836adf44a2706a410af" title="Sets the content of the line edit.">setText</a>(<a class="code" href="group__modelview.html#ga57b5cadd177847f51eaeb0cee23782c1" title="Interprets a boost::any as a string value.">asString</a>(index.<a class="code" href="classWt_1_1WModelIndex.html#a7f05920329ca4b7fdbb10931afdb634e" title="Returns data in the model at this index.">data</a>(<a class="code" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068a6bc0da3ea683a06ee293a5a15f903cde" title="Role for the edited value.">EditRole</a>), textFormat_));
   lineEdit-&gt;<a class="code" href="classWt_1_1WInteractWidget.html#a38f06d1ad95e7599b055f49931236c10" title="Event signal emitted when enter was pressed.">enterPressed</a>().connect(boost::bind(&amp;WItemDelegate::doCloseEditor, <span class="keyword">this</span>, result, <span class="keyword">true</span>));
   lineEdit-&gt;<a class="code" href="classWt_1_1WInteractWidget.html#ab581bba7f0ce02380e9339198bac2f78" title="Event signal emitted when escape was pressed.">escapePressed</a>().connect(boost::bind(&amp;WItemDelegate::doCloseEditor, <span class="keyword">this</span>, result, <span class="keyword">false</span>));

   <span class="keywordflow">if</span> (flags &amp; <a class="code" href="namespaceWt.html#a8df2183a957c453839f3382e3db167d6ab33ff2e9b3f5374810e9875eb2e61f59" title="Render (the editor) focused">RenderFocused</a>)
     lineEdit-&gt;<a class="code" href="classWt_1_1WFormWidget.html#afe33f5c3658ddbd08fec9f6c203c578b" title="Gives focus.">setFocus</a>();

   <span class="comment">// We use a layout so that the line edit fills the entire cell.</span>
   result-&gt;<a class="code" href="classWt_1_1WContainerWidget.html#a1c84e0ffe330d4798f0ce217f75be08c" title="Sets a layout manager for the container.">setLayout</a>(<span class="keyword">new</span> WHBoxLayout());
   result-&gt;<a class="code" href="classWt_1_1WContainerWidget.html#afaba82a27836f4a82bab48e8b26ccca2" title="Returns the layout manager that was set for the container.">layout</a>()-&gt;setContentsMargins(1, 1, 1, 1);
   result-&gt;<a class="code" href="classWt_1_1WContainerWidget.html#afaba82a27836f4a82bab48e8b26ccca2" title="Returns the layout manager that was set for the container.">layout</a>()-&gt;addWidget(lineEdit);

   <span class="keywordflow">return</span> result;
 }

 <span class="keywordtype">void</span> WItemDelegate::doCloseEditor(<a class="code" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component.">Wt::WWidget</a> *editor, <span class="keywordtype">bool</span> save)<span class="keyword"> const</span>
<span class="keyword"> </span>{
   <a class="code" href="classWt_1_1WAbstractItemDelegate.html#a02e957cf6c1f1e9a98c6de7dbe33ff07" title="Signal which indicates that an editor needs to be closed.">closeEditor</a>().emit(editor, save);
 }
</pre></div> 
</div>
</div>
<a class="anchor" id="a4efa5822211a5791df55d2d464a5cd4e"></a><!-- doxytag: member="Wt::WItemDelegate::editState" ref="a4efa5822211a5791df55d2d464a5cd4e" args="(WWidget *editor) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boost::any Wt::WItemDelegate::editState </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> *&#160;</td>
          <td class="paramname"><em>editor</em></td><td>)</td>
          <td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the current edit state. </p>
<p>The default implementation returns the current text in the line edit. You will need to reimplement this method for a custom editor.</p>
<p>As an example of how to deal with a specialized editor, consider the default implementation: </p>
<div class="fragment"><pre class="fragment"> boost::any <a class="code" href="classWt_1_1WItemDelegate.html#a4efa5822211a5791df55d2d464a5cd4e" title="Returns the current edit state.">WItemDelegate::editState</a>(<a class="code" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component.">Wt::WWidget</a> *editor)<span class="keyword"> const</span>
<span class="keyword"> </span>{
   <a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a> *w = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a> *<span class="keyword">&gt;</span>(editor);
   <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *lineEdit = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *<span class="keyword">&gt;</span>(w-&gt;<a class="code" href="classWt_1_1WContainerWidget.html#a53c79a7311ffe3c132b50bdbb830856d" title="Returns the widget at index">widget</a>(0));

   <span class="keywordflow">return</span> boost::any(lineEdit-&gt;<a class="code" href="classWt_1_1WLineEdit.html#ac74b58779cb635898cac13e81d8b0c7a" title="Returns the current content.">text</a>());
 }
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd" title="Creates an editor for a data item.">createEditor()</a>, <a class="el" href="classWt_1_1WItemDelegate.html#afacb5ea1866c2212ad3cf0a616c78857" title="Sets the editor data from the editor state.">setEditState()</a>, <a class="el" href="classWt_1_1WItemDelegate.html#a7f5f6ee8d506749f9e16463c5502f0f2" title="Saves the edited data to the model.">setModelData()</a> </dd></dl>

<p>Reimplemented from <a class="el" href="classWt_1_1WAbstractItemDelegate.html#aa54d70f669bd6cb7b8f90dca1f2c8c82">Wt::WAbstractItemDelegate</a>.</p>

</div>
</div>
<a class="anchor" id="afacb5ea1866c2212ad3cf0a616c78857"></a><!-- doxytag: member="Wt::WItemDelegate::setEditState" ref="afacb5ea1866c2212ad3cf0a616c78857" args="(WWidget *editor, const boost::any &amp;value) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WItemDelegate::setEditState </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> *&#160;</td>
          <td class="paramname"><em>editor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const boost::any &amp;&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the editor data from the editor state. </p>
<p>The default implementation resets the text in the line edit. You will need to reimplement this method if for a custom editor.</p>
<p>As an example of how to deal with a specialized editor, consider the default implementation: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> <a class="code" href="classWt_1_1WItemDelegate.html#afacb5ea1866c2212ad3cf0a616c78857" title="Sets the editor data from the editor state.">WItemDelegate::setEditState</a>(<a class="code" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component.">Wt::WWidget</a> *editor, <span class="keyword">const</span> boost::any&amp; value)<span class="keyword"> const</span>
<span class="keyword"> </span>{
   <a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a> *w = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a> *<span class="keyword">&gt;</span>(editor);
   <a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *lineEdit = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classWt_1_1WLineEdit.html" title="A widget that provides a single line edit.">Wt::WLineEdit</a> *<span class="keyword">&gt;</span>(w-&gt;<a class="code" href="classWt_1_1WContainerWidget.html#a53c79a7311ffe3c132b50bdbb830856d" title="Returns the widget at index">widget</a>(0));

   lineEdit-&gt;<a class="code" href="classWt_1_1WLineEdit.html#addb99c6ab5483836adf44a2706a410af" title="Sets the content of the line edit.">setText</a>(boost::any_cast&lt;Wt::WString&gt;(value));
 }
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd" title="Creates an editor for a data item.">createEditor()</a> </dd></dl>

<p>Reimplemented from <a class="el" href="classWt_1_1WAbstractItemDelegate.html#aeb49d13eed388ceed70943b5c6d4cd05">Wt::WAbstractItemDelegate</a>.</p>

</div>
</div>
<a class="anchor" id="a7f5f6ee8d506749f9e16463c5502f0f2"></a><!-- doxytag: member="Wt::WItemDelegate::setModelData" ref="a7f5f6ee8d506749f9e16463c5502f0f2" args="(const boost::any &amp;editState, WAbstractItemModel *model, const WModelIndex &amp;index) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WItemDelegate::setModelData </td>
          <td>(</td>
          <td class="paramtype">const boost::any &amp;&#160;</td>
          <td class="paramname"><em>editState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classWt_1_1WAbstractItemModel.html">WAbstractItemModel</a> *&#160;</td>
          <td class="paramname"><em>model</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Saves the edited data to the model. </p>
<p>The default implementation saves the current edit value to the model. You will need to reimplement this method for a custom editor.</p>
<p>As an example of how to deal with a specialized editor, consider the default implementation: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> <a class="code" href="classWt_1_1WItemDelegate.html#a7f5f6ee8d506749f9e16463c5502f0f2" title="Saves the edited data to the model.">WItemDelegate::setModelData</a>(<span class="keyword">const</span> boost::any&amp; <a class="code" href="classWt_1_1WItemDelegate.html#a4efa5822211a5791df55d2d464a5cd4e" title="Returns the current edit state.">editState</a>,
                                  <a class="code" href="classWt_1_1WAbstractItemModel.html" title="An abstract model for use with Wt&#39;s view classes.">Wt::WAbstractItemModel</a> *model,
                                  <span class="keyword">const</span> <a class="code" href="classWt_1_1WModelIndex.html" title="A value class that describes an index to an item in a data model.">Wt::WModelIndex</a>&amp; index)<span class="keyword"> const</span>
<span class="keyword"> </span>{
   model-&gt;<a class="code" href="classWt_1_1WAbstractItemModel.html#a70856db8c322be8c7f397a932165a943" title="Sets data at the given model index.">setData</a>(index, editState, <a class="code" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068a6bc0da3ea683a06ee293a5a15f903cde" title="Role for the edited value.">EditRole</a>);
 }
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd" title="Creates an editor for a data item.">createEditor()</a>, <a class="el" href="classWt_1_1WItemDelegate.html#a4efa5822211a5791df55d2d464a5cd4e" title="Returns the current edit state.">editState()</a> </dd></dl>

<p>Reimplemented from <a class="el" href="classWt_1_1WAbstractItemDelegate.html#a2b4b7bc9c3782190b5b0f91f0cf83c18">Wt::WAbstractItemDelegate</a>.</p>

</div>
</div>
<a class="anchor" id="ad886d265dc00b95d9fb90c022a6322f9"></a><!-- doxytag: member="Wt::WItemDelegate::setTextFormat" ref="ad886d265dc00b95d9fb90c022a6322f9" args="(const WString &amp;format)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WItemDelegate::setTextFormat </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> &amp;&#160;</td>
          <td class="paramname"><em>format</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the text format string. </p>
<p>The DisplayRole data is converted to a string using <a class="el" href="group__modelview.html#ga57b5cadd177847f51eaeb0cee23782c1" title="Interprets a boost::any as a string value.">asString()</a> by passing the given format.</p>
<p>The default value is "". </p>

</div>
</div>
<a class="anchor" id="a378af3d59a2765edca259cd2fb75dc90"></a><!-- doxytag: member="Wt::WItemDelegate::textFormat" ref="a378af3d59a2765edca259cd2fb75dc90" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="classWt_1_1WString.html">WString</a>&amp; Wt::WItemDelegate::textFormat </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the text format string. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WItemDelegate.html#ad886d265dc00b95d9fb90c022a6322f9" title="Sets the text format string.">setTextFormat()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a2cbc2240449a1000650f3c3b5e64bc8f"></a><!-- doxytag: member="Wt::WItemDelegate::update" ref="a2cbc2240449a1000650f3c3b5e64bc8f" args="(WWidget *widget, const WModelIndex &amp;index, WFlags&lt; ViewItemRenderFlag &gt; flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> * Wt::WItemDelegate::update </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> *&#160;</td>
          <td class="paramname"><em>widget</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">WFlags&lt; <a class="el" href="namespaceWt.html#a8df2183a957c453839f3382e3db167d6">ViewItemRenderFlag</a> &gt;&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates or updates a widget that renders an item. </p>
<p>The following properties of an item are rendered:</p>
<ul>
<li>text using the <a class="el" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f" title="Role for textual representation.">Wt::DisplayRole</a> data, with the format specified by <a class="el" href="classWt_1_1WItemDelegate.html#ad886d265dc00b95d9fb90c022a6322f9" title="Sets the text format string.">setTextFormat()</a></li>
<li>a check box depending on the <a class="el" href="group__modelview.html#gga1d77c4de293aebfacbdde124de06b8b0af309bd7d1183d934c73aefb2830e591c" title="Item can be checked.">Wt::ItemIsUserCheckable</a> flag and <a class="el" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068aad55e3ad8d7b76279adfc160bcb74940">Wt::CheckStateRole</a> data</li>
<li>an anchor depending on Wt::InternalPathRole or Wt::UrlRole values</li>
<li>an icon depending on the value of <a class="el" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068aab6678fc176854f7990d6cff4eed779e" title="Role for the url of an icon.">Wt::DecorationRole</a></li>
<li>a tooltip depending on the value of <a class="el" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068abde5f65c6b5cab667d11d1ceb87e4606" title="Role for a tooltip.">Wt::ToolTipRole</a></li>
<li>a custom style class depending on the value of <a class="el" href="group__modelview.html#gga0ae864e12320f9f89172735e075ed068a776934b313f273b8e5e602e7eee9f73b" title="Role for the style class.">Wt::StyleClassRole</a></li>
</ul>
<p>When the flags indicates <a class="el" href="namespaceWt.html#a8df2183a957c453839f3382e3db167d6a30a82a0b553e55ed6cdab23a8fdadc8b" title="Render in editing mode">Wt::RenderEditing</a>, then <a class="el" href="classWt_1_1WItemDelegate.html#a832398b35176a47de56dce8fc89e58dd" title="Creates an editor for a data item.">createEditor()</a> is called to create a suitable editor for editing the item. </p>

<p>Implements <a class="el" href="classWt_1_1WAbstractItemDelegate.html#adc95cc43b119f4e8ebeb36a39c015fa4">Wt::WAbstractItemDelegate</a>.</p>

</div>
</div>
<a class="anchor" id="a8d97be988b846205f61b646c3a424040"></a><!-- doxytag: member="Wt::WItemDelegate::updateModelIndex" ref="a8d97be988b846205f61b646c3a424040" args="(WWidget *widget, const WModelIndex &amp;index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WItemDelegate::updateModelIndex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> *&#160;</td>
          <td class="paramname"><em>widget</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classWt_1_1WModelIndex.html">WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Updates the model index of a widget. </p>
<p>This method is invoked by the view when due to row/column insertions or removals, the index has shifted.</p>
<p>You should reimplement this method only if you are storing the model index in the <code>widget</code>, to update the stored model index.</p>
<p>The default implementation does nothing. </p>

<p>Reimplemented from <a class="el" href="classWt_1_1WAbstractItemDelegate.html#ac5aefa0246f0fed2dcbf9493a98205c5">Wt::WAbstractItemDelegate</a>.</p>

</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>