<?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[SQLite Model to ComboList crashes the program]]></title><description><![CDATA[<p dir="auto">Hi Guys,</p>
<p dir="auto">I read a SQL dB correct using QSQLQueryModel. When I try to assign this model to the combolist on the ui, the program crashes.<br />
If I print the number of rows output from the query, it is correct. How can I read the data from the model? And where is my mistake here?<br />
@<br />
header<br />
QSqlQueryModel *model;<br />
QSqlDatabase db;</p>
<p dir="auto">cpp</p>
<pre><code>db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(dB_Setting_Path);
db.open();

this-&gt;model = new QSqlQueryModel;
model-&gt;setQuery("select dBpath from setting");

//qDebug() &lt;&lt; model-&gt;data(0).toString();
ui-&gt;listView-&gt;setModel(model);
</code></pre>
<p dir="auto">@</p>
]]></description><link>https://forum.qt.io/topic/18886/sqlite-model-to-combolist-crashes-the-program</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 16:17:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/18886.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Aug 2012 17:49:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to SQLite Model to ComboList crashes the program on Tue, 07 Aug 2012 01:27:05 GMT]]></title><description><![CDATA[<p dir="auto">Solved ... ui-&gt;setup was called after adding data to combobox and not before it.</p>
]]></description><link>https://forum.qt.io/post/146726</link><guid isPermaLink="true">https://forum.qt.io/post/146726</guid><dc:creator><![CDATA[SherifOmran]]></dc:creator><pubDate>Tue, 07 Aug 2012 01:27:05 GMT</pubDate></item></channel></rss>