<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Auto Update Model in QWidgetMapper]]></title><description><![CDATA[<p dir="auto">Hello<br />
I use QWidgetMapper with a few QlineEdit for editing data in model. when user edit fields in QLineEdit the new data will placed in the model  when the enter key( or changing the focus) is pressed. I want to change this behavior so I need the data within the model change on the fly. I mean that data in model change as soon as possible user enter any key  without waiting for enter key or changing widget focus.<br />
Is there any way to accomplish this kind of behavior?</p>
]]></description><link>https://forum.qt.io/topic/119814/auto-update-model-in-qwidgetmapper</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 05:21:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/119814.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 10 Oct 2020 07:17:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Auto Update Model in QWidgetMapper on Sat, 10 Oct 2020 08:51:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hadi_m">@<bdi>hadi_m</bdi></a><br />
I do this on a widget mapper for a whole bunch of <code>QSpinBox</code>es.  I connect to <code>QSpinBox::valueChanged</code> and the slot calls <code>QDataWidgetMapper::submit()</code> to update the model immediately.  It works a treat :)</p>
<p dir="auto">Presumably you can do the same against <code>QLineEdit::textEdited</code>.  Note that there is a potential little wriggle.  If you're not careful, you change the model, it then changes the widget, and then that re-raises the "changed" signal and you get stuck forever.  My slot reads the current value from the model and exits if the value passed to the slot is the same as that retrieved from the model.  I also use <code>Qt::QueuedConnection</code> to prevent the slot causing changes while still within the original signal call, which was a problem.  These may be because I am using <code>QSpinBox</code>es, may not apply when using  <code>QLineEdit::textEdited</code> (which is a different signal from <code>QLineEdit::textChanged</code> which will be emitted when you change the value in the model programmatically and it reflects back to the widget).</p>
]]></description><link>https://forum.qt.io/post/621595</link><guid isPermaLink="true">https://forum.qt.io/post/621595</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Sat, 10 Oct 2020 08:51:32 GMT</pubDate></item><item><title><![CDATA[Reply to Auto Update Model in QWidgetMapper on Sat, 10 Oct 2020 07:36:42 GMT]]></title><description><![CDATA[<p dir="auto">This is not supported by QDataWidgetMapper, you have to write it by your own.</p>
]]></description><link>https://forum.qt.io/post/621590</link><guid isPermaLink="true">https://forum.qt.io/post/621590</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sat, 10 Oct 2020 07:36:42 GMT</pubDate></item></channel></rss>