<?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[[SOLVED] QDataWidgetMapper, clearing associated QLineEdit&#x27;s when table is empty]]></title><description><![CDATA[<p dir="auto">Hi.</p>
<p dir="auto">I have been wondering about this for some weeks, but I had some other things to worry about. Still, I've been looking into this every now and then and I can't really figure this out.</p>
<p dir="auto">I have a QTableView, tied to a QSqlTableModel. I also have a QDataWidgetMapper, which I used to sync the table with a QLineEdit based form where I can enter and edit records from my QSqlTableModel.</p>
<p dir="auto">The final piece is a function that I use to remove all the records in the table. That works, however, while the table becomes empty as it must, the QLineEdits will still hold the last values after the table has been cleaned.</p>
<p dir="auto">I could of course blank them "by hand" in the same function I use to erase all the records, but I am wondering if there isn't any more "straight" way to do this.</p>
<p dir="auto">I use QSqlTableModel::removeRows() along with rowCount() to remove the whole table. As said, the table widget empties itself. But the thing doesn't propagate into the QWidgetMapper for some reason, or maybe that's the intended behaviour...</p>
<p dir="auto">Thanks for any response, or just for reading :)</p>
]]></description><link>https://forum.qt.io/topic/30892/solved-qdatawidgetmapper-clearing-associated-qlineedit-s-when-table-is-empty</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 09:53:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/30892.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Aug 2013 15:54:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] QDataWidgetMapper, clearing associated QLineEdit&#x27;s when table is empty on Wed, 21 Aug 2013 19:22:24 GMT]]></title><description><![CDATA[<p dir="auto">You welcome !</p>
<p dir="auto">This question would as valid as any, don't worry,</p>
<p dir="auto">Happy coding :)</p>
]]></description><link>https://forum.qt.io/post/192007</link><guid isPermaLink="true">https://forum.qt.io/post/192007</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 21 Aug 2013 19:22:24 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QDataWidgetMapper, clearing associated QLineEdit&#x27;s when table is empty on Wed, 21 Aug 2013 16:05:21 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="SGaist" date="1377099893"]That would be the correct index.</p>
<p dir="auto">But whether the QDataWidgetMapper should clear the widget's content is more a question for the interest mailing list, you'll find there Qt's developers/maintainers (this forum is more user oriented)[/quote]</p>
<p dir="auto">Oh, I am not really concerned about that for now.</p>
<p dir="auto">Don't take me wrong, I am concerned about some things, and would be willing to help a bit, but my own ignorance would be nothing but a hindrance to any mailing list for now.</p>
<p dir="auto">I was just wondering if that was the intended behaviour of a QDataWidgetMapper instance.</p>
<p dir="auto">Even within my limited understanding of nowadays Qt, I can think of several ways to clean the fields in a more or less automated way.</p>
<p dir="auto">Thank you for clearing my doubt :)</p>
]]></description><link>https://forum.qt.io/post/191982</link><guid isPermaLink="true">https://forum.qt.io/post/191982</guid><dc:creator><![CDATA[i92guboj]]></dc:creator><pubDate>Wed, 21 Aug 2013 16:05:21 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QDataWidgetMapper, clearing associated QLineEdit&#x27;s when table is empty on Wed, 21 Aug 2013 15:44:53 GMT]]></title><description><![CDATA[<p dir="auto">That would be the correct index.</p>
<p dir="auto">But whether the QDataWidgetMapper should clear the widget's content is more a question for the interest mailing list, you'll find there Qt's developers/maintainers (this forum is more user oriented)</p>
]]></description><link>https://forum.qt.io/post/191974</link><guid isPermaLink="true">https://forum.qt.io/post/191974</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 21 Aug 2013 15:44:53 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QDataWidgetMapper, clearing associated QLineEdit&#x27;s when table is empty on Wed, 21 Aug 2013 10:15:53 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="SGaist" date="1377034234"]Hi,</p>
<p dir="auto">I wonder if the index of the mapper is updated while your remove the rows[/quote]</p>
<p dir="auto">I don't know what the correct behaviour would be, but the mapper-&gt;currentIndex() reports -1 after the removeRows() sentence.</p>
<p dir="auto">Thanks :)</p>
]]></description><link>https://forum.qt.io/post/191903</link><guid isPermaLink="true">https://forum.qt.io/post/191903</guid><dc:creator><![CDATA[i92guboj]]></dc:creator><pubDate>Wed, 21 Aug 2013 10:15:53 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QDataWidgetMapper, clearing associated QLineEdit&#x27;s when table is empty on Tue, 20 Aug 2013 21:30:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I wonder if the index of the mapper is updated while your remove the rows</p>
]]></description><link>https://forum.qt.io/post/191794</link><guid isPermaLink="true">https://forum.qt.io/post/191794</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 20 Aug 2013 21:30:34 GMT</pubDate></item></channel></rss>