<?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" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[QAbstractItemModel - www.GuidoDiepen.nl]]></title><description><![CDATA[Tips and Tricks / Cool new tools / Automating everything / Analytics / Making life easier]]></description><link>https://www.guidodiepen.nl/</link><image><url>https://www.guidodiepen.nl/favicon.png</url><title>QAbstractItemModel - www.GuidoDiepen.nl</title><link>https://www.guidodiepen.nl/</link></image><generator>Ghost 3.42</generator><lastBuildDate>Fri, 09 Feb 2024 07:48:33 GMT</lastBuildDate><atom:link href="https://www.guidodiepen.nl/tag/qabstractitemmodel/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Viewing registry (keys only...) from within SynCE-KPM]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>After the previous post I started working on integrating the stand-alone prototype within SynCE-KPM. As mentioned, at the moment I only have a view on the keys, not yet the values. Furthermore, at the moment there is no error checking, switching a device will not work, and some other minor</p>]]></description><link>https://www.guidodiepen.nl/2009/09/viewing-registry-keys-only-from-within-synce-kpm/</link><guid isPermaLink="false">60310ee9085ea20001e01c5b</guid><category><![CDATA[editor]]></category><category><![CDATA[PyQT4]]></category><category><![CDATA[Python]]></category><category><![CDATA[QAbstractItemModel]]></category><category><![CDATA[remote registry]]></category><category><![CDATA[SynCE]]></category><category><![CDATA[SynCE-KPM]]></category><dc:creator><![CDATA[Guido Diepen]]></dc:creator><pubDate>Thu, 03 Sep 2009 06:09:14 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>After the previous post I started working on integrating the stand-alone prototype within SynCE-KPM. As mentioned, at the moment I only have a view on the keys, not yet the values. Furthermore, at the moment there is no error checking, switching a device will not work, and some other minor things <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_wink.gif" alt=";)"></p>
<p>However, as you can see from the screencast</p>
<p><object height="344" width="425"><param name="movie" value="http://www.youtube.com/v/xrRAiM-3IEE&hl=nl&fs=1&"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed allowfullscreen="true" allowscriptaccess="always" height="344" src="http://www.youtube.com/v/xrRAiM-3IEE&hl=nl&fs=1&" type="application/x-shockwave-flash" width="425"></object></p>
<p>it is already possible to view all the registry keys that are present in the registry. Also, from the screencast you can see the Fetching… node that is shown to the user whenever the actual data is being queried for the first time. It can also be clearly seen that the fetching is done in a separate thread, not related to the GUI thread, because even while fetching, the GUI still is responsive. Any further requests for fetching the user does, are just queued to the dataserver, which will retrieve them in the order they were requested.</p>
<p>I have already thought about how to incorporate the values and I have come up with a solution that uses the current registry and registry key objects, but with a different model. This means I will have to custom models, both subclasses of QAbstractItemModel, using the same underlying data, but only the parts they need.</p>
<p>One thhings I still need to do is determining what to do with updates (i.e. when to refetch keys, when being clicked on, or have the user explicitly request refetch). Also some GUI things need to be changed. At the moment it appears that the current window width of synce-kpm is not enough for a registry editor, might have to make the application a little bit wider. All in all, plenty of things to be done (and sooooo little time… <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_wink.gif" alt=";)"> )</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Towards remote registry editor within SynCE-KPM]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>The last couple of weeks I have been working on the basics for a remote registry under linux for windows mobile devices.</p>
<p>I would like to include this as a new feature within SynCE-KPM, and because this is written in PyQt4, the addition needed to be in PyQt4 also. This</p>]]></description><link>https://www.guidodiepen.nl/2009/09/towards-remote-registry-editor-within-synce-kpm/</link><guid isPermaLink="false">60310ee9085ea20001e01c5a</guid><category><![CDATA[PyQT4]]></category><category><![CDATA[QAbstractItemModel]]></category><category><![CDATA[qmodelindex]]></category><category><![CDATA[QTreeView]]></category><category><![CDATA[registry]]></category><category><![CDATA[SynCE-KPM]]></category><dc:creator><![CDATA[Guido Diepen]]></dc:creator><pubDate>Tue, 01 Sep 2009 18:08:28 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>The last couple of weeks I have been working on the basics for a remote registry under linux for windows mobile devices.</p>
<p>I would like to include this as a new feature within SynCE-KPM, and because this is written in PyQt4, the addition needed to be in PyQt4 also. This meant investigating the MVC concept within Qt4, with the QAbstractItemModel, QModelIndex, and QTreeView (at least for the hierarchical folder structure on the left part of the remote registry editor).</p>
<p>After lots and lots of fighting with the QAbstractItemModel and QModelIndex, I think I have finally understood howto succesfully use them together in order to show a nice treeview structure in the QTreeView widget.</p>
<p>One part that caused me a lot of headaches is what the exact role of the QModelIndex is and how exactly to use these. The problem is that you are not allowed to save them in some dictionary, because they are considered to be volatile. Eventually, with some reading of the Qt website I found out how, given a particular registry key within my own backend registry storage classes (that gets its data eventually from the device), I can create the correct QModelIndex that can be used by the model.</p>
<p>In the end the QModelIndex turned out to be not that difficult, because it basically is only a small holding object, that contains a reference to the actual underlying data that I can access via the internalPointer() method. Another way is to use the internalId() method, but that would require me to keep my own dictionary from internalId to the actual data objects. My first thought, that this QModelIndex needs to contain all information about parents etc, turned out to be false: the QModelIndex just queries the model again for parent information.</p>
<p>Most of the times, when looking back after lots and lots of investigating and frustration, the concept and howto actually use it turn out to be relatively simple <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_smile.gif" alt=":)"></p>
<p>The prototype I have at the moment is not yet integrated within SynCE-KPM, it is just a separate program at the moment. Furthermore, it does not show any of the values within the registry just yet, only the structure of the keys are shown via a tree within the QTreeView. I have made a small screencast which you can see below:<br>
<object data="http://www.youtube.com/v/a4w1BKmC63w&hl=nl&fs=1" height="344" type="application/x-shockwave-flash" width="425"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><param name="src" value="http://www.youtube.com/v/a4w1BKmC63w&hl=nl&fs=1"><param name="allowfullscreen" value="true"></object></p>
<p>For the moment you have to take my word that the data shown is actually taken realtime from the device and is not hardcoded in my program <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_smile.gif" alt=":)"> One thing that I still like to solve is the issue that can be seen towards the end of the video: clicking on HKEY_CLASSES_ROOT takes a really long time before anything is actually shown. My current idea to ‘solve’ this is to give all nodes by default one virtual child key with the name “Fetching…”</p>
<p>When the user expands a node, he will first see the “Fetching…” childkey being displayed. At the same time Synce-KPM will be retrieving the data from the device. After all sub-keys have been retrieved, they will be shown and the “Fetching…” childkey will then be removed.</p>
<p>I have tried implementing the above approach within the current prototype program, but this resulted in a lot of segmentation faults that I could not place. I am not sure what is causing this issue, but it appears that the segfaults are caused when I both delete the “Fetching…” childkey and add the actual childkeys all within the code that handles the the node-expand signal. My guess (well, hope <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_wink.gif" alt=";)"> ) is that in the final SynCE-KPM version this should not be a problem: because of the two separated processes (GUI and dataserver) I can ensure that I am only doing either deletion, or adding, but not both.</p>
<p>Still todo are:</p>
<ul>
<li>Include within SynCE-KPM (instead of separate program)</li>
<li>Create a listview for the values that are stored the selected key</li>
<li>Add possibility of not only viewing the registry, but also modifying <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_smile.gif" alt=":)"></li>
</ul>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Treeviews in PyQt with QAbstractItemModel]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>For the new feature of SynCE-KPM I am working on at the moment, I want to emulate the look and feel of the windows standard program regedit.exe. This means showing the user a QTreeView showing the hierarchy of the keys and a QListView on the right showing all values</p>]]></description><link>https://www.guidodiepen.nl/2009/08/treeviews-in-pyqt-with-qabstractitemmodel/</link><guid isPermaLink="false">60310ee9085ea20001e01c59</guid><category><![CDATA[MVC]]></category><category><![CDATA[PyQT4]]></category><category><![CDATA[QAbstractItemModel]]></category><category><![CDATA[QTreeView]]></category><category><![CDATA[SynCE]]></category><dc:creator><![CDATA[Guido Diepen]]></dc:creator><pubDate>Wed, 12 Aug 2009 20:26:30 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>For the new feature of SynCE-KPM I am working on at the moment, I want to emulate the look and feel of the windows standard program regedit.exe. This means showing the user a QTreeView showing the hierarchy of the keys and a QListView on the right showing all values within the selected key.</p>
<p>While the other day I have been working (and finished) on the librapi2 stuff, in particular the python bindings, to facilitate a registry editor, for some days I have been looking at this whole QTreeView stuff. I have to say that I really do appreciate the idea behind MVC, but I have to say that to use this in a nice way in PyQt is really difficult. After some days I am now at least able to create a nice QTreeView based on a model that represents the registry. Currently, everything is still hardcoded, but at least I can see a structure now (the QListView with values will come much later <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_smile.gif" alt=":)"> ).</p>
<p>Next step is to see if I can connect the model to the actual contents of the registry on the device in a dynamic way. The problem is that I need to fetch new data from the registry only when it is needed. One simple approach is to first read the complete registry into the model and then show this to the user. However, I don’t think users will like it if there is a 5 minute delay showing “Fetching data” when going to the registry editor before they can actually use the registry editor. This means I will have to fetch data in some asynchronous way. Fortunately, I already have some ideas about this. For some reason I think this fetching part is again the easy component….. Don’t want to think about all the mess that is involved to show this in a nice way to the end-user.</p>
<p>For the moment just happy that at least the very basics of the left-hand side of the future screen (i.e. the hierarchy of the keys) needed to display actual data are there. Onwards to new challenges with PyQt and its MVC <img src="https://www.guidodiepen.nl/wp-includes/images/smilies/icon_smile.gif" alt=":)"></p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>