<?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[Sample Code of SimpleTreeModel]]></title><description><![CDATA[<p dir="auto">I try to use this code in my App.</p>
<p dir="auto">@QFile file(":/default.txt");<br />
file.open(QIODevice::ReadOnly);<br />
TreeModel model(file.readAll());<br />
file.close();</p>
<p dir="auto">QTreeView view;<br />
view.setModel(&amp;model);<br />
view.setWindowTitle(QObject::tr("Simple Tree Model"));<br />
view.show();@</p>
<p dir="auto">when I paste it in main then code works (I see QTreeView with data), but when paste it in QMainWindow constructor then I see an empty QTreeView window without data.</p>
<p dir="auto">why?</p>
<p dir="auto">!<a href="http://s3.amazonaws.com/twitpic/photos/full/202748685.jpg?AWSAccessKeyId=0ZRYP5X5F6FSMBCCSE82&amp;Expires=1291443830&amp;Signature=SHKQpEbG1EvKJh465qz76IiKSs4=(pic)" target="_blank" rel="noopener noreferrer nofollow ugc">http://s3.amazonaws.com/twitpic/photos/full/202748685.jpg?AWSAccessKeyId=0ZRYP5X5F6FSMBCCSE82&amp;Expires=1291443830&amp;Signature=SHKQpEbG1EvKJh465qz76IiKSs4=(pic)</a>!</p>
]]></description><link>https://forum.qt.io/topic/2110/sample-code-of-simpletreemodel</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 09:16:36 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/2110.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Dec 2010 06:07:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sample Code of SimpleTreeModel on Sat, 04 Dec 2010 06:43:04 GMT]]></title><description><![CDATA[<p dir="auto">ups!</p>
]]></description><link>https://forum.qt.io/post/62357</link><guid isPermaLink="true">https://forum.qt.io/post/62357</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sat, 04 Dec 2010 06:43:04 GMT</pubDate></item><item><title><![CDATA[Reply to Sample Code of SimpleTreeModel on Sat, 04 Dec 2010 06:10:26 GMT]]></title><description><![CDATA[<p dir="auto">QTreeModel and QTreeView are destroyed when QMainWindow constructor is finished. Use "new" to create these objects</p>
]]></description><link>https://forum.qt.io/post/62346</link><guid isPermaLink="true">https://forum.qt.io/post/62346</guid><dc:creator><![CDATA[blex]]></dc:creator><pubDate>Sat, 04 Dec 2010 06:10:26 GMT</pubDate></item></channel></rss>