<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.shadoware.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Shadoware.Org - Mot-clé - qt</title>
  <link>http://www.shadoware.org/</link>
  <atom:link href="http://www.shadoware.org/index.php/feed/tag/qt/rss2" rel="self" type="application/rss+xml"/>
  <description>Moi, mes idées, mes logiciels ...</description>
  <language>fr</language>
  <pubDate>Mon, 06 Feb 2012 15:38:11 +0100</pubDate>
  <copyright>Ulrich VANDENHEKKE</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>qGenConfig - Générateur de classe</title>
    <link>http://www.shadoware.org/post/qGenConfig</link>
    <guid isPermaLink="false">urn:md5:37881980260cf678a7f852e80558f4fd</guid>
    <pubDate>Sat, 06 Aug 2011 15:23:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>QGenconfig</category>
        <category>config</category><category>logiciel</category><category>qgenconfig</category><category>qt</category>    
    <description>    &lt;h2&gt;Présentation&lt;/h2&gt;


&lt;p&gt;Ce logiciel permet de générer des objets &lt;code&gt;Qt&lt;/code&gt; héritant de &lt;code&gt;QConfig&lt;/code&gt; à partir d'un fichier écrit au format XML.&lt;/p&gt;


&lt;p&gt;Lors de la sauvegarde de paramètres avec &lt;code&gt;Qt&lt;/code&gt;, il faut généralement écrire des choses ainsi&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSettings settings&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;MaBoite&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;MonLogiciel&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
settings.&lt;span style=&quot;color: #007788;&quot;&gt;beginGroup&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Ma fenêtre&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
settings.&lt;span style=&quot;color: #007788;&quot;&gt;setValue&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Taille&amp;quot;&lt;/span&gt;, win&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;size&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
settings.&lt;span style=&quot;color: #007788;&quot;&gt;setValue&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Pleine écran&amp;quot;&lt;/span&gt;, win&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;isFullScreen&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
settings.&lt;span style=&quot;color: #007788;&quot;&gt;endGroup&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Puis pour récupérer les mêmes paramètres, il faut écrire&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSettings settings&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;MaBoite&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;MonLogiciel&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
settings.&lt;span style=&quot;color: #007788;&quot;&gt;beginGroup&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Ma fenêtre&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
QSize size &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; settings.&lt;span style=&quot;color: #007788;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Taille&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;toSize&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;bool&lt;/span&gt; fullscreen &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; settings.&lt;span style=&quot;color: #007788;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Pleine écran&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;toBool&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
settings.&lt;span style=&quot;color: #007788;&quot;&gt;endGroup&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Si les valeurs doivent être récupérées dans toute l'application et qu'un jour l'un des paramètres change de nom, de type, ou de groupe, il ne sera pas possible d'être sûr que tous les endroits de l'application sont bien modifiés  lors de la compilation.&lt;/p&gt;


&lt;p&gt;C'est là qu'intervient &lt;code&gt;qGenConfig&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Le but est d'écrire un fichier XML représentant la configuration du logiciel et possédant une certaine structure (des groupes, et des valeurs). Le programme parcourt ensuite ce fichier et génère une classe permettant de lire et d'enregistrer la configuration à l'aide de &lt;code&gt;qGenConfig&lt;/code&gt;. Le contenu des données est alors stocké dans une structure C, et permet l'accès facile aux données de configuration. Si une donnée change de type, de nom, ou de groupe, le programme ne compilera plus.&lt;/p&gt;


&lt;h2&gt;Licence&lt;/h2&gt;


&lt;p&gt;La licence choisie est la  &lt;a href=&quot;http://www.gnu.org/copyleft/gpl.txt&quot; hreflang=&quot;en&quot;&gt;GNU GENERAL PUBLIC LICENSE&lt;/a&gt;.&lt;/p&gt;


&lt;h2&gt;Téléchargement&lt;/h2&gt;


&lt;p&gt;Il est possible de télécharger l'application sur le dépôt officiel à l'adresse&amp;nbsp;: &lt;a href=&quot;http://hg.shadoware.org/qgenconfig?pk_campaign=shadoware&quot;&gt;http://hg.shadoware.org/qgenconfig&lt;/a&gt;&lt;/p&gt;</description>
    
    
    
          <comments>http://www.shadoware.org/post/qGenConfig#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/qGenConfig#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/672</wfw:commentRss>
      </item>
    
  <item>
    <title>[C++/Qt] CMake et Qt</title>
    <link>http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt</link>
    <guid isPermaLink="false">urn:md5:da05e097d1a727105b6e5727b3bb6c22</guid>
    <pubDate>Sun, 26 Jun 2011 14:41:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>C++</category>
        <category>cmake</category><category>planet</category><category>qmake</category><category>qt</category>    
    <description>&lt;p&gt;Suite à un &lt;a href=&quot;http://www.shadoware.org/post/2008/01/21/42-qabstractitemmodel-qt&quot;&gt;billet&lt;/a&gt; datant de 2008, je reviens vers vous pour ajouter quelques précisions sur la compilation de programme &lt;a href=&quot;http://qt.nokia.com/&quot;&gt;Qt&lt;/a&gt; avec &lt;a href=&quot;http://www.cmake.org/&quot;&gt;CMake&lt;/a&gt;. En effet, pour mon programme &lt;a href=&quot;http://xinx.shadoware.org?piwik_campaign=Shadoware&amp;amp;piwik_keyword=Billet CMake et Qt&quot;&gt;XINX&lt;/a&gt;, j'ai modifié la chaîne de compilation actuelle utilisant &lt;em&gt;QMake&lt;/em&gt; par une chaîne de compilation &lt;em&gt;CMake&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;&lt;em&gt;CMake&lt;/em&gt; est un puissant générateur de &lt;code&gt;Makefile&lt;/code&gt;, il permet de remplacer les anciens (mais pas complètement révolus) &lt;a href=&quot;http://www.gnu.org/software/autoconf/&quot;&gt;autotools&lt;/a&gt;. &lt;em&gt;CMake&lt;/em&gt; ne remplace donc pas le programme &lt;code&gt;make&lt;/code&gt; mais vient se placer en amont.&lt;/p&gt;


&lt;p&gt;&lt;em&gt;CMake&lt;/em&gt; permet de compiler un programme à  différents endroits du dossier des sources, ce qui permet de garder le répertoire des sources &lt;em&gt;propre&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Nous allons considérer dans la suite le dossier &lt;code&gt;projet&lt;/code&gt; suivant&amp;nbsp;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;projet&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;    &lt;h3&gt;Compilation&lt;/h3&gt;


&lt;p&gt;Nous passerons sous silence la compilation d'un programme non &lt;em&gt;Qt&lt;/em&gt; qui peut être retrouvé dans la &lt;a href=&quot;http://www.cmake.org/cmake/help/cmake_tutorial.html&quot;&gt;documentation&lt;/a&gt; et nous nous limiterons aux explications liées aux programmes écrits en ''Qt' (qui peuvent également être retrouvés dans d'autres tutoriels sur Internet).&lt;/p&gt;


&lt;h4&gt;Package à utiliser&lt;/h4&gt;


&lt;p&gt;Pour utiliser &lt;em&gt;Qt4&lt;/em&gt; avec &lt;em&gt;CMake&lt;/em&gt;, il faut inclure le package &lt;code&gt;Qt4&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:project&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;project&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;lenomdemonprojet&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt; 
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:cmake_minimum_required&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;cmake_minimum_required&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;VERSION&lt;/span&gt; 2.8.0&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;find_package&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;Qt4 REQUIRED&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Définir les modules Qt à utiliser&amp;nbsp;:&lt;/h4&gt;


&lt;p&gt;Il est ensuite possible d'activer ou de désactiver les différents modules de &lt;em&gt;Qt&lt;/em&gt; à utiliser suivant le programme que vous écrivez&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_DONT_USE_QTCORE &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_DONT_USE_QTGUI &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QT3SUPPORT &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTASSISTANT &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QAXCONTAINER &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QAXSERVER &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTDESIGNER &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTMOTIF &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTMAIN &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTNETWORK &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTNSPLUGIN &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTOPENGL &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTSQL &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTXML &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTXMLPATTERNS &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTWEBKIT &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTSVG &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTTEST &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTUITOOLS &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTDBUS &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTSCRIPT &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTASSISTANTCLIENT &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTHELP &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_PHONON &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Par exemple pour faire un programme utilisant le module Xml, XmlPatterns, et Webkit il faut ajouter&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTXML &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTXMLPATTERNS &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;QT_USE_QTWEBKIT &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Quelques déclarations supplémentaires&lt;/h4&gt;


&lt;p&gt;Après avoir compilé les différentes parties du programme avec le générateur de &lt;code&gt;Makefile&lt;/code&gt; de &lt;em&gt;Qt&lt;/em&gt; (QMake), j'ai relevé les différentes définitions à ajouter lors de la compilation. De plus une fois les modules définis, il faut inclure également le module &lt;em&gt;UseQt4&lt;/em&gt;.&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DUNICODE&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# Les Q_ASSERT, Q_ASSERT_X, ... sont désactivés en mode Release&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:if&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;if&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;CMAKE_BUILD_TYPE &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;STREQUAL&lt;/span&gt; &lt;span style=&quot;color: #912f11;&quot;&gt;&amp;quot;Release&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
	&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DQT_NO_DEBUG&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endif&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endif&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;()&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# Include utilisé par Qt (du style include (UseQt4))&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:include&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;include&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #b08000;&quot;&gt;${QT_USE_FILE}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# Ajoute les définitions propres à Qt (suivant les modules ajoutés)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #b08000;&quot;&gt;${QT_DEFINITIONS}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Macros pour générer les fichiers &lt;code&gt;moc&lt;/code&gt;.&lt;/h4&gt;


&lt;h5&gt;Macro par défaut&lt;/h5&gt;


&lt;p&gt;La facilité de programmation en &lt;em&gt;Qt&lt;/em&gt; est due à l'ajout par le framework de la notion de méta-objet. Cette notion se fait à l'aide d'un générateur propre à ce framework&amp;nbsp;: &lt;code&gt;moc&lt;/code&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt#pnote-636-1&quot; id=&quot;rev-pnote-636-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Pour générer les méta-objets, il faut définir sur les objets descendants de &lt;code&gt;QObject&lt;/code&gt;, une macro &lt;code&gt;Q_OBJECT&lt;/code&gt;. Cette macro ajoute, côté interface, la déclaration de méthodes supplémentaires pour la gestion des méta-informations, et coté implémentation, ajoute l'implémentation de ces méta-informations ainsi que la déclaration des signaux et de slots de l'objet&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt#pnote-636-2&quot; id=&quot;rev-pnote-636-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Pour générer les fichiers d'implémentation générés par le compilateur &lt;code&gt;moc&lt;/code&gt;, il est possible d'utiliser la macro suivante pour une liste de fichier sources (extension .cpp, ou .cxx, ...)&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;qt4_wrap_cpp&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;outfiles inputfile ... OPTIONS ...&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Cette macro générera un fichier de type &lt;code&gt;moc_nomfichier.cxx&lt;/code&gt; qu'il faudra inclure dans le ficher CPP (car il n'est pas inclus automatiquement dans la liste des fichiers à compiler.&lt;/p&gt;
&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;quot;moc_nomfichier.cxx&amp;quot;&lt;/span&gt;&lt;/pre&gt;


&lt;h5&gt;Une autre macro&lt;/h5&gt;


&lt;p&gt;Autre possibilité, faire comme avec les fichiers &lt;code&gt;.pro&lt;/code&gt; de &lt;em&gt;QMake&lt;/em&gt; et générer un fichier moc pour chaque fichier &lt;code&gt;.h&lt;/code&gt; possédant une macro &lt;code&gt;Q_OBJECT&lt;/code&gt;. Pour cela j'ai écrit la petite macro suivante&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:macro&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;macro&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;xinx_automoc outfiles&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
  qt4_get_moc_flags&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;moc_flags&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
  qt4_extract_options&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;moc_files moc_options &lt;span style=&quot;color: #b08000;&quot;&gt;${ARGN}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&amp;nbsp;
  &lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:foreach&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;foreach&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;it &lt;span style=&quot;color: #b08000;&quot;&gt;${moc_files}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
    &lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:get_filename_component&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;get_filename_component&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;it &lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; ABSOLUTE&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&amp;nbsp;
    &lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:if&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;if&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;EXISTS&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; &lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
		&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:file&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;file&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;READ &lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; _contents&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&amp;nbsp;
		&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:string&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;string&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;REGEX&lt;/span&gt; &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;MATCHALL&lt;/span&gt; &lt;span style=&quot;color: #912f11;&quot;&gt;&amp;quot;Q_OBJECT&amp;quot;&lt;/span&gt; _match &lt;span style=&quot;color: #912f11;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #b08000;&quot;&gt;${_contents}&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
		&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:if&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;if&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;_match&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
			qt4_make_output_file&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; moc_ cxx outfile&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
			qt4_create_moc_command&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${outfile}&lt;/span&gt; &lt;span style=&quot;color: #912f11;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #b08000;&quot;&gt;${moc_flags}&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #912f11;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #b08000;&quot;&gt;${moc_options}&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
			macro_add_file_dependencies&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${outfile}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
			&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #b08000;&quot;&gt;${outfiles}&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${${outfiles}&lt;/span&gt;} &lt;span style=&quot;color: #b08000;&quot;&gt;${outfile}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
		&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endif&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endif&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;_match&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
    &lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endif&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endif&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt; &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;EXISTS&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${it}&lt;/span&gt; &lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
  &lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endforeach&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endforeach&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;it&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endmacro&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endmacro&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;xinx_automoc&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Elle s'utilise ainsi&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;xinx_automoc&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;moc_headers &lt;span style=&quot;color: #b08000;&quot;&gt;${headers}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Macro pour générer les fichiers en tête d'interface graphique.&lt;/h4&gt;


&lt;p&gt;Les interfaces graphiques sont développées à l'aide de &lt;em&gt;Qt-Designer&lt;/em&gt;. Ces fichiers sont au format XML.&lt;/p&gt;


&lt;p&gt;La macro CMake suivante permet de transformer ces fichiers XML en fichier d'entête C.&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;qt4_wrap_ui&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;outfiles inputfile ...&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Macro pour compiler les fichiers de resources&lt;/h4&gt;


&lt;p&gt;La macro CMake suivante permet de compiler le fichier de ressource (extension *.qrc) en fichier &lt;code&gt;cpp&lt;/code&gt; qui sera ensuite compilé avec le reste du programme&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;qt4_add_resources&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;outfiles inputfile ... OPTIONS ...&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Macro pour compiler les fichiers de traduction&lt;/h4&gt;


&lt;p&gt;La macro CMake suivante est utilisée pour compiler un fichier de traduction &lt;code&gt;ts&lt;/code&gt; en fichier de traduction compilé &lt;code&gt;qm&lt;/code&gt;. Ce dernier est ensuite à inclure dans le programme (soit par un fichier de ressource, soit dans un dossier à coté).&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;qt4_add_translation&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;qm_files ts_files ...&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Compilation d'un plugin&lt;/h4&gt;


&lt;p&gt;En plus des options décrites ci-dessus, pour compiler un plugin, il faut ajouter quelques définitions supplémentaires.&lt;/p&gt;


&lt;p&gt;Il faut bien faire attention à ce que le plugin soit compilé en mode &lt;code&gt;Release&lt;/code&gt; si le programme l'est aussi (Ce qui n'est pas forcément pratique pour faire du debug).&lt;/p&gt;


&lt;h5&gt;Plugin dynamique&lt;/h5&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DQT_PLUGIN&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DQT_SHARED&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_library&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;webplugin &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;SHARED&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${webplugin_SRCS}&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${webplugin_MOC_SRCS}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h5&gt;Plugin Static&lt;/h5&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DQT_PLUGIN&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DQT_STATICPLUGIN&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:if&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;if&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;CMAKE_SIZEOF_VOID_P &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;MATCHES&lt;/span&gt; 8&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
	&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-fPIC&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endif&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endif&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;()&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_library&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;webplugin &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;STATIC&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${webplugin_SRCS}&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${webplugin_MOC_SRCS}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Ajout d'un fichier RC pour windows&lt;/h4&gt;


&lt;p&gt;Les fichiers RC Windows contiennent des informations, comme par exemple, la version et le nom du programme.&lt;/p&gt;


&lt;p&gt;Ces informations peuvent être utilisées par les programmes d'installation sous Windows ou aussi par Windows lui-même.&lt;/p&gt;


&lt;p&gt;Afin de pouvoir ajouter un fichier RC file au programme, on peut ajouter ceci&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:if&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;if&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;MINGW&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
	&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;CMAKE_RC_COMPILER_INIT windres&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
	&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:enable_language&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;enable_language&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;RC&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
	&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;set&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;CMAKE_RC_COMPILE_OBJECT &lt;span style=&quot;color: #912f11;&quot;&gt;&amp;quot;&amp;lt;CMAKE_RC_COMPILER&amp;gt; &amp;lt;FLAGS&amp;gt; &amp;lt;DEFINES&amp;gt; -O coff -o &amp;lt;OBJECT&amp;gt; &amp;lt;SOURCE&amp;gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:endif&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;endif&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;MINGW&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Ensuite le fichier RC se compile comme tout autre fichier (&lt;code&gt;C++&lt;/code&gt;, ...)&lt;/p&gt;



&lt;h4&gt;Compilation d'une librairie static&lt;/h4&gt;

&lt;pre class=&quot;cmake cmake&quot; style=&quot;font-family:inherit&quot;&gt;&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_definitions&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_definitions&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;-DQT_SHARED&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;
&lt;a href=&quot;http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library&quot;&gt;&lt;span style=&quot;color: #1f3f81; font-style: bold;&quot;&gt;add_library&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;(&lt;/span&gt;xinxplugins &lt;span style=&quot;color: #077807; font-sytle: italic;&quot;&gt;STATIC&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${xinxplugins_SRCS}&lt;/span&gt; &lt;span style=&quot;color: #b08000;&quot;&gt;${xinxplugins_MOC_SRCS}&lt;/span&gt;&lt;span style=&quot;color: #197d8b;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;


&lt;h3&gt;Utiliser le programme CMake&lt;/h3&gt;


&lt;p&gt;Une fois le programme configuré, il est possible de compiler ce dernier à l'aide des commandes suivantes&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; build
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; build
&amp;nbsp;
cmake ..&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sources
&amp;nbsp;
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt;
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Sous Windows, il est possible de compiler en utilisant &lt;a href=&quot;http://www.mingw.org/&quot;&gt;MinGW&lt;/a&gt; pour compiler ou d'utiliser le compilateur de &lt;code&gt;Visual Studio&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Il est également possible de définir un emplacement pour l'installation différent du dossier par défaut&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;cmake -DCMAKE_INSTALL_PREFIX=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;home&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;login&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;/pre&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt#rev-pnote-636-1&quot; id=&quot;pnote-636-1&quot;&gt;1&lt;/a&gt;] C'est ce qui fait tout l'avantage de &lt;em&gt;Qt&lt;/em&gt; mais est aussi son inconvénient car il ajoute une couche supplémentaire. C'est ensuite une question de goût.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt#rev-pnote-636-2&quot; id=&quot;pnote-636-2&quot;&gt;2&lt;/a&gt;] facilitant la gestion des évènements dans &lt;em&gt;Qt&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/%5BQt%5D-CMake-et-Qt#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/636</wfw:commentRss>
      </item>
    
  <item>
    <title>XINX v0.10.1</title>
    <link>http://www.shadoware.org/post/XINX-v0.10.1</link>
    <guid isPermaLink="false">urn:md5:9724be160d0bd6ff2bd95468ae56238e</guid>
    <pubDate>Tue, 03 May 2011 18:46:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>XINX</category>
        <category>egx</category><category>generix</category><category>generix group</category><category>libre</category><category>logiciel</category><category>qt</category><category>xinx</category><category>xml</category><category>xsl</category>    
    <description>&lt;p&gt;Bonjour à tous,&lt;/p&gt;


&lt;p&gt;Je suis heureux de vous annoncer la nouvelle version de &lt;a href=&quot;http://xinx.shadoware.org?piwik_campaign=20110504_0.10.1_blog&quot; hreflang=&quot;fr&quot; title=&quot;Site internet de XINX&quot;&gt;XINX&lt;/a&gt;. Cette version apporte, en plus de la ré-écriture complète de la gestion du contenu et de la complétion, son petit lot de nouveautés et de corrections.&lt;/p&gt;


&lt;p&gt;La version &lt;em&gt;0.10.1&lt;/em&gt; est beaucoup plus stable que sa grande soeur &lt;em&gt;0.9&lt;/em&gt;. Un soin particulier a été apporté à la recherche des sources d'anomalie possible, ainsi que des fuites mémoires. Ces opérations ont été faites grâce à des outils tels que &lt;a href=&quot;http://valgrind.org/&quot; hreflang=&quot;en&quot;&gt;valgrind&lt;/a&gt;, mais aussi grâce aux béta-testeurs (Merci à eux).&lt;/p&gt;


&lt;p&gt;De plus l'utilisation des pointeurs intelligents de &lt;a href=&quot;http://qt.nokia.com/&quot; hreflang=&quot;en&quot; title=&quot;Nokia Qt&quot;&gt;Qt&lt;/a&gt; ont permis de passer plus de temps, sur la gestion des structures et moins de temps sur la gestion de la mémoire, sur des parties du code assez critiques (comme ContentView et CodeCompletion). Ils ont également permis un partage plus facile des structures entre les différents threads avec moins de contrôle de synchronisation.&lt;/p&gt;


&lt;h3&gt;Liens&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org?piwik_campaign=20110504_0.10.1_blog&quot; hreflang=&quot;fr&quot; title=&quot;Site Internet de XINX&quot;&gt;Site Internet de XINX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/wiki/Download?piwik_campaign=20110504_0.10.1_blog&quot; hreflang=&quot;fr&quot; title=&quot;Téléchargement de XINX&quot;&gt;Téléchargement de XINX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/newticket?piwik_campaign=20110504_0.10.1_blog&quot; hreflang=&quot;fr&quot; title=&quot;Reporter un ticket&quot;&gt;Faire une demande d'évolution ou reporter un bug&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;    &lt;h3&gt;Gestion Projet et Gestion des sessions&lt;/h3&gt;


&lt;h4&gt;Multi-projet&lt;/h4&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/projectDirectory10.png&quot; alt=&quot;Project Directory v0.10.1&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Project Directory v0.10.1, mai 2011&quot; /&gt;
&lt;strong&gt;XINX&lt;/strong&gt; est maintenant capable d'ouvrir plusieurs projets en même temps. Cela permet donc plusieurs choses&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Rechercher un fichier pouvant se trouver dans plusieurs projets différents (par exemple un projet trunk et un projet branche).&lt;/li&gt;
&lt;li&gt;Comparer des fichiers venant de plusieurs projets différents.&lt;/li&gt;
&lt;li&gt;Ne pas basculer d'un projet à l'autre en continu, lorsque l'on travaille sur plusieurs projets en même temps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A cause de cette gestion de plusieurs projets en même temps, toute la partie de gestion de projet de XINX a été ré-écrite (entre autre la partie concernant la session, que l'on verra ensuite).&lt;/p&gt;


&lt;p&gt;De plus à l'ouverture du projet, l'application recherche l'ensemble des fichiers présents sur le disque afin de permettre une recherche beaucoup plus rapide. Cela a néanmoins quelques répercussions&amp;nbsp;: il n'est pas possible de supprimer un dossier du projet sans fermer XINX.&lt;/p&gt;


&lt;h4&gt;Inclusion / Exclusion de chemin&lt;/h4&gt;


&lt;p&gt;Afin d'avoir une vue propre, XINX affiche déjà uniquement les fichiers qu'il est capable de gérer. Il est également possible de lui définir une liste de chemin qu'il doit ignorer.&lt;/p&gt;


&lt;p&gt;Exemple&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;WEB-INF/lib&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dico&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;configuration&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.projectpropertyIncludeExclude10_m.jpg&quot; alt=&quot;Project Property v0.10.1&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Project Property v0.10.1, mai 2011&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Il est possible d'utiliser des expressions régulières pour définir ces chemins.&lt;/p&gt;


&lt;p&gt;A l'inverse il est possible d'inclure un dossier externe au projet directement dans la vue de celui-ci. L'équivalent d'un lien symbolique mais propre au projet sous XINX. Il est alors possible d'inclure dans le dossier projet, un répertoire temporaire contenant les données utilisées par les feuilles de styles, ou inclure un dossier contenant des fichiers de logs, ...&lt;/p&gt;


&lt;h4&gt;Sessions&lt;/h4&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.welcomDialog10_s.jpg&quot; alt=&quot;Welcom Dialog v0.10.1&quot; style=&quot;float:left; margin: 0 1em 1em 0;&quot; title=&quot;Welcom Dialog v0.10.1, mai 2011&quot; /&gt;
Suite à la gestion du multi-projet, il a fallu ré-écrire le système de gestion des sessions. Il est maintenant plus proche des systèmes de session des autres applications.&lt;/p&gt;


&lt;p&gt;Alors que sur la version &lt;em&gt;0.9&lt;/em&gt; et précédente, la session était directement associée à un projet (et donc ouverte en même temps), maintenant la session est séparée de la notion de projet.&lt;/p&gt;


&lt;p&gt;Une session peut alors désormais contenir une liste de projet ouvert, une liste de fichier ouvert (associé ou non à un projet), des signets. Plusieurs sessions différentes peuvent pointer vers un même projet mais proposer une vue (un ensemble de fichier ouvert) différente. Une session par défaut est créée pour l'utilisation courante de l'application.&lt;/p&gt;


&lt;h3&gt;Modification du système de complétion&lt;/h3&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.Completion10_m.jpg&quot; alt=&quot;Code Completion v0.10.1&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Code Completion v0.10.1, mai 2011&quot; /&gt;
Le système de vue contenue et de code complétion a complètement été ré-écrit. La lecture des différents imports des différents fichiers est faite en mémoire (et non plus dans une base de donnée SQL) et en parallèle (s'il y a plusieurs processeurs sur la machine). La lecture des fichiers est ainsi plus rapide. Le système a complètement été ré-écrit pour que la complétion du code soit rapide et stable en même temps.&lt;/p&gt;


&lt;p&gt;La complétion du code affiche désormais les différentes lignes dans des catégories suivant leur emplacement (par exemple le fichier où se trouve chaque template), les snipets dans une catégorie différente...&lt;/p&gt;


&lt;p&gt;XINX est maintenant capable également de compléter&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;les paramètres des templates du type call-template&lt;/li&gt;
&lt;li&gt;les imports (proposition des différents fichiers, et des alias si le plugin Generix est activé)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;et plein d'autres choses &lt;img src=&quot;/dotclear/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Et plein d'autres nouveautés&lt;/h3&gt;

&lt;h4&gt;Utilisation de la librairie SVN directement&lt;/h4&gt;


&lt;p&gt;Un nouveau plugin pour SubVersion a été écrit. Ce plugin utilise directement les librairies de SubVersion au lieu d'utiliser l'exécutable svn. Ce plugin est plus performant que le wrapper et ne nécessite pas l'installation d'un client SubVersion (tel que &lt;a href=&quot;http://www.collab.net/downloads/subversion/&quot; hreflang=&quot;en&quot;&gt;CollabNet SubVersion&lt;/a&gt; sous Windows ou le client svn sous linux.&lt;/p&gt;


&lt;p&gt;L'ancien plugin est toujours disponible et utilisable.&lt;/p&gt;


&lt;h4&gt;Créer des tickets depuis XINX&lt;/h4&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.TicketCreation10_m.jpg&quot; alt=&quot;Create Ticket v0.10.1&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Create Ticket v0.10.1, mai 2011&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Une boite de dialogue permet maintenant de créer automatiquement un compte et un ticket sur le site Internet de XINX. Vous pouvez ainsi créer facilement des demandes d'évolution, des demandes de correction, ...
De plus lors de la sortie d'une nouvelle version, XINX vous informera automatiquement qu'une nouvelle version est disponible.&lt;/p&gt;


&lt;h4&gt;Dock des logs et des erreurs&lt;/h4&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.ErrorLog10_m.jpg&quot; alt=&quot;Error dock v0.10.1&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Error dock v0.10.1, mai 2011&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Le dock d'affichage des erreurs a été amélioré pour ne plus perturber l'utilisateur en s'ouvrant de façon intempestive. Il est maintenant possible de définir que le dock doit rester fermé, un compteur affiche alors le nombre d'erreur .&lt;/p&gt;


&lt;h4&gt;Modification de la recherche&lt;/h4&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.SearchDock10_m.jpg&quot; alt=&quot;Search Dock 10&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Search Dock 10, mai 2011&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Suite à la gestion du multi-projet, XINX peut maintenant rechercher dans plusieurs projets en même temps. Il est aussi possible d'arrêter la recherche en plein milieu.&lt;/p&gt;


&lt;h4&gt;Validation d'un fichier XML&lt;/h4&gt;


&lt;p&gt;XINX peut également valider un fichier XML à partir d'un schéma. Il ne peut malheureusement pas encore valider de fichier XSL (les parseurs XSL trouvés n'arrivent pas à lire les schémas des fichiers XSLT).&lt;/p&gt;


&lt;h4&gt;Correction de bugs&lt;/h4&gt;


&lt;p&gt;Beaucoup de corrections de bug ont été faites ce qui rend cette version très stable.&lt;/p&gt;


&lt;h3&gt;Et pour la suite&amp;nbsp;?&lt;/h3&gt;


&lt;p&gt;Dans la même série, j'ai l'intention de sortir une version avec de nouveaux modèles, de la documentation, ....&lt;/p&gt;


&lt;p&gt;Pour la version suivante, le moteur JavaScript sera amélioré pour ne plus donner d'erreur, voir proposer de la complétion plus performante.&lt;/p&gt;</description>
    
    
    
          <comments>http://www.shadoware.org/post/XINX-v0.10.1#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/XINX-v0.10.1#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/644</wfw:commentRss>
      </item>
    
  <item>
    <title>[C++/Qt] Performance de l'utilisation de QSharedPointer</title>
    <link>http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer</link>
    <guid isPermaLink="false">urn:md5:f477dcc0189d180d38c2a61076493790</guid>
    <pubDate>Tue, 25 Jan 2011 12:00:00 +0100</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Performances</category>
        <category>kde</category><category>nokia</category><category>performance</category><category>planet</category><category>qmake</category><category>qt</category><category>trolltech</category>    
    <description>&lt;h3&gt;Présentation&lt;/h3&gt;


&lt;p&gt;&lt;em&gt;Qt&lt;/em&gt; est un framework orienté objet écrit en C++ et permettant de faire des interfaces graphiques. Ce framework est utilisé par le projet &lt;em&gt;KDE&lt;/em&gt; depuis ses débuts pour en faire un environnement de bureau très complet.&lt;/p&gt;


&lt;p&gt;&lt;em&gt;Qt&lt;/em&gt; fournit un ensemble de pointeur &lt;em&gt;intelligent&lt;/em&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-1&quot; id=&quot;rev-pnote-628-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt; permettant de gérer plus facilement la mémoire. Le but est alors de ne plus avoir à supprimer des objets. La suppression se fera soit par un pointeur &lt;em&gt;intelligent&lt;/em&gt; soit par le système de hiérarchie d'objet existant en &lt;em&gt;Qt&lt;/em&gt; (l'objet père qui supprime l'ensemble des objets fils qui lui sont rattachés).&lt;/p&gt;


&lt;p&gt;&lt;em&gt;Qt&lt;/em&gt; propose l'ensemble des pointeurs &lt;em&gt;intelligents&lt;/em&gt; suivants:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://doc.qt.nokia.com/4.6/qshareddatapointer.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation Qt de QSharedDataPointer&quot;&gt;QSharedDataPointer&lt;/a&gt; / &lt;a href=&quot;http://doc.qt.nokia.com/4.6/qshareddata.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation Qt de QSharedData&quot;&gt;QSharedData&lt;/a&gt;&amp;nbsp;: ces deux classes utilisées ensemble permettent d'écrire un objet avec partage implicite. Cela signifie que l'objet fonctionnera comme la classe &lt;em&gt;QString&lt;/em&gt;. Tant que l'objet est copié, passé en paramètre, .... l'objet n'est pas dupliqué (tous les objets pointes vers le même espace mémoire). Au moment où l'objet est modifié, l'objet est dupliqué. C'est ce qu'on appelle le COW&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-2&quot; id=&quot;rev-pnote-628-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://doc.qt.nokia.com/4.6/qexplicitlyshareddatapointer.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation Qt de QExplictlySharedDataPointer&quot;&gt;QExplictlySharedDataPointer&lt;/a&gt; / &lt;a href=&quot;http://doc.qt.nokia.com/4.6/qshareddata.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation Qt de QSharedData&quot;&gt;QSharedData&lt;/a&gt;&amp;nbsp;: QExplicitlySharedDataPointer est une variante de QSharedDataPointer. Ce pointeur &lt;em&gt;intelligent&lt;/em&gt;, comme son nom l'indique, est détaché uniquement lorsque la méthode detach() est appelée explicitement. Cette classe permet de faire des objets qui fonctionnent comme des pointeurs mais qui sont utilisés sans la notion de pointeur (le *). La suppression des données partagées se fait donc quand tous les objets ne sont plus utilisés.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://doc.qt.nokia.com/4.6/qscopedpointer.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation Qt de QScopedPointer&quot;&gt;QScopedPointer&lt;/a&gt;&amp;nbsp;: Ce pointeur est le plus simple. Il permet de déclarer un pointeur sur le tas et s'occupe de la destruction de l'objet, lorsque le programme sort de la portée du bloc. Cela permet de ne plus se soucier de la libération du pointeur dans les cas d'erreur (exception, retour avant la fin de la fonction car le fichier n'a pu être ouvert, ...).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://doc.qt.nokia.com/4.6/qsharedpointer.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation Qt de QSharedPointer&quot;&gt;QSharedPointer&lt;/a&gt;&amp;nbsp;: Le pointeur dont on parlera dans la suite de ce billet. Il permet de partager non plus des données (comme le fait QSharedData) mais de partager un pointeur&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-3&quot; id=&quot;rev-pnote-628-3&quot;&gt;3&lt;/a&gt;]&lt;/sup&gt;. Nous allons voir dans la suite du billet, comment simplement utiliser ce pointeur, et les performances de ce pointeur par rapport à un pointeur standard.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Sommaire&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#utilisation_qsharedpointer&quot;&gt;Utilisation de QSharedPointer&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#a_quoi_sert_il&quot;&gt;A quoi sert-il ?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#comment_l_utiliser&quot;&gt;Comment l'utiliser ?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#comment_utiliser_this&quot;&gt;Comment utiliser this&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#comment_eviter_les_references_circulaires&quot;&gt;Comment éviter les références circulaires&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#utilisation_dans_les_applications_multi_thread&quot;&gt;Utilisation dans les applications multi-thread.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#utilisation_d_un_pool&quot;&gt;Utilisation d'un pool&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#benchmark&quot;&gt;Benchmark&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#code_source&quot;&gt;Code source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#le_jeu_de_test&quot;&gt;Le jeu de test&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#test_de_l_allocation&quot;&gt;Test de l'allocation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#test_de_modification_d_une_donnee&quot;&gt;Test de Modification d'une donnée&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#test_d_affectation&quot;&gt;Test d'affectation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#test_de_destruction&quot;&gt;Test de destruction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#resultat_du_test&quot;&gt;Résultat du test&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-1&quot; id=&quot;pnote-628-1&quot;&gt;1&lt;/a&gt;] en anglais : smart-pointer&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-2&quot; id=&quot;pnote-628-2&quot;&gt;2&lt;/a&gt;] COW = Copy On Write&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-3&quot; id=&quot;pnote-628-3&quot;&gt;3&lt;/a&gt;] Ce pointeur est l'équivalent du pointeur &lt;em&gt;intelligent&lt;/em&gt; &lt;a href=&quot;http://www.boost.org/doc/libs/1_45_0/libs/smart_ptr/shared_ptr.htm&quot; hreflang=&quot;en&quot;&gt;boost::shared_ptr&lt;/a&gt; du projet &lt;a href=&quot;http://www.boost.org/&quot; hreflang=&quot;en&quot;&gt;Boost&lt;/a&gt;. Boost est une librairie qui ajoute beaucoup de facilité pour les programmes en C++, comme par exemple les smart-pointer dont certains seront inclus dans C++0x, ou de la boucle &lt;code&gt;std::for_each&lt;/code&gt;.&lt;/p&gt;&lt;/div&gt;
    &lt;p&gt;&lt;a name=&quot;utilisation_qsharedpointer&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Utilisation de QSharedPointer&lt;/h3&gt;


&lt;p&gt;&lt;a name=&quot;a_quoi_sert_il&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;A quoi sert-il&amp;nbsp;?&lt;/h4&gt;


&lt;p&gt;L'objet &lt;code&gt;QSharedPointer&lt;/code&gt; fait partie des pointeurs &lt;em&gt;intelligents&lt;/em&gt;. Ces pointeurs permettent de gérer automatiquement la libération de la mémoire (plus besoin de faire &lt;code&gt;delete ptr;&lt;/code&gt; quand le pointeur n'est plus utilisé) tout en restant utilisable comme un pointeur normal.&lt;/p&gt;


&lt;p&gt;&lt;code&gt;QSharedPointer&lt;/code&gt; fonctionne par comptage de référence. Après la déclaration, à chaque affectation, on augmente le compteur de référence, lorsqu'on quitte la portée du bloc, on décrémente le compteur de référence. &lt;code&gt;QSharedPointer&lt;/code&gt; détruit donc automatiquement le pointeur quand il n'existe plus aucune référence vers ce pointeur. &lt;code&gt;QSharedPointer&lt;/code&gt; vient donc comme une encapsulation de notre pointeur.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qsharedpointer/QSharedPointer1.png&quot; alt=&quot;QSharedPointer1.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;QSharedPointer1.png, janv. 2011&quot; /&gt;&lt;/p&gt;


&lt;p&gt;&lt;a name=&quot;comment_l_utiliser&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Comment l'utiliser&amp;nbsp;?&lt;/h4&gt;


&lt;p&gt;La déclaration d'un pointeur en C, se fait en écrivant &lt;code&gt;MyObject*&lt;/code&gt;. La syntaxe en utilisant un QSharedPointer se fait en écrivant &lt;code&gt;QSharedPointer&amp;lt;MyObject&amp;gt;&lt;/code&gt;. Par la suite dans le programme, l'utilisation du pointeur &lt;code&gt;QSharedObject&lt;/code&gt; se fera de la même manière qu'un pointeur C. (Avec l'opérateur &lt;code&gt;-&amp;gt;&lt;/code&gt; pour appeler un membre, une méthode, ...) . Appelons dans la suite pointeur C, les pointeurs standards et &lt;code&gt;QSharedPointer&lt;/code&gt;, le pointeur intelligent.&lt;/p&gt;


&lt;p&gt;Afin d'éviter d'avoir un pointeur normal pouvant être supprimé à tout moment dans l'application, lors de l'utilisation de &lt;code&gt;QSharedPointer&lt;/code&gt;, il ne faut utiliser le pointeur C résultant du &lt;code&gt;new&lt;/code&gt; que pour la création du &lt;code&gt;QSharedPointer&lt;/code&gt;. On peut donc directement créer le &lt;code&gt;QSharedPointer&lt;/code&gt; en utilisant le constructeur &lt;code&gt;QSharedPointer ( T * ptr )&lt;/code&gt; qui prend en paramètre le pointeur C. C'est entre ces parenthèses que nous allons créer le pointeur C&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-1&quot; id=&quot;rev-pnote-628-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span style=&quot;color: #666666;&quot;&gt;// Création du pointeur intelligent à partir d'un pointeur normal.&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; MyObject&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #666666;&quot;&gt;// Utilisation du pointeur intelligent comme un pointeur normal.&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    ptr&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;setMembre&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;maValeur&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #666666;&quot;&gt;// Appel d'une méthode utilisant ce pointeur&lt;/span&gt;
  maMethode&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Lorsque l'on quitte le bloc, si le comptage de référence tombe à 0, on supprime le pointeur. A l'intérieur de &lt;code&gt;maMethode()&lt;/code&gt; le nombre de référence sera passé à 2. Si la méthode utilise le pointeur mais ne l'assigne nul part, le nombre de référence devrait être retombé à 1 et donc ici sera décrémenté à 0.&lt;/p&gt;


&lt;p&gt;Si par contre, &lt;code&gt;maMethode()&lt;/code&gt; fait des opérations d'assignation de &lt;code&gt;ptr&lt;/code&gt; et conserve une copie, le comptage ne tombera pas à 0 tant que l'objet restera utilisé (assigné) ailleurs.&lt;/p&gt;


&lt;p&gt;Regardons un exemple de &lt;code&gt;maMethode()&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; maMethode&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  ptr&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;setMembre2&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;maValeur&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Au début du bloc, ici le comptage de référence est à 2 et sera décrémenté à la sortie de la méthode. On peut modifier les membres de &lt;code&gt;ptr&lt;/code&gt;, et dans ce cas pas de changement du comptage de référence.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;this&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;monPtr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Au contraire, on peut également l'assigner à un autre objet. Dans ce cas le comptage de référence de cet objet passera à 3. A la sortie de la méthode il sera décrémenté et passera alors à 2. L'objet ne sera pas supprimé tant qu'on ne fera pas un &lt;code&gt;this-&amp;gt;monPtr.clear()&lt;/code&gt; ou que &lt;code&gt;this&lt;/code&gt; ne sera pas détruit.&lt;/p&gt;


&lt;p&gt;Si on veut garder une référence d'un pointeur mais qu'on ne souhaite pas que celle-ci incrémente le nombre de référence du &lt;code&gt;QSharedPointer&lt;/code&gt;, il est possible de créer un pointeur &lt;em&gt;faible&lt;/em&gt;. Ce pointeur passe par l'objet &lt;code&gt;QWeakPointer&lt;/code&gt;. Pour obtenir ce type de pointeur, il suffit de faire&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptrW &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptr&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;toWeakRef &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;code&gt;ptrW&lt;/code&gt; n'incrémente donc pas le comptage de référence, cela signifie donc que le pointeur peut être détruit même si un objet &lt;code&gt;QWeakPointer&lt;/code&gt; existe. Il sera alors possible de faire un &lt;code&gt;ptrW.isNull()&lt;/code&gt; pour savoir si le pointeur est toujours valide. Si l'utilisateur a également besoin d'avoir accès à un membre de l'objet, il pourra le transformer en &lt;code&gt;QSharedPointer&lt;/code&gt; avant de l'utiliser sauf si le pointeur est &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr2 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptrW&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;toStrongRef &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; 
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
   ptr&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;maMethodePtr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Il faut tester que &lt;code&gt;ptr2&lt;/code&gt; est encore valide, car tant que la transformation du pointeur &lt;em&gt;faible&lt;/em&gt; vers le &lt;code&gt;QSharedPointer&lt;/code&gt; n'a pas encore été fait, il est possible que le nombre de référence vers l'objet soit tombé à 0 et qu'il ait été supprimé.&lt;/p&gt;


&lt;p&gt;&lt;a name=&quot;comment_utiliser_this&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Comment utiliser &lt;code&gt;this&lt;/code&gt;&lt;/h4&gt;


&lt;p&gt;Un des points peu pratique de l'utilisation de &lt;code&gt;QSharedPointer&lt;/code&gt; est que le comptage de référence ne fonctionne pas si plusieurs &lt;code&gt;QSharedPointer&lt;/code&gt; pointent vers le même objet mais ont tous été créés à partir du pointeur C. Prenons par exemple, le cas suivant&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;MyObject &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; MyObject&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr1 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr2 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Le problème d'écrire ces lignes ainsi, et que pour  &lt;code&gt;ptr1&lt;/code&gt; comme pour &lt;code&gt;ptr2&lt;/code&gt;, l'objet n'est référencé qu'une fois. Ainsi le premier qui tombera à 0 détruira l'objet, alors que l'autre pourrait encore l'utiliser. Il faut donc écrire les choses comme suite&amp;nbsp;:&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qsharedpointer/QSharedPointer2.png&quot; alt=&quot;QSharedPointer2.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;QSharedPointer2.png, janv. 2011&quot; /&gt;&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr1 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; MyObject&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr2 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptr1&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Ainsi &lt;code&gt;ptr1&lt;/code&gt; et &lt;code&gt;ptr2&lt;/code&gt; ont bien chacun connaissance de l'existence de l'autre. Cela contraint donc à remplacer toutes les déclarations du type &lt;code&gt;MyObject*&lt;/code&gt; par &lt;code&gt;QSharedPointer&amp;lt;MyObject&amp;gt;&lt;/code&gt;. Ceci est donc à faire dans les paramètres des méthodes, dans les membres, dans la déclaration des variables locales, ... . On ne peut donc plus utiliser le pointeur C &lt;code&gt;MyObject*&lt;/code&gt; directement, mais seulement au travers de &lt;code&gt;QSharedPointer&lt;/code&gt; ou de &lt;code&gt;QWeakPointer&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Cela commence à poser problème lors de l'utilisation de &lt;code&gt;this&lt;/code&gt; dans un objet. Imaginons une méthode d'un objet mettant à jour des membres fils avec en paramètre le père. Nous aurions alors tendance à écrire ceci&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; Object2&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;setParent&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; parent&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
...
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
....
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; MyObject&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;setMember&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;Object2 &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  _membre &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    obj&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;setParent&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Ceci ne marchera pas car on créerait un nouvel objet &lt;code&gt;QSharedPointer&lt;/code&gt; commençant son comptage de référence à 1, alors que nous en avons déjà au moins un autre pointant vers notre instance&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-2&quot; id=&quot;rev-pnote-628-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;. &lt;code&gt;MyObject&lt;/code&gt; pourrait alors être détruit alors qu'il est encore utilisé par &lt;code&gt;Object2&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Pour éviter cela, il faut alors passer par un pointeur &lt;em&gt;intelligent&lt;/em&gt; &lt;code&gt;this&lt;/code&gt;. Pour cela nous allons utiliser deux choses&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Un membre nommé &lt;code&gt;_this&lt;/code&gt; de type pointeur &lt;em&gt;intelligent&lt;/em&gt; &lt;code&gt;QWeakPointer&lt;/code&gt;, contenant une référence à l'objet lui même. (Nous n'utilisons pas un QSharedPointer, pour éviter une référence circulaire, voir le paragraphe suivant).&lt;/li&gt;
&lt;li&gt;Une méthode statique utilisée pour la création (nous n'allons plus utiliser le constructeur, car à ce moment, il n'existe pas encore de QSharedPointer pointant vers notre objet).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Voici un exemple de comment écrire le constructeur maison&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; MyObject
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; create&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QString parametre&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; MyObject&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;parametre&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    ptr&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;_this &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptr.&lt;span style=&quot;color: #007788;&quot;&gt;toWeakRef&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  MyObject&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QString parametre&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    ...
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; _this&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Le constructeur devient alors privé (ou protégé si on a besoin de la notion d'héritage) afin d'obliger l'utilisateur de la classe à utiliser notre méthode de création. Dans notre nouvelle méthode de création &lt;code&gt;create&lt;/code&gt;, qui est une méthode statique, nous allons créer le pointeur et initialiser le &lt;code&gt;QWeakPointer&lt;/code&gt; de notre objet avec le pointeur &lt;em&gt;intelligent&lt;/em&gt; que nous venons de créer. Nous retournons un &lt;code&gt;QSharedPointer&lt;/code&gt;. La méthode &lt;code&gt;create&lt;/code&gt; devient alors notre nouveau constructeur, mais créant des instances d'objets de type &lt;code&gt;QSharedPointer&amp;lt;MyObject&amp;gt;&lt;/code&gt; et non plus des instances d'objet &lt;code&gt;MyObject*&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Notre méthode &lt;code&gt;setMember()&lt;/code&gt; peut alors être ré-écrite&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; MyObject&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;setMember&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;Object2 &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  _membre &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    obj&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;setParent&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;_this.&lt;span style=&quot;color: #007788;&quot;&gt;toStrongRef&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;&lt;a name=&quot;comment_eviter_les_references_circulaires&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Comment éviter les références circulaires&lt;/h4&gt;


&lt;p&gt;Le principe d'une référence circulaire est qu'un objet A référence l'objet B et l'objet B référence l'objet A.&lt;/p&gt;


&lt;p&gt;Voici par exemple, un cas de référence circulaire&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; A
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; create&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; A&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  ~A&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  A&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    b &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; B&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    b&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;setA&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;_this&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;B&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; b&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; _this&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; B
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;B&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; create&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; 
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;B&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; B&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; setA&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; b&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; getA&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;  a&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Cela peut-être aussi le cas, si par exemple une instance d'objet C référence des instances d'objets fils C, qui possèdent eux-même un pointeur vers l'objet C père.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; C
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; create&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; C&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    _this &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptr.&lt;span style=&quot;color: #007788;&quot;&gt;toWeakPtr&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  ~C&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; addChild&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; c&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    _childs.&lt;span style=&quot;color: #007788;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;c&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    c&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;setParent&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;_this&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; setParent&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; c&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; getParent&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  C&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
  QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; _this&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; _parent&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  QList&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;C&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; _childs&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Dans ces cas là, on a&amp;nbsp;:
- L'objet A possède la référence vers l'objet B
- L'objet B possède une référence vers l'objet A.
- Même principe avec l'objet C&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qsharedpointer/QSharedPointer3.png&quot; alt=&quot;QSharedPointer3.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;QSharedPointer3.png, janv. 2011&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Dans ce cas, il restera alors toujours une référence vers A, et une vers B, même si plus aucune variable ne référence ces objets. Cette référence circulaire fait que l'objet ne sera jamais détruit même si on n'a plus besoin de l'objet.&lt;/p&gt;


&lt;p&gt;Si on décide que l'objet A sera l'objet maitre (donc que sa destruction engendrera la destruction de l'objet B), on peut alors écrire les choses ainsi pour l'objet B&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; B
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;B&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; create&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; 
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;B&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; B&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; setA&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; b&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; getA&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
  QWeakPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;A&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;  a&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Dans ce cas, avec l'utilisation d'un &lt;code&gt;QWeakPointer&lt;/code&gt;, lorsque qu'il n'existera plus de référence vers l'objet A, le pointeur &lt;em&gt;faible&lt;/em&gt; &lt;code&gt;a&lt;/code&gt; sera mis à jour comme ne contenant plus de référence&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-3&quot; id=&quot;rev-pnote-628-3&quot;&gt;3&lt;/a&gt;]&lt;/sup&gt;. L'instance de l'objet A sera réellement détruite. Il n'y aura alors plus aucune référence vers l'objet B qui sera alors également détruit&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-4&quot; id=&quot;rev-pnote-628-4&quot;&gt;4&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;&lt;a name=&quot;utilisation_dans_les_applications_multi_thread&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Utilisation dans les applications multi-thread.&lt;/h4&gt;


&lt;p&gt;L'utilisation de &lt;code&gt;QSharedPointer&lt;/code&gt; simplifie l'écriture des applications multi-thread (les objets &lt;code&gt;QSharedPointer&lt;/code&gt; et &lt;code&gt;QWeakPointer&lt;/code&gt; sont thread-safe).&lt;/p&gt;


&lt;p&gt;Dans ces applications il n'y a alors plus besoin de se soucier si l'objet est en cours d'utilisation ailleurs dans l'application avant de le supprimer&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-5&quot; id=&quot;rev-pnote-628-5&quot;&gt;5&lt;/a&gt;]&lt;/sup&gt;. Lorsqu'un pointeur ne devient plus utilisé dans un thread donné, il ne sera détruit que s'il n'y a pas d'autres références dans d'autres threads de l'application&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-6&quot; id=&quot;rev-pnote-628-6&quot;&gt;6&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Avec l'utilisation de &lt;code&gt;QWeakPointer&lt;/code&gt;, un thread pourra tester l'existence du pointeur avant d'effectuer une opération et pourra aviser le cas échéant sans faire planter toute l'application&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-7&quot; id=&quot;rev-pnote-628-7&quot;&gt;7&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;&lt;a name=&quot;utilisation_d_un_pool&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Utilisation d'un pool&lt;/h4&gt;


&lt;p&gt;Si la création et la destruction d'un objet est coûteux, il est envisageable de diminuer le coût de destruction et de création d'un thread en utilisant un Pool d'objet. Dans ce cas l'objet &lt;a href=&quot;http://doc.qt.nokia.com/4.6/qqueue.html&quot; hreflang=&quot;en&quot; title=&quot;Documentation de QQueue&quot;&gt;QQueue&lt;/a&gt; pourra être utilisé pour représenter notre Pool.&lt;/p&gt;


&lt;p&gt;Lors de la demande de création, en utilisant notre méthode &lt;code&gt;create&lt;/code&gt; ci-dessus, on prend alors une valeur du pool (si disponible) et on la retourne sous forme d'un &lt;code&gt;QSharedPointer&lt;/code&gt;.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; MyObject&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  MyObject &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; c_ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;_queue.&lt;span style=&quot;color: #007788;&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
	c_ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; _queue.&lt;span style=&quot;color: #007788;&quot;&gt;dequeue&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt; 
	c_ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; MyObject&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;MyObject&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;c_ptr, ReturnToPool&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  ptr&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;_this &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; ptr.&lt;span style=&quot;color: #007788;&quot;&gt;toWeakRef&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Dans l'exemple ci-dessus&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-8&quot; id=&quot;rev-pnote-628-8&quot;&gt;8&lt;/a&gt;]&lt;/sup&gt;, on demande à la queue, qui doit être une variable globale ou statique, un élément, et si ce n'est pas possible, on crée un nouvel objet de type &lt;code&gt;MyObject&lt;/code&gt; (dont on suppose la création coûteuse).&lt;/p&gt;


&lt;p&gt;Lors de la création du &lt;code&gt;QSharedPointer&lt;/code&gt; on utilise alors le constructeur &lt;code&gt;QSharedPointer ( T * ptr, Deleter deleter )&lt;/code&gt; sur lequel on définit une méthode &lt;code&gt;Deleter&lt;/code&gt; nommée &lt;code&gt;ReturnToPool&lt;/code&gt; dont le but est de remettre les objets en pool.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; ReturnToPool&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;MyObject &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;_queue.&lt;span style=&quot;color: #007788;&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt; MAX_SIZE_QUEUE&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
	_queue.&lt;span style=&quot;color: #007788;&quot;&gt;enqueue&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #0000dd;&quot;&gt;delete&lt;/span&gt; obj&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Dans ce cas de retour au pool, si le pool est rempli, on détruit l'objet (pour éviter de consommer trop de mémoire), sinon on l'ajoute au pool. Dans ce cas, le pool est agrandi au fur et à mesure des besoins, jusqu'à une taille limite.&lt;/p&gt;


&lt;p&gt;Bien sûr il faut que la performance de l'utilisation d'un pool soit plus intéressante que celle de la création de l'objet et de son initialisation.&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;&lt;ins&gt;Attention&lt;/ins&gt;&amp;nbsp;: Ce point ne fonctionne, par contre, pas si l'objet (&lt;code&gt;MyObject&lt;/code&gt;) est un descendant de &lt;code&gt;QObject&lt;/code&gt;. En effet &lt;code&gt;QObject&lt;/code&gt; garde une référence du &lt;code&gt;QSharedPointer&lt;/code&gt; en mémoire et lors de la réutilisation du &lt;code&gt;QObject&lt;/code&gt; une erreur indique que l'objet n'a pas été détruit et est déjà utilisé par un &lt;code&gt;QSharedPointer&lt;/code&gt;. On n'a pas le problème avec &lt;code&gt;std::tr1::shared_ptr&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;&lt;a name=&quot;benchmark&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Benchmark&lt;/h3&gt;


&lt;p&gt;Le but du benchmark est de se faire une idée sur les performances d'une application utilisant des &lt;code&gt;QSharedPointer&lt;/code&gt; à la place des pointeurs normaux. Attention, ce bench ne prend pas en compte le besoin potentiel de Mutex, de comptage de référence manuel, ... dans les applications multi-thread qui pourrait être nécessaire pour ne pas supprimer le pointeur si besoin.&lt;/p&gt;


&lt;p&gt;Dans ce test nous allons tester également (en comparaison), le pointeur &lt;em&gt;intelligent&lt;/em&gt; du C++0x&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#pnote-628-9&quot; id=&quot;rev-pnote-628-9&quot;&gt;9&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Nous allons donc tester les opérations courantes de création, destruction, modification, affectation.&lt;/p&gt;


&lt;p&gt;&lt;a name=&quot;code_source&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Code source&lt;/h4&gt;


&lt;p&gt;Le code source est disponible, attaché au billet. Dans la suite du billet, seuls les morceaux intéressants du benchmark seront décris. Le benchmark utilise QTest. Nous avons créé un objet bidon &lt;code&gt;ObjetTest&lt;/code&gt; qui dans le constructeur allouera un pointeur et remplira une liste, et le destructeur supprime ce pointeur (et forcément la liste).&lt;/p&gt;


&lt;p&gt;Pour que chaque test soit indépendant, le jeu de test sera initialisé avant le début de chaque QBENCHMARK et détruit à la fin du bloc. Nous aurons quatre méthodes&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Allocation&lt;/li&gt;
&lt;li&gt;Modification&lt;/li&gt;
&lt;li&gt;Affectation&lt;/li&gt;
&lt;li&gt;Nettoyage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pour chaque test nous allons faire le test avec&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;un pointeur C standard&lt;/li&gt;
&lt;li&gt;le pointeur &lt;code&gt;QSharedPointer&lt;/code&gt; de &lt;em&gt;Qt&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;le pointeur &lt;code&gt;std::tr1::shared_ptr&lt;/code&gt; de &lt;em&gt;C++0x&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pour le test d'allocation et le test de nettoyage, nous allons également utiliser l'optimisation possible, vu ci-dessus, d'un Pool d'objet. Nous allons faire le test avec&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;le pointeur &lt;code&gt;QSharedPointer&lt;/code&gt; de &lt;em&gt;Qt&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;le pointeur &lt;code&gt;std::tr1::shared_ptr&lt;/code&gt; de &lt;em&gt;C++0x&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a name=&quot;le_jeu_de_test&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Le jeu de test&lt;/h4&gt;


&lt;p&gt;&lt;a name=&quot;test_de_l_allocation&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Test de l'allocation&lt;/h5&gt;


&lt;p&gt;La création du pointeur en utilisant &lt;code&gt;QSharedPointer&lt;/code&gt; instancie le pointeur ainsi que le &lt;code&gt;QSharedPointer&lt;/code&gt;. Le temps d'exécution est donc potentiellement deux fois plus long (voir le benchmark à la fin de ce billet).&lt;/p&gt;


&lt;p&gt;Pour la création du pool, nous allons utiliser une méthode qui créera le pointeur s'il n'est pas dans le pool, et sinon prendra le pointeur du pool. Dans notre cas de test, il y aura toujours une valeur dans le pool, que l'on aura rempli au préalable.&lt;/p&gt;


&lt;p&gt;La méthode &lt;code&gt;createFromPool()&lt;/code&gt; et &lt;code&gt;createFromBoostPool()&lt;/code&gt; est sensiblement identique&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; createFromPool&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        ObjetTest &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; c_ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;_queue.&lt;span style=&quot;color: #007788;&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
        &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
          c_ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; _queue.&lt;span style=&quot;color: #007788;&quot;&gt;dequeue&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
        &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt;
        &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
          c_ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; ObjetTest&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
        QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;c_ptr, returnToPool&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; ptr&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;C Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;ObjetTest&lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; ObjetTest&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Qt Smart Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; ObjetTest&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Qt Smart Pointer as Pool&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; createFromPool &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;C++0x Smart Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;tr1&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;shared_ptr&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;new&lt;/span&gt; ObjetTest&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;C++0x Smart Pointer as Pool&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;tr1&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;shared_ptr&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; ptr &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; createFromBoostPool &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;&lt;a name=&quot;test_de_modification_d_une_donnee&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Test de Modification d'une donnée&lt;/h5&gt;


&lt;p&gt;Pour la modification d'une donnée, on génère un nombre aléatoire que l'on va stocker (toujours le même pour chaque test, cela n'a pas d'importance). La génération du nombre aléatoire se fait en dehors du bloc, pour éviter de polluer le test avec le calcul d'un nombre aléatoire. Ici il n'y a pas création d'affectation du pointeur, juste une affectation d'une valeur dans le contenu du pointeur. La syntaxe pour le C, et pour le pointeur intelligent est identique.&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;C Pointer / Qt Smart Pointer / C++0x Smart Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;obj&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;value &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; random_number&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;&lt;a name=&quot;test_d_affectation&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Test d'affectation&lt;/h5&gt;


&lt;p&gt;Pour l'affectation nous allons créer une nouvelle variable qui pointera sur le même pointeur, et sur lequel on fera une modification. La création d'un pointeur peut arriver par exemple lors du passage du pointeur à une fonction, ou lors de la déclaration d'une variable devant contenir la même valeur. Cette déclaration supplémentaire a peu d'impact pour un pointeur C mais pour un pointeur &lt;em&gt;intelligent&lt;/em&gt; oblige la création d'un objet, et l'incrément d'un nombre d'instance (qu'on décrémente ici dans la même boucle).&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;C Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;ObjetTest &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt; obj2 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
obj2&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;value &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; random_number&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Qt Smart Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;QSharedPointer&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; obj2 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
obj2&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;value &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; random_number&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;C++0x Smart Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;std&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;tr1&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;shared_ptr&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;ObjetTest&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; obj2 &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; obj&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
obj2&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;value &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; random_number&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;&lt;a name=&quot;test_de_destruction&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Test de destruction&lt;/h5&gt;


&lt;p&gt;Pour ce test, nous allons initialiser une liste de pointeur, et pour le benchmark, nous allons supprimer un à un chaque élément de la liste.
La destruction du pointeur en C se fait par un &lt;code&gt;delete&lt;/code&gt;. Pour le pointeur ''intelligent', il n'y a pas de destruction explicite. Nous allons juste supprimer le pointeur de la liste, le pointeur sera alors automatiquement détruit car il n'y aura plus de référence vers ce pointeur.&lt;/p&gt;


&lt;p&gt;Pour le cas de test utilisant la notion du Pool, on aura créé le pointeur avec le delete &lt;code&gt;returnToPool()&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; returnToPool&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;ObjetTest &lt;span style=&quot;color: #000040;&quot;&gt;*&lt;/span&gt;obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
        _queue.&lt;span style=&quot;color: #007788;&quot;&gt;enqueue&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;obj&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Cette méthode ne fait pas de réelle destruction, mais juste un ajout de l'objet au pool.&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;C Pointer&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;delete&lt;/span&gt; c_ptr_list.&lt;span style=&quot;color: #007788;&quot;&gt;at&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
c_ptr_list.&lt;span style=&quot;color: #007788;&quot;&gt;removeFirst&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Qt Smart Pointer / Qt Smart Pointer as Pool / C++0x Smart Pointer / C++0x Smart Pointer as Pool &lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;smart_ptr_list.&lt;span style=&quot;color: #007788;&quot;&gt;removeFirst&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;&lt;a name=&quot;resultat_du_test&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;Résultat du test&lt;/h5&gt;


&lt;p&gt;Le test a été fait en utilisant la version 4.6.3 de Qt. Test effectué pour 5 000 000 itérations.&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th/&gt;&lt;th&gt;Pointeur C&lt;/th&gt;&lt;th&gt;Pointeur Qt&lt;/th&gt;&lt;th&gt;Pointeur C++0x&lt;/th&gt;&lt;th&gt;Pool en utilisant QSharedPointer&lt;/th&gt;&lt;th&gt;Pool en utilisant std::tr1::shared_ptr&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Allocation&lt;/th&gt;&lt;td&gt;0.0004275 msec&lt;/td&gt;&lt;td&gt;0.0007692 msec&lt;/td&gt;&lt;td&gt;0.0006604 msec&lt;/td&gt;&lt;td&gt;0.0002590 msec&lt;/td&gt;&lt;td&gt;0.0002286 msec&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Modification&lt;/th&gt;&lt;td&gt;0.000010 msec&lt;/td&gt;&lt;td&gt;0.000012 msec&lt;/td&gt;&lt;td&gt;0.000012 msec&lt;/td&gt;&lt;td colspan=&quot;2&quot; rowspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Affectation&lt;/th&gt;&lt;td&gt;0.000010 msec&lt;/td&gt;&lt;td&gt;0.0000386 msec&lt;/td&gt;&lt;td&gt;0.0000230 msec&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Destruction&lt;/th&gt;&lt;td&gt;0.000190 msec&lt;/td&gt;&lt;td&gt;0.0003161 msec&lt;/td&gt;&lt;td&gt;0.0003359 msec&lt;/td&gt;&lt;td&gt;0.0004003 msec&lt;/td&gt;&lt;td&gt;0.0003601 msec&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;Conclusion que l'on peut en tirer, le pointeur C est ce qu'il y a de plus rapide à partir du moment où on fait de l'allocation de l'affectation ou de la destruction. Par contre il n'apporte pas la souplesse qu'apporte les pointeurs &lt;em&gt;intelligents&lt;/em&gt; entre autre pour les applications multi-threadé.&lt;/p&gt;


&lt;p&gt;On remarque que le pointeur C++0x est plus rapide pour la création, mais apparemment plus lent en destruction. Il est également possible avec le pool de gagner en performance (surtout en création). Par contre le coût de destruction de l'objet n'est pas encore assez fort pour y gagner en utilisant le pool.&lt;/p&gt;


&lt;p&gt;Ensuite il est important de se faire son propre jugement selon ses besoins. Si besoin le source est attaché, vous pouvez faire vos propres tests.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-1&quot; id=&quot;pnote-628-1&quot;&gt;1&lt;/a&gt;] Si à un moment donné il faut utiliser le pointeur C pour une raison quelconque, on peut utiliser &lt;code&gt;ptr.data()&lt;/code&gt; mais il faut s'assurer que le pointeur ne sera pas détruit en déclarant un &lt;code&gt;QSharedPointer&lt;/code&gt; dans le même bloc utilisant le pointeur C. Le &lt;code&gt;QSharedPointer&lt;/code&gt; ne devra être détruit qu'après utilisation du pointeur C. Ceci peut être fait dans certain cas pour des raisons de performance.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-2&quot; id=&quot;pnote-628-2&quot;&gt;2&lt;/a&gt;] Sinon nous ne serions plus là pour lancer la méthode&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-3&quot; id=&quot;pnote-628-3&quot;&gt;3&lt;/a&gt;] Le &lt;code&gt;QWeakPointeur&lt;/code&gt; ne gardant pas d'instance d'objet, car il n'incrémente pas le compteur de référence&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-4&quot; id=&quot;pnote-628-4&quot;&gt;4&lt;/a&gt;] s'il n'existe pas de référence vers l'objet B ailleurs dans l'application&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-5&quot; id=&quot;pnote-628-5&quot;&gt;5&lt;/a&gt;] Attention quand même, &lt;code&gt;QSharedPointer&lt;/code&gt; protège le pointeur mais pas le contenu&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-6&quot; id=&quot;pnote-628-6&quot;&gt;6&lt;/a&gt;] d'autres threads pouvant inclure le thread principal&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-7&quot; id=&quot;pnote-628-7&quot;&gt;7&lt;/a&gt;] Si l'objet est supprimé, &lt;code&gt;QWeakPointer&lt;/code&gt;, sera alors remis à &lt;code&gt;null&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-8&quot; id=&quot;pnote-628-8&quot;&gt;8&lt;/a&gt;] Dans le code en question, il faudrait ajouter la notion de mutex autour de la gestion de la queue, en cas de création parallèle.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#rev-pnote-628-9&quot; id=&quot;pnote-628-9&quot;&gt;9&lt;/a&gt;] Le pointeur &lt;em&gt;intelligent&lt;/em&gt; &lt;code&gt;shared_ptr&lt;/code&gt; de C++0x à pour origine le pointeur Boost&lt;/p&gt;&lt;/div&gt;
</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/qsharedpointer/smart_benchmark.7z"
      length="1805" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2011/01/17/Performance-de-l-utilisation-de-QSharedPointer#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/628</wfw:commentRss>
      </item>
    
  <item>
    <title>[C++/Qt] Concaténation de chaînes de caractères</title>
    <link>http://www.shadoware.org/post/2010/12/21/%5BC/Qt%5D-Concat%C3%A9nation-de-chaine-de-caract%C3%A8re</link>
    <guid isPermaLink="false">urn:md5:5f35cced448e3f18b1997d657393c995</guid>
    <pubDate>Wed, 22 Dec 2010 13:03:00 +0100</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Performances</category>
        <category>libre</category><category>nokia</category><category>performance</category><category>planet</category><category>qstring</category><category>qt</category><category>trolltech</category>    
    <description>&lt;h3&gt;Présentation&lt;/h3&gt;


&lt;p&gt;Qt est un framework orienté objet écrit en C++ et permettant de faire des interfaces graphiques à l’aide de ces widgets. Ce framework est utilisé par le projet KDE depuis ses débuts pour en faire un environnement très complet.&lt;/p&gt;


&lt;p&gt;Qt permet donc de faire des interfaces graphiques mais aussi d’accéder à des bases de données SQL, de faire de la communication réseau, une gestion simplifiée des threads, la lecture de fichier XML. Qt intègre aussi le moteur HTML Webkit.&lt;/p&gt;


&lt;p&gt;Qt ajoute une couche supplémentaire au C++ permettant de faire de l’introspection de classe un peu plus poussée (comme l’appel d’une méthode dont on ne connaît le nom qu’à l’exécution). Qt permet également la gestion d’évènement par l’intermédiaire d’un système puissant de SIGNALS et de SLOTS.&lt;/p&gt;


&lt;p&gt;Dans la suite de cet article nous allons nous concentrer sur une très petite partie de Qt mais qui est utilisée dans beaucoup d’applications écrites en Qt&amp;nbsp;: les chaînes de caractères, et plus précisément, la concaténation de chaînes de caractères.&lt;/p&gt;    &lt;h2&gt;Concaténation de chaînes de caractères.&lt;/h2&gt;


&lt;p&gt;Comme dans d’autres langages, la concaténation de chaînes de caractères se fait à l'aide de l'opérateur &lt;code&gt;+&lt;/code&gt;. Prenons un exemple simple&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;QString&amp;gt;&lt;/span&gt;
&amp;nbsp;
QString abc &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;, def &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;def&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
QString result&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
result &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; abc &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; def&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;



&lt;p&gt;L'utilisation de l'opérateur &lt;code&gt;+&lt;/code&gt; facilite l'écriture de la concaténation des chaînes de caractères (tout comme l'opérateur &lt;code&gt;==&lt;/code&gt; permet de facilement comparer des chaînes de caractères de type QString).&lt;/p&gt;


&lt;p&gt;Malheureusement cette écriture rend le code peu performant pour diverses raisons (que l’on peut retrouver dans la documentation de l’objet QString).&lt;/p&gt;


&lt;h3&gt;Concaténation rapide de chaînes de caractères&lt;/h3&gt;


&lt;p&gt;A partir de Qt 4.6, Nokia, a ajouté un &lt;code&gt;template&lt;/code&gt; nommé QStringBuilder (cet objet fait beaucoup penser à l'objet StringBuilder de JAVA permettant d'accélérer les concaténations de chaînes de caractères).&lt;/p&gt;


&lt;p&gt;Ce template ne s’utilise pas directement mais au travers de l'opérateur &lt;code&gt;%&lt;/code&gt;. En remplaçant donc l'opérateur &lt;code&gt;+&lt;/code&gt; par &lt;code&gt;%&lt;/code&gt; on gagne en performance (dixit la doc de Qt).&lt;/p&gt;


&lt;p&gt;Pour pouvoir utiliser l'opérateur, il suffit d'inclure le fichier &lt;code&gt;QStringBuilder&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;QStringBuilder&amp;gt;&lt;/span&gt;
&amp;nbsp;
QString abc &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;, def &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;def&amp;quot;&lt;/span&gt;, ghi &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;ghi&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
QString result&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
result &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; abc &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; def &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; ghi&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Une autre possibilité est de définir (par exemple dans votre fichier .pro ou dans un include général de votre application)  les définitions &lt;code&gt;QT_USE_FAST_CONCATENATION&lt;/code&gt;,  et &lt;code&gt;QT_USE_FAST_OPERATOR_PLUS&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Ces définitions permettent de remplacer l'opérateur &lt;code&gt;+&lt;/code&gt; par l'opérateur &lt;code&gt;%&lt;/code&gt; dans toute l'application. Par contre cette opération peut demander quelques modifications de votre code.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #339900;&quot;&gt;#define QT_USE_FAST_CONCATENATION&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#define QT_USE_FAST_OPERATOR_PLUS&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;QString&amp;gt;&lt;/span&gt;
&amp;nbsp;
QString abc &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;abc&amp;quot;&lt;/span&gt;, def &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;def&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
QString result&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
result &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; abc &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; def&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;h3&gt;Benchmark&lt;/h3&gt;


&lt;p&gt;Nous allons donc dans la suite du document vérifier que l'opérateur &lt;code&gt;%&lt;/code&gt; est plus rapide que l'opérateur &lt;code&gt;+&lt;/code&gt;. Pour cela nous allons utiliser le module de benchmark de Qt.&lt;/p&gt;


&lt;h4&gt;Code source&lt;/h4&gt;


&lt;p&gt;Voici le petit programme permettant de tester la performance de la concaténation. Notre exemple simple va constituer à la concaténation de 26 chaînes de caractères créées au début. L'appel se fera une première fois en utilisant l'opérateur &lt;code&gt;+&lt;/code&gt; et une seconde fois en utilisant l'opérateur &lt;code&gt;%&lt;/code&gt;.&lt;/p&gt;

&lt;pre class=&quot;cpp cpp&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;QtCore/QString&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;QtTest/QtTest&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;lt;QStringBuilder&amp;gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;class&lt;/span&gt; TestPerf &lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt; QObject
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
    Q_OBJECT
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
    TestPerf&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;private&lt;/span&gt; Q_SLOTS&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; concat&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; concat_data&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
TestPerf&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;TestPerf&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; TestPerf&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;concat&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
	QFETCH&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;bool&lt;/span&gt;, useStringBuilder&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
	QString result&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	QString a&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;a&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, b&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;b&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, c&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;c&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, d&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;d&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, e&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;e&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, f&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, g&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;g&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, h&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;h&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, i&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;i&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, j&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;j&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, k&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;k&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, l&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, m&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;m&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, n&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;n&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, o&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;o&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, p&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;p&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, q&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;q&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, r&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;r&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, s&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;s&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, t&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;t&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, u&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;u&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, v&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;v&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, w&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;w&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, x&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;x&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, y&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;y&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;, z&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;z&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;useStringBuilder&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
		QBENCHMARK
		&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #666666;&quot;&gt;// Concaténation en utilisant QStringBuilder&lt;/span&gt;
			&lt;span style=&quot;color: #666666;&quot;&gt;// Dans ce cas la concaténation devrait être plus rapide&lt;/span&gt;
			result &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; a &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; b &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; c &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; d &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; e &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; f &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; g &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; h &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; i &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; j &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; k &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; l &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; m &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; n &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; o &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; p &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; q &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; r &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; s &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; t &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; u &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; v &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; w &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; x &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; y &lt;span style=&quot;color: #000040;&quot;&gt;%&lt;/span&gt; z&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt;
	&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
		QBENCHMARK
		&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #666666;&quot;&gt;// Concaténation en n'utilisant pas QStringBuilder. On utilise alors la concaténation normal de chaînes de caractères en utilisant&lt;/span&gt;
			&lt;span style=&quot;color: #666666;&quot;&gt;// QString&lt;/span&gt;
			result &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; a &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; b &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; c &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; d &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; e &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; f &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; g &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; h &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; i &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; j &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; k &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; l &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; m &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; n &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; o &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; p &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; q &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; r &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; s &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; t &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; u &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; v &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; w &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; x &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; y &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; z&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #0000ff;&quot;&gt;void&lt;/span&gt; TestPerf&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;concat_data&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#123;&lt;/span&gt;
	QTest&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;addColumn&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;useStringBuilder&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
	QTest&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;newRow&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Don't use QStringBuilder&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
	QTest&lt;span style=&quot;color: #008080;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #007788;&quot;&gt;newRow&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&amp;quot;Use QStringBuilder&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
QTEST_APPLESS_MAIN&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#40;&lt;/span&gt;TestPerf&lt;span style=&quot;color: #008000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #339900;&quot;&gt;#include &amp;quot;tst_testperf.moc&amp;quot;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Résultat du test&lt;/h4&gt;


&lt;p&gt;Le test a été fait en utilisant la version 4.6.3 de Qt. Le résultat est sensiblement le même avec la version 4.7.0&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Sans QStringBuilder&lt;/th&gt;&lt;td&gt;0.00367 msec&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Avec QStringBuilder&lt;/th&gt;&lt;td&gt;0.00046 msec&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;On voit dans ce test que la version en utilisant QStringBuilder est 8 fois plus rapide que sans. Bien sûr vu le temps que prend la concaténation de chaînes de caractères, ce test commence à avoir de l'intérêt uniquement à partir du moment où on fait beaucoup de concaténation dans la seconde, ou si les temps de réponses sont critiques.&lt;/p&gt;


&lt;p&gt;Sur ce, je vous souhaite à tous un Joyeux noël et une bonne année.&lt;/p&gt;</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/concat/test-perfconcat.7z"
      length="862" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2010/12/21/%5BC/Qt%5D-Concat%C3%A9nation-de-chaine-de-caract%C3%A8re#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2010/12/21/%5BC/Qt%5D-Concat%C3%A9nation-de-chaine-de-caract%C3%A8re#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/626</wfw:commentRss>
      </item>
    
  <item>
    <title>Calcul de la distance entre deux fichiers</title>
    <link>http://www.shadoware.org/post/2010/06/06/Calcul-de-la-Distance</link>
    <guid isPermaLink="false">urn:md5:a8e01d8f9c4c3ba53558afe790f6d995</guid>
    <pubDate>Sun, 06 Jun 2010 11:40:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>C++</category>
        <category>cartographie</category><category>compression</category><category>distance</category><category>libre</category><category>planet</category><category>qt</category>    
    <description>&lt;h3&gt;Présentation&lt;/h3&gt;


&lt;p&gt;Suite à un &lt;a href=&quot;http://linuxfr.org/forums/20/28366.html&quot; hreflang=&quot;fr&quot;&gt;billet sur LinuxFR&lt;/a&gt;, où je demandais comment calculer la distance (ou le pourcentage de similitude entre deux logiciels), j'ai obtenu la formule suivante&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;
distance = 1 - ( C(A) + C(B) - C(AB) ) / Max(C(A), C(B))
&lt;/pre&gt;


&lt;p&gt;où C(X) est la taille du fichier X compressé&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2010/06/06/Calcul-de-la-Distance#pnote-625-1&quot; id=&quot;rev-pnote-625-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Après avoir testé les formats &lt;code&gt;gzip&lt;/code&gt;, &lt;code&gt;bzip2&lt;/code&gt; et &lt;code&gt;lzma&lt;/code&gt;, j'ai conclu que le format de compression le plus performant pour le calcul, est le format &lt;code&gt;lzma&lt;/code&gt;, car le dictionnaire avec &lt;em&gt;la mise en commun&lt;/em&gt; était le plus gros, et donc le calcul de distance est plus efficace.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2010/06/06/Calcul-de-la-Distance#rev-pnote-625-1&quot; id=&quot;pnote-625-1&quot;&gt;1&lt;/a&gt;] On peut retrouver l'explication de cette formule &lt;a href=&quot;http://interstices.info/jcms/c_21828/classer-musiques-langues-images-textes-et-genomes&quot; hreflang=&quot;fr&quot;&gt;ici&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
    &lt;h3&gt;Le programme&lt;/h3&gt;


&lt;p&gt;J'ai donc décidé d'écrire un programme parcourant un dossier (avec plusieurs milliers de fichiers) et de calculer pour toutes les combinaisons des fichiers la distance entre chaque fichier. Ce programme consommant énormément de mémoire, il se peut que pour un grand nombre de fichier, le programme se plante avec une erreur d'allocation de mémoire.&lt;/p&gt;


&lt;p&gt;Ce programme permet de pouvoir faire une cartographie de ces fichiers et ainsi de pouvoir les classer. Testé sur des fichiers textes (sources de logiciels), le programme est assez efficace.&lt;/p&gt;


&lt;p&gt;Testé sur des images, ou des vidéos, les fichiers sont considérés comme tous éloignés les uns des autres, même s'ils sont identiques à  compression différente près, ou s'ils sont identiques à un mouvement près sur la photo (du genre une photo où une même personne se tient dans une position différente).&lt;/p&gt;


&lt;p&gt;Si vous avez une idée sur comment calculer la distance entre deux fichiers déjà compressés (avec perte qui plus est), ca m'intéresse. &lt;img src=&quot;/dotclear/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Comme l'exécution est très lente (compression lzma niveau 9), le programme peut être arrêté et redémarré.&lt;/p&gt;


&lt;p&gt;Pour démarrer le programme, il faut exécuter la commande&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;calcul_distance &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;mon&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dossier&lt;/pre&gt;


&lt;p&gt;Le programme va alors créer un fichier &lt;code&gt;{5ac1fd3c-504f-4110-9f7e-d6fc89e57bdb}.db&lt;/code&gt; où &lt;code&gt;{5ac1fd3c-504f-4110-9f7e-d6fc89e57bdb}&lt;/code&gt; est différent à chaque nouveau lancement.&lt;/p&gt;


&lt;p&gt;Pour reprendre le traitement où il était, il suffit alors de lancer&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;calcul_distance &lt;span style=&quot;color: #660033;&quot;&gt;--uuid&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;5ac1fd3c-504f-&lt;span style=&quot;color: #000000;&quot;&gt;4110&lt;/span&gt;-9f7e-d6fc89e57bdb&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Si on veut ajouter un dossier au traitement après coup&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;calcul_distance &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nouveau&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dossier &lt;span style=&quot;color: #660033;&quot;&gt;--uuid&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;5ac1fd3c-504f-&lt;span style=&quot;color: #000000;&quot;&gt;4110&lt;/span&gt;-9f7e-d6fc89e57bdb&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;h3&gt;Exemple&lt;/h3&gt;


&lt;p&gt;Par exemple soit les différentes versions d'un logiciel, mis dans des archives &lt;code&gt;tar&lt;/code&gt;. Pour ne prendre que le code source des versions, on va supprimer tous les fichiers suivants de l'archive &lt;code&gt;tar&lt;/code&gt;&amp;nbsp;: &lt;code&gt;*.jpg, *.png, *.ico, *.qm, *.db&lt;/code&gt;, ... les sources externes à l'application. On ne garde donc que les fichiers textes dont nous avons la possession.&lt;/p&gt;


&lt;p&gt;Après le nettoyage des dossiers&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;$ &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; i &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;in&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ls&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;`&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;do&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/*&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;$i&lt;/span&gt;.tar
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;done&lt;/span&gt;
$ &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ls&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-l&lt;/span&gt;
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;,5M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.10.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix 440K  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.4.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix 530K  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.5.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix 610K  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.6.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix 690K  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.7.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;,2M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.8.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;,3M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.6.9.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;,9M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.7.0.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt;,2M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.7.1.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;,3M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.7.2.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;,3M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.8.0.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;,1M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.8.1_services.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;,1M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.8.1.tar
&lt;span style=&quot;color: #660033;&quot;&gt;-rw-r--r--&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; phoenix phoenix &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt;,8M  &lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt; juin  &lt;span style=&quot;color: #000000;&quot;&gt;13&lt;/span&gt;:&lt;span style=&quot;color: #000000;&quot;&gt;24&lt;/span&gt; v0.9.0.tar
$ &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; ..
$ calcul_distance .&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
Step &lt;span style=&quot;color: #000000;&quot;&gt;0&lt;/span&gt; : Create database
Step &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; : Create &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;file&lt;/span&gt; list
Step &lt;span style=&quot;color: #000000;&quot;&gt;2&lt;/span&gt; : Compress single &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;file&lt;/span&gt;                                     
Step &lt;span style=&quot;color: #000000;&quot;&gt;3&lt;/span&gt; : Compress pair &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;file&lt;/span&gt;                                       
$ &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ls&lt;/span&gt; 
&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;051b93a0-d9a9-&lt;span style=&quot;color: #000000;&quot;&gt;4778&lt;/span&gt;-ac73-81ee01a3905d&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;.db
xinx
$ sqlite3 &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;051b93a0-d9a9-&lt;span style=&quot;color: #000000;&quot;&gt;4778&lt;/span&gt;-ac73-81ee01a3905d&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;.db&lt;/pre&gt;


&lt;p&gt;Nous allons maintenant faire une requête dans la base de données sqlite&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;sql sql&quot; style=&quot;font-family:inherit&quot;&gt;$ &lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLES&lt;/span&gt;
distances  files 
$ &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; files1&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;path&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; files2&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;path&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; distances&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;distance &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; distances&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; files files1&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; files files2 &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; distances&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;id1&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;files1&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AND&lt;/span&gt; distances&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;id2&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt;files2&lt;span style=&quot;color: #66cc66;&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BY&lt;/span&gt; distance &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ASC&lt;/span&gt;;&lt;/pre&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Version 1&lt;/th&gt;&lt;th&gt;Version 2&lt;/th&gt;&lt;th&gt;Distance&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.0350740694634633&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;0.132275346477201&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.142321125298336&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.161719318637048&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;0.196933113059686&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;0.231812199675573&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;0.266593999923953&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.27412838729727&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.312111739912996&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;0.351347925829225&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;0.364115163581424&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.386971922637303&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.401055941017259&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.436705836223058&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.465121645779551&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;0.468472350726879&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.516795574578859&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.51733623689019&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.544376861655528&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;0.558824765667689&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.560609480175814&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;0.594036969567445&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.604226316444666&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.613613062086946&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;0.622950487834501&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.631060763867616&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.632444883185258&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;0.637234847328374&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;0.6494052372746&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.666200571812458&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.678423568871868&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;0.692250570944195&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.701063946130892&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;0.701698986545754&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.717262408423359&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.720311680104721&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;0.738013305804084&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;0.747495551539097&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.747929200720491&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.748031544518325&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.758510349354368&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.767204482779187&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;0.772451857549627&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.796649043913944&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.801221496333008&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.804765901655414&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.819917045496318&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.823540395867048&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.831055117394626&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;0.838850951377793&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.849001032539087&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.853848016623182&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.860291356912217&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.86075956509228&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;0.863340151908353&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.872265541006983&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.873275579233521&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;0.875332023895544&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.87987037883801&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.879941907871053&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.881174812987336&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.886172606121206&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.889515283880001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;0.892364892140999&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.894375709613201&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.10&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.895694726039398&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.898582911617307&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.7.1&lt;/td&gt;&lt;td&gt;0.902038058337369&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.904821831317442&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.910637046476578&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.7.0&lt;/td&gt;&lt;td&gt;0.918347943544789&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.919716704855963&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.9&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.921714099772221&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.924717744438112&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.8&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.925849165227404&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.7.2&lt;/td&gt;&lt;td&gt;0.928888262611658&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.933685479216414&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.933940067594635&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.939898268404416&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.940789807767177&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.94210246370087&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.946464528845253&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.8.0&lt;/td&gt;&lt;td&gt;0.948830071149278&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.94922082772201&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.951278461132112&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.8.1&lt;/td&gt;&lt;td&gt;0.955572468114482&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.8.1_services&lt;/td&gt;&lt;td&gt;0.95567206186826&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.7&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.96084453455483&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.6&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.964619158469125&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.5&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.965955795849916&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;v0.6.4&lt;/td&gt;&lt;td&gt;v0.9.0&lt;/td&gt;&lt;td&gt;0.968866861905835&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;On peut ainsi voir d'après ce tableau, les versions ayant peu de différences et celles qui ont fait des plus gros bonds en avant.&lt;/p&gt;


&lt;p&gt;On voit ainsi qu'il y a plus de différences entre la version 0.8.0 et la 0.9.0, qu'il y en a eu entre la version 0.6.8 et la 0.6.9.
On peut également voir que les versions 0.6.4 et 0.9.0 n'ont plus rien à voir entre elles.&lt;/p&gt;


&lt;p&gt;Vous pouvez télécharger le logiciel attaché à ce billet.&lt;/p&gt;</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/calcul_distance/calcul_distance.7z"
      length="437666" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2010/06/06/Calcul-de-la-Distance#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2010/06/06/Calcul-de-la-Distance#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/625</wfw:commentRss>
      </item>
    
  <item>
    <title>Présentation de XINX</title>
    <link>http://www.shadoware.org/post/2010/01/13/Presentation_XINX</link>
    <guid isPermaLink="false">urn:md5:0edc55e4ed72a6a0c0e21f3ac74a2c19</guid>
    <pubDate>Sun, 02 May 2010 21:55:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>XINX</category>
        <category>debian</category><category>egx</category><category>generix</category><category>generix group</category><category>libre</category><category>planet</category><category>qt</category><category>stylesheet</category><category>xinx</category><category>xsl</category>    
    <description>&lt;p&gt;Ce billet fait suite à la sortie de la version 0.9.0 de &lt;strong&gt;XINX&lt;/strong&gt; et va vous décrire ce logiciel. &lt;strong&gt;XINX&lt;/strong&gt; est éditeur de feuille de style &lt;em&gt;XSL&lt;/em&gt; (il fait également éditeur &lt;em&gt;JavaScript&lt;/em&gt; et &lt;em&gt;CSS&lt;/em&gt; mais actuellement moins bien que ce que peuvent faire d'autres).&lt;/p&gt;


&lt;p&gt;Il permet l'édition des feuilles de styles en proposant de compléter sur le nom des balises (normal), sur les attributs (normal), sur les valeurs d'attributs&amp;nbsp;: les variables, les paramètres, ... Il propose également automatiquement les différents paramètres lors de l'utilisation d'un &lt;code&gt;call:template&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;L'éditeur est fortement tourné vers l'édition de feuille de style &lt;em&gt;XSL&lt;/em&gt; pour génération d&lt;em&gt;'HTML&lt;/em&gt; mais peut être utilisé pour générer du &lt;em&gt;XML&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/splash.png&quot; alt=&quot;XINX Logo&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;XINX Logo, mai 2010&quot; /&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;    &lt;h3&gt;Historique&lt;/h3&gt;


&lt;p&gt;Depuis un certain temps déjà (5 ans), je travaille pour la société &lt;em&gt;Generix Group&lt;/em&gt; éditant et intégrant un ERP&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2010/01/13/Presentation_XINX#pnote-624-1&quot; id=&quot;rev-pnote-624-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt; du nom de &lt;em&gt;GCE&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Sur la partie Web de cet ERP, il est possible d'intervenir à plusieurs endroits pour modifier son fonctionnement&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Le paramétrage (&lt;em&gt;BDD&lt;/em&gt;)&amp;nbsp;: Modification d'un paramètre pour agir sur le comportement du logiciel&lt;/li&gt;
&lt;li&gt;La couche métier (&lt;em&gt;JAVA&lt;/em&gt;)&amp;nbsp;: Lit le paramétrage (&lt;em&gt;BDD&lt;/em&gt;) et réalise les traitements. Il est possible de développer de nouveaux objets, mais aussi de dériver ceux existants.&lt;/li&gt;
&lt;li&gt;La couche de présentation (&lt;em&gt;XSL&lt;/em&gt;)&amp;nbsp;: A l'aide d'un flux de présentation généré par la couche métier et d'un fichier de configuration, présente les données à l'écran.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;La dernière couche est donc l'interprétation d'un flux de donnée, générée à partir de la couche métier (JAVA), à l'aide de feuille de style XSL.&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; sert à modifier la couche de présentation (&lt;em&gt;XSL&lt;/em&gt;). Sur cette dernière couche, on crée et modifie des feuilles de styles pour modifier la présentation des données à l'écran (Déplacer des champs, supprimer des champs, ajouter des champs, règle de gestion simple ...).&lt;/p&gt;


&lt;p&gt;En mode &lt;em&gt;projet&lt;/em&gt;, chez les clients, les modifications ne sont pas faites directement sur les feuilles de styles standard livrées, mais sur des feuilles de styles dérivées, afin de faciliter les migrations, et la correction des anomalies.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/structure_dossier.png&quot; alt=&quot;Structure dossier &amp;lt;= 140&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Structure dossier &amp;lt;= 140, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Lors de la modification de feuille de style &lt;em&gt;standard&lt;/em&gt;, il faut alors renommer et placer ce fichier dans un dossier séparé. C'est de cette tâche récurrente qu'est venue la création de l'éditeur de feuille de style &lt;strong&gt;XINX&lt;/strong&gt;.&lt;/p&gt;


&lt;p&gt;Le but était alors, lors de la sauvegarde d'un fichier standard, de proposer automatiquement la sauvegarde dans le bon dossier.&lt;/p&gt;


&lt;p&gt;L'autre point à l'origine de la création de &lt;strong&gt;XINX&lt;/strong&gt; est la non-existence d'un logiciel de développement de feuille de style &lt;em&gt;XSL&lt;/em&gt; gratuit et/ou libre (Il y a bien &lt;em&gt;XML Spy&lt;/em&gt; qui correspondait à peu prés mais qui était payant, et dont nous n'avions pas la licence).&lt;/p&gt;


&lt;p&gt;Sont alors venu s'ajouter d'autres fonctionnalités&amp;nbsp;: la complétion sur les balises, les attributs, les variables, .... &lt;img src=&quot;/dotclear/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Qu'est que XINX aujourd'hui&amp;nbsp;?&lt;/h3&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; prévu initialement comme aide au développement des consultants qui font des développements de feuille de style, est maintenant un éditeur de feuille de style &lt;em&gt;XSL&lt;/em&gt; avec gestion des plugins. L'un des plugins contient des petites fonctionnalités utiles au quotidien par les consultants travaillants sur l'ERP, fonctionnalité auparavant implémenté directement dans le logiciel.&lt;/p&gt;


&lt;p&gt;Dit autrement, cette nouvelle version marque donc une étape&amp;nbsp;: La partie de &lt;strong&gt;XINX&lt;/strong&gt; propre à &lt;em&gt;Generix Group&lt;/em&gt; à été séparée dans un plugin. &lt;strong&gt;XINX&lt;/strong&gt; en lui même n'est alors plus qu'un éditeur de feuille de style, extensible via des plugins, mais il retrouve les mêmes fonctionnalités grâce à ce plugin.&lt;/p&gt;


&lt;h3&gt;Licence&lt;/h3&gt;


&lt;p&gt;&lt;img src=&quot;http://www.gnu.org/graphics/gplv3-127x51.png&quot; alt=&quot;&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; /&gt;&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; est un logiciel libre dont la licence choisie est la GPLv3. Ce qui signifie que vous pouvez&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;télécharger le logiciel&lt;/li&gt;
&lt;li&gt;utiliser le logiciel pour faire ce que vous voulez&lt;/li&gt;
&lt;li&gt;télécharger les sources du logiciels&lt;/li&gt;
&lt;li&gt;modifier les sources du logiciels&lt;/li&gt;
&lt;li&gt;utiliser le logiciel modifié par vos soins&lt;/li&gt;
&lt;li&gt;distribuer le logiciel ou la version modifiée (attention à différencier les parties originales du logiciel avec le bon copyright, et les parties modifiées).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;En tant que logiciel libre &lt;strong&gt;XINX&lt;/strong&gt; possède une plateforme de contribution (ticket, wiki, source, ...) qui se trouve à l'adresse &lt;a href=&quot;http://xinx.shadoware.org&quot; hreflang=&quot;fr&quot;&gt;http://xinx.shadoware.org&lt;/a&gt;. Vous pouvez donc y aller pour contribuer.&lt;/p&gt;


&lt;p&gt;Vous pouvez contribuer de plusieurs façons&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Développement d'un Plugin&lt;/li&gt;
&lt;li&gt;Développement d'un script &lt;em&gt;ECMAScript&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Développement d'un petit patch&lt;/li&gt;
&lt;li&gt;Développement d'un gros patch&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Technologie&lt;/h3&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; est un logiciel développé en &lt;em&gt;Qt&lt;/em&gt;. Il compile et tourne sous &lt;em&gt;Gnu/Debian&lt;/em&gt; (normalement n'importe quelle distribution devrait faire l'affaire, mais &lt;em&gt;Gnu/Debian&lt;/em&gt; est la seule distribution testée), et sous &lt;em&gt;MS/Windows&lt;/em&gt;. Il devrait normalement également tourner sous &lt;em&gt;MacOS&lt;/em&gt; (si les dépendances comme les librairies &lt;em&gt;libxml2&lt;/em&gt; et &lt;em&gt;libxslt&lt;/em&gt; sont compilables sous cet OS).&lt;/p&gt;


&lt;p&gt;A chaque version un paquet &lt;em&gt;Gnu/Debian&lt;/em&gt; est mis à disposition sur le dépôt (&lt;code&gt;apt.shadoware.org&lt;/code&gt;) et un binaire &lt;em&gt;MS/Windows&lt;/em&gt; est proposé en téléchargement. &lt;strong&gt;XINX&lt;/strong&gt; est toujours compilable à partir des sources pour les autres distributions ou juste parce que vous préférez ainsi. :D&lt;/p&gt;


&lt;h3&gt;Intégration continue &amp;amp; Tests&lt;/h3&gt;


&lt;p&gt;A chaque &lt;em&gt;validation&lt;/em&gt; sur le référenciel &lt;em&gt;SubVersion&lt;/em&gt;, l'application est compilée et testée (vous pouvez voir le résultat des tests à l'adresse &lt;a href=&quot;http://xinx.shadoware.org/build&quot; hreflang=&quot;fr&quot;&gt;suivante&lt;/a&gt;. A la sortie de la version 0.9.0, les tests couvrent 27% de la librairie principale. Je dois donc encore écrire d'autres jeux de tests.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/.bitten_m.jpg&quot; alt=&quot;Intégration continue&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Intégration continue, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Code réutilisable pour d'autres projets&lt;/h3&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; peut également être intéressant pour d'autres développeurs &lt;em&gt;Qt&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;En effet, vous pouvez trouver dans la dernière version, ainsi que dans les versions précédentes plusieurs classes utilitaires.
Par exemple (liste presque non exhaustive)&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/doxygen/devel/html/classTreeProxyItemModel.html&quot; hreflang=&quot;en&quot;&gt;TreeProxyItemModel&lt;/a&gt;&amp;nbsp;: convertit un modèle format table en modèle format arbre. Utile lorsque l'arbre est représenté dans une base de donnée relationnelle par exemple.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/doxygen/devel/html/classRecursiveSortFilterProxyModel.html&quot; hreflang=&quot;en&quot;&gt;RecursiveSortFilterProxyModel&lt;/a&gt;&amp;nbsp;: Utilisé pour rechercher facilement des données dans un arbre et permet d'afficher les enfants.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/doxygen/devel/html/classXinxLineEdit.html&quot; hreflang=&quot;en&quot;&gt;XinxLineEdit&lt;/a&gt;&amp;nbsp;: Inspiré de KDE, affiche un bouton pour effacer le texte dans la ligne d'édition&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/doxygen/devel/html/classXinxListWidgetImpl.html&quot; hreflang=&quot;en&quot;&gt;XinxListWidgetImpl&lt;/a&gt;&amp;nbsp;: Permet de modifier une liste de valeur (ajout, suppression, valeur par défaut, classement, ...)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/doxygen/devel/html/classPluginSelector.html&quot; hreflang=&quot;en&quot;&gt;PluginSelector&lt;/a&gt;&amp;nbsp;: Inspiré de KDE, permet d'afficher une liste des plugins, avec un bouton &lt;em&gt;A propos de ...&lt;/em&gt; et un bouton &lt;em&gt;Configurer ...&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/doxygen/devel/html/classQMenuView.html&quot; hreflang=&quot;en&quot;&gt;QMenuView&lt;/a&gt;&amp;nbsp;: Inspiré d'un exemple de Qt et permet d'afficher un menu à partir d'un modèle.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Fonctionnalités&lt;/h3&gt;


&lt;h4&gt;Recherche parmi les fichiers d'un dossier&lt;/h4&gt;


&lt;p&gt;Un dock sur le coté permet en mode projet de rechercher et d'ouvrir un fichier parmi une multitude de fichier d'un projet (utile pour les fichiers avec beaucoup de feuille de style).&lt;/p&gt;


&lt;p&gt;La recherche peut se faire avec des Jockers (*)&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/dockprojet.png&quot; alt=&quot;Dock projet&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Dock projet, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;h4&gt;La complétion XSL&lt;/h4&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/.completion_s.jpg&quot; alt=&quot;Completion&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Completion, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; permet  de compléter sur les feuilles de styles à plusieurs niveaux&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2010/01/13/Presentation_XINX#pnote-624-2&quot; id=&quot;rev-pnote-624-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;&amp;nbsp;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;la balise (fonctionnalité standard vous allez me dire)&amp;nbsp;: &lt;strong&gt;XINX&lt;/strong&gt; permet de compléter sur les balises xsl:, les balises html ...&lt;/li&gt;
&lt;li&gt;les attributs (encore standard). Pour chaque balise, &lt;strong&gt;XINX&lt;/strong&gt; est capable de compléter sur les attributs de la balise saisie.&lt;/li&gt;
&lt;li&gt;les valeurs d'attribut (là c'est intéressant). Permet de compléter sur les variables déclarées dans le fichier &lt;em&gt;XSL&lt;/em&gt;, ainsi que dans les fichiers importés (pour retrouver les fichiers importés, &lt;strong&gt;XINX&lt;/strong&gt;, utilise le mode projet et les paramètres qui y sont définits). De plus sur les attributs non &lt;em&gt;XSL&lt;/em&gt;, &lt;strong&gt;XINX&lt;/strong&gt; ajoute automatiquement les accolades &lt;code&gt;{  }&lt;/code&gt; et les &lt;code&gt;$&lt;/code&gt; pour les variables et les paramètres.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;De plus lors de l'utilisation de la balise call:template, &lt;strong&gt;XINX&lt;/strong&gt; va chercher automatiquement les paramètres (&lt;code&gt;xsl:param&lt;/code&gt;) du template donné, et les ajoute automatiquement en &lt;code&gt;xsl:with-param&lt;/code&gt;.
Pour les balises &lt;code&gt;xsl:apply-templates&lt;/code&gt; &lt;strong&gt;XINX&lt;/strong&gt; propose la liste des modes des templates existants.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/completion2.png&quot; alt=&quot;Completion 2&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Completion 2, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;h4&gt;Le parsing de la feuille de style&lt;/h4&gt;


&lt;p&gt;Fonctionnalité du moment, si vous indiquez un flux de données et une feuille de style, &lt;strong&gt;XINX&lt;/strong&gt; est capable d'afficher le résultat (la source &lt;em&gt;HTML&lt;/em&gt; et le résultat dans un navigateur Webkit)&lt;/p&gt;


&lt;p&gt;Si l'emplacement où doivent s'exécuter les pages est définit alors, les feuilles de styles, les images, ... pourront être affichées.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/.representation_html_m.jpg&quot; alt=&quot;Représentation HTML&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Représentation HTML, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;A venir&lt;/h3&gt;


&lt;p&gt;Bien que l'avenir du logiciel dépend de ces utilisateurs, voici les nouvelles fonctionnalités que devrait apporter la prochaine version&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Déverminage de feuille de style XSL&lt;/li&gt;
&lt;li&gt;Amélioration du parseur JavaScript et CSS&lt;/li&gt;
&lt;li&gt;Quelques réécritures (Vue projet, ...)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Le plugin GCE&lt;/h3&gt;


&lt;p&gt;Comme indiqué ci-dessous, il existe un plugin &lt;em&gt;GCE&lt;/em&gt; utilisé par les consultants travaillants sur l'ERP &lt;em&gt;GCE&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Ce plugin permet de dupliquer une feuille de style d'un dossier à un autre (sans modification des fichiers standards), de lire les dictionnaires de libellé de l'ERP GCE, la lecture du fichier de configuration du lecteur &lt;em&gt;GCE&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/0.9.0/.derivation_m.jpg&quot; alt=&quot;Dérivation de feuille de style&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Dérivation de feuille de style, mai 2010&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Téléchargement&lt;/h3&gt;


&lt;p&gt;Vous pouvez télécharger &lt;strong&gt;XINX&lt;/strong&gt; à l'adresse &lt;a href=&quot;http://xinx.shadoware.org/downloads&quot; hreflang=&quot;fr&quot;&gt;http://xinx.shadoware.org/downloads&lt;/a&gt; (source et version Windows).&lt;/p&gt;


&lt;p&gt;Si vous voulez installer &lt;strong&gt;XINX&lt;/strong&gt; sur une Gnu/Debian (32 ou 64 bits) vous pouvez inclure le dépôt suivant&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;
# Shadoware.Org
deb http://apt.shadoware.org/ squeeze main
&lt;/pre&gt;


&lt;p&gt;Et installé de la façon suivante&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;aptitude&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; xinx&lt;/pre&gt;


&lt;p&gt;Vous pouvez vous tenir au courant des sorties de version grâce à la &lt;a href=&quot;http://lists.shadoware.org/listinfo/xinx&quot; hreflang=&quot;fr&quot;&gt;mailing list&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2010/01/13/Presentation_XINX#rev-pnote-624-1&quot; id=&quot;pnote-624-1&quot;&gt;1&lt;/a&gt;] Un ERP et un logiciel de gestion d'entreprise. Un ERP permet de gérer, par exemple, les produits, les clients, les fournisseurs, les stocks, les ventes, les achats, la logistique, la comptabilité, .... Je ne vais pas vous faire une présentation des ERPs, car même si cela pourrait faire un billet intéressant, ce n'est pas le but ici.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2010/01/13/Presentation_XINX#rev-pnote-624-2&quot; id=&quot;pnote-624-2&quot;&gt;2&lt;/a&gt;] Merci à &lt;a href=&quot;http://qcodeedit.edyuk.org/&quot; hreflang=&quot;en&quot;&gt;QCodeEdit&lt;/a&gt; qui me fournit quelques fonctionnalités utiles.&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2010/01/13/Presentation_XINX#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2010/01/13/Presentation_XINX#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/624</wfw:commentRss>
      </item>
    
  <item>
    <title>[Qt] Transformation d'une vue tableau en une vue hiérarchique</title>
    <link>http://www.shadoware.org/post/2009/09/10/%5BQt%5D-Transformation-d-une-vue-tableau-en-une-vue-hi%C3%A9rarchique</link>
    <guid isPermaLink="false">urn:md5:a2b92942f5d31facf73b6df365c09893</guid>
    <pubDate>Mon, 21 Sep 2009 13:50:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>C++</category>
        <category>article</category><category>libre</category><category>model</category><category>nokia</category><category>planet</category><category>qt</category><category>trolltech</category>    
    <description>&lt;p&gt;Pour visualiser des données internes à l'écran, Nokia/Qt nous propose l'architecture MVC à l'aide des classes QAbstractItemModel et de ses sous classes (QAbstractListModel, QAbstractTableModel, ...). Le but de l'architecture MVC est de séparer la représentation mémoire des données, de l'affichage qu'elles auront.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/table2tree/mvc1.png&quot; alt=&quot;mvc1.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;mvc1.png, sept. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Si les données sont par exemple issue d'une requête SQL, le modèle QSqlQueryModel permet de représenter la sélection SQL, à l'écran dans un composant QTableView. Ces données sont alors représentées sous forme d'un tableau deux dimensions.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/table2tree/tableau.png&quot; alt=&quot;tableau.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;tableau.png, sept. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Si l'on veut représenter les dossiers de l'ordinateur, le modèle QDirView permet d'afficher les données de façon hiérarchique.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/table2tree/qdirview.png&quot; alt=&quot;qdirview.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;qdirview.png, sept. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Il est également possible d'écrire nos propres modèles pour représenter nos propres données.&lt;/p&gt;


&lt;p&gt;Le but de cet article est de présenter l'écriture d'un modèle, transformant une vue plane (tableau deux dimensions) en vue hiérarchique. Pour cela nous allons prendre l'exemple de l'affichage d'une liste de catégorie&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/09/10/%5BQt%5D-Transformation-d-une-vue-tableau-en-une-vue-hi%C3%A9rarchique#pnote-623-1&quot; id=&quot;rev-pnote-623-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/09/10/%5BQt%5D-Transformation-d-une-vue-tableau-en-une-vue-hi%C3%A9rarchique#rev-pnote-623-1&quot; id=&quot;pnote-623-1&quot;&gt;1&lt;/a&gt;] La construction de notre objet s'est basé sur l'analyse de l'objet QSortFilterProxyModel de Nokia.&lt;/p&gt;&lt;/div&gt;
    &lt;h3&gt;Présentation de l'exemple&lt;/h3&gt;


&lt;p&gt;Nous allons voir ci-dessous comment transformer une vue plane en une vue hiérarchique. Pour cela nous allons prendre l'exemple d'une liste de catégorie. Ces catégories seront stockées dans une base de données Sqlite. Ceci n'a pas d'importance mais permet d'expliquer pourquoi les données en mémoire ne sont pas déjà sous forme hiérarchique.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/table2tree/proxymodel.png&quot; alt=&quot;proxymodel.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;proxymodel.png, sept. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;La description d'une catégorie passe donc par&amp;nbsp;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;un identifiant unique appelé &lt;em&gt;id&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;un nom de catégorie&lt;/li&gt;
&lt;li&gt;un lien vers la catégorie parente appelé &lt;em&gt;parent_id&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;C'est le champ &lt;em&gt;parent_id&lt;/em&gt; qui permettra de déterminer dans quelle catégorie notre sous-catégorie se trouve. Dans notre cas, &lt;em&gt;test3&lt;/em&gt; a comme &lt;em&gt;parent_id&lt;/em&gt; l'identifiant 11 qui est la catégorie &lt;em&gt;test&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Dans notre exemple, nous allons nous conditionner à un modèle en lecture seul. Il est également possible de faire un modèle en lecture/écriture mais nous n'en parlerons pas dans cet article. Nous nous cantonnerons donc à un modèle lecture seul sur un modèle source de type &lt;em&gt;QSqlTableView&lt;/em&gt;. (Un modèle en lecture/écriture peut nécessiter de mettre à jour notre structure, ce qui peut être assez compliqué, par exemple en cas de changement de la catégorie parente).&lt;/p&gt;


&lt;h3&gt;Déclaration d'un modèle&lt;/h3&gt;


&lt;h4&gt;Qu'est qu'un proxy&amp;nbsp;?&lt;/h4&gt;


&lt;p&gt;Notre interface se basera sur la classe &lt;em&gt;QAbstractProxyModel&lt;/em&gt;. Le but de cette classe est de permettre de faire une transposition entre un premier modèle et une vue. Elle peut par exemple (à l'aide de &lt;em&gt;QSortFilterProxyModel&lt;/em&gt;) permettre de filtrer ou trier les données d'une vue.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/table2tree/mvc.png&quot; alt=&quot;mvc.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;mvc.png, sept. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Cette vue nous permettra de faire la transposition entre un modèle tableau et une vue arborescente.&lt;/p&gt;


&lt;h4&gt;Interface du proxy&lt;/h4&gt;


&lt;p&gt;Les méthodes à ré-implémenter pour faire fonctionner une proxy, sont les suivantes&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;virtual QModelIndex index&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; row&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; column&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; parent &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
virtual QModelIndex parent&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; index &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
virtual &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; rowCount&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; parent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
virtual &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; columnCount&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; parent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
virtual QModelIndex mapFromSource &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; sourceIndex &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
virtual QModelIndex mapToSource &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; proxyIndex &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Les quatre premières méthodes appartiennent à l'objet &lt;em&gt;QAbstractItemModel&lt;/em&gt; et seront questionnées par la vue (liste, arbre, …) pour connaître la représentation à l'écran.&lt;/p&gt;


&lt;p&gt;Les méthodes &lt;em&gt;mapFromSource()&lt;/em&gt;, et &lt;em&gt;mapToSource()&lt;/em&gt; sont à implémenter pour l'objet &lt;em&gt;QAbstractProxyModel&lt;/em&gt;. Elles permettent de faire la liaison entre les indexes (&lt;em&gt;QModelIndex&lt;/em&gt;) du modèle d'origine et les indexes du nouveau modèle.&lt;/p&gt;


&lt;p&gt;Les méthodes &lt;em&gt;data()&lt;/em&gt;, &lt;em&gt;headerData()&lt;/em&gt;, &lt;em&gt;flags()&lt;/em&gt; sont réimplémentées par l'objet &lt;em&gt;QAbstractProxyModel&lt;/em&gt; et utilisent les méthodes &lt;em&gt;mapFromSource()&lt;/em&gt; et &lt;em&gt;mapToSource()&lt;/em&gt; pour, lors de l'appel d'une de ces méthodes, récupérer les informations stockées sur le modèle d'origine.&lt;/p&gt;


&lt;p&gt;Des méthodes &lt;em&gt;sourceModel()&lt;/em&gt; et &lt;em&gt;setSourceModel()&lt;/em&gt; permettent de spécifier le modèle d'origine.&lt;/p&gt;


&lt;h3&gt;Implémentation de notre modèle&lt;/h3&gt;


&lt;h4&gt;Structure interne&lt;/h4&gt;


&lt;p&gt;Nous allons, dans cette partie, parler de la structure interne utilisée par notre objet.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;struct&lt;/span&gt; Mapping &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; id&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; parrentId&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; index&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; parentIndex&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	QVector&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;int&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; source_rows&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #993333;&quot;&gt;typedef&lt;/span&gt; QMap&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;int&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;Mapping&lt;span style=&quot;color: #339933;&quot;&gt;*&amp;gt;&lt;/span&gt; IndexMap&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
IndexMap m_sourcesIndexMapping&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
QHash&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;int&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;int&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; m_categoryIdMapping&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous allons créer une structure &lt;em&gt;Mapping&lt;/em&gt; qui associera pour une ligne dans le modèle source, les informations concernant&amp;nbsp;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;l'identifiant de la ligne.&lt;/li&gt;
&lt;li&gt;l'identifiant de la ligne parente.&lt;/li&gt;
&lt;li&gt;l'index dans  le modèle source.&lt;/li&gt;
&lt;li&gt;l'index du parent dans le modèle source.&lt;/li&gt;
&lt;li&gt;la liste des indexes dans le modèle source des enfants dans notre modèle.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Une table de hashage permettra de retrouver à partir d'un identifiant (id), la ligne dans le modèle source correspondante. On ne gardera que la seconde colonne (le nom de la catégorie), on ne fera donc l'association qu'entre le nom de la colonne de notre modèle et le modèle source en dure dans le programme.&lt;/p&gt;


&lt;h4&gt;createMapping()&lt;/h4&gt;


&lt;p&gt;Le but de cette méthode est de générer l'arborescence qui sera ensuite utilisée dans la suite des méthodes. Cette arborescence étant générée une fois pour toute (ou à chaque fois que le modèle source sera réinitialisé), il faudra parcourir l'ensemble des lignes du modèle source pour construire notre arbre. Parcourir l'ensemble des lignes du modèle source peut prendre du temps si ce dernier contient beaucoup de ligne.&lt;/p&gt;


&lt;p&gt;Nous allons considérer dans la suite, que l'identifiant de ligne 1 (id) correspond à la catégorie de plus haut niveau (ci-dessus du nom de &lt;em&gt;Categories&lt;/em&gt;). Nous allons créer une catégorie fictive 0 qui correspondra à la racine de notre modèle. Cette catégorie sera donc la catégorie parente de celle à l'identifiant 1.
Dans notre modèle source, la catégorie 0 n'a pas d'équivalence parmi les lignes du modèle source. Nous allons donc lui associer la ligne -1 dans le modèle source.&lt;/p&gt;


&lt;p&gt;Maintenant voyons la génération de la structure interne.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;qDeleteAll&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; m_sourcesIndexMapping &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;clear&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
m_categoryIdMapping.&lt;span style=&quot;color: #202020;&quot;&gt;clear&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous commençons ci-dessous par nettoyer les différentes structures afin de les régénérer. Il faudra à la suite de la création du mapping appeler la méthode &lt;em&gt;reset()&lt;/em&gt; afin de prévenir la vue que l'ensemble des indexes du modèle sont obsolètes.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; source_rows &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;rowCount&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; source_rows&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;i &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; new Mapping&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	IndexMap&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; it &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; IndexMap&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;insert&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; i&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; m &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;index &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; i&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;parrentId &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;parentIndex &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		QSqlRecord record &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;record&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		m_categoryIdMapping&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; record.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; list_id &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;toInt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; i&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;id &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; record.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; list_id &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;toInt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// Create the root Item&lt;/span&gt;
		m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;id &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		m_categoryIdMapping&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous récupérons le nombre de ligne dans le modèle source et commençons à initialiser notre structure. Le but de cette boucle est surtout d'initialiser dans notre correspondance identifiant/index (&lt;em&gt;m_categoryIdMapping&lt;/em&gt;), l'emplacement des identifiants dans notre tableau. Ainsi dans la suite lorsque l'on essaiera d'associer une ligne à son parent, nous pourrons savoir à quel emplacement retrouver notre id dans la structure &lt;em&gt;m_sourcesIndexMapping&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Nous profitons également de cette boucle pour initialiser les différents champs de notre structure comme l'index (qui correspond à la ligne dans le modèle source), et l'id qui correspond à un identifiant unique dans notre liste.&lt;/p&gt;


&lt;p&gt;Nous n'oublions pas notre cas particulier que représente notre racine (ligne source -1 inexistante).&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; source_rows&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;i &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	QSqlRecord record &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;record&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; parentCategoryId &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; record.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; list_parentid &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;toInt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; parentCategoryIndex &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_categoryIdMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; parentCategoryId&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	Q_ASSERT&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; parentCategoryIndex &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; mapping &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	mapping&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;parentIndex &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; parentCategoryIndex&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	mapping&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;parrentId   &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; parentCategoryId&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; categoryMapping &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; parentCategoryIndex &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	categoryMapping&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Enfin pour chaque enregistrement de notre modèle source, nous récupérons l'identifiant du parent et   recherchons dans la structure que nous venons de créer l'index dans le modèle source de la  catégorie parente.&lt;/p&gt;


&lt;p&gt;Ces valeurs sont alors renseignées dans le modèle. Nos ajoutons également dans la structure de &lt;em&gt;mapping&lt;/em&gt; de la catégorie parent, notre ligne dans la liste des enfants.&lt;/p&gt;


&lt;p&gt;Notre structure est ainsi complètement initialisé. Un identifiant connaît donc son parent, et la liste de ses enfants. C'est sur cette structure que se basera le reste des méthodes de notre modèle.&lt;/p&gt;


&lt;h4&gt;mapFromSource()&lt;/h4&gt;


&lt;p&gt;Le but de cette méthode est de convertir notre index venant du modèle source vers un index de notre modèle à nous.&lt;/p&gt;


&lt;p&gt;L'index du modèle source nous donne l'emplacement de la donnée dans le modèle source sous forme (ligne, colonne) alors que l'index de notre modèle doit donner l'emplacement dans notre modèle sous la forme (ligne, colonne, pointeur indiquant le parent).&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt; sourceIndex.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceIndex.&lt;span style=&quot;color: #202020;&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; m_sourceModel &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	qWarning&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;CategoryItemModel: index from wrong model passed to mapFromSource&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Il faut donc d'abord vérifier que l'index du modèle source est valide. S'il n'est pas valide, alors il ne sera pas valide non plus dans notre modèle à nous.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; row &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; sourceIndex.&lt;span style=&quot;color: #202020;&quot;&gt;row&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
IndexMap&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; it &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; row &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
Q_ASSERT&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; it &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constEnd&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous récupérons l'index dans le modèle source, et à l'aide de notre tableau d'index source, nous allons retrouver l'objet &lt;em&gt;Mapping&lt;/em&gt; correspondant. Cette objet &lt;em&gt;Mapping&lt;/em&gt; correspondra à celui de notre index source. Ce dont nous avons besoin pour notre modèle est l'objet &lt;em&gt;Mapping&lt;/em&gt; de l'objet parent (En effet, notre index est construit sous la forme&amp;nbsp;: ligne, colonne, pointeur sur la structure &lt;em&gt;Mapping&lt;/em&gt; du parent de notre index). Nous récupérons donc l'index de la ligne source dans l'objet parent.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; parentRow &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; it.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;parentIndex&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
IndexMap&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; parentIt &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; parentRow &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
Q_ASSERT&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; parentIt &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constEnd&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; parentIt.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Cela nous permet de récupérer l'objet &lt;em&gt;Mapping&lt;/em&gt; de l'index parent.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; proxyRow    &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;indexOf&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; row &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; proxyColumn &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; sourceColumnToProxy&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceIndex.&lt;span style=&quot;color: #202020;&quot;&gt;column&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyColumn &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;La méthode &lt;em&gt;sourceColumnToProxy()&lt;/em&gt; permet de transformer une colonne de l'objet source en une colonne de l'objet courant. Cela signifie que la colonne 2 sera convertie en colonne 1, et que les colonnes 1 et 3 ne seront pas converties (et cachées). Dans ce dernier cas, nous retournons &lt;em&gt;QModelIndex()&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;L'index de la ligne dans notre modèle sera donné par la position dans la liste &lt;em&gt;source_rows&lt;/em&gt; dans notre structure de conversion.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; createIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyRow&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; proxyColumn&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt;parentIt &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous pouvons alors créer notre index.&lt;/p&gt;


&lt;h4&gt;mapToSource()&lt;/h4&gt;


&lt;p&gt;De la manière inverse à la méthode &lt;em&gt;mapFromSource()&lt;/em&gt;, cette méthode permet de convertir un index de notre objet en un index du modèle source.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt; proxyIndex.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyIndex.&lt;span style=&quot;color: #202020;&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; this &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	qWarning&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;CategoryItemModel: index from wrong model passed to mapToSource&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Si le modèle est invalide  dans notre modèle, il l'est aussi dans le modèle source. Il n'y a pas d'équivalent dans le modèle source de l'index racine.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; static_cast&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;Mapping&lt;span style=&quot;color: #339933;&quot;&gt;*&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyIndex.&lt;span style=&quot;color: #202020;&quot;&gt;internalPointer&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous récupérons la structure dans le pointeur interne de notre index.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; proxyColumnToSource&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyIndex.&lt;span style=&quot;color: #202020;&quot;&gt;column&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous récupérons également les informations sur notre colonne (Soit, conversion de la colonne 0 dans notre modèle, en la colonne 1 dans le modèle source).&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceRow &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;at&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyIndex.&lt;span style=&quot;color: #202020;&quot;&gt;row&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous recherchons dans notre liste &lt;em&gt;source_rows&lt;/em&gt; la ligne dans le modèle source qui correspond à la ligne (relative au père) indiqué par notre index et nous construisons un index de type (ligne, colonne) correspondant au modèle source.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;index&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRow&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;L'implémentation des méthodes &lt;em&gt;mapFromSource()&lt;/em&gt; et &lt;em&gt;mapToSource()&lt;/em&gt; permettent de faire fonctionner les implémentations des méthodes &lt;em&gt;data()&lt;/em&gt;, &lt;em&gt;headerData()&lt;/em&gt;, et &lt;em&gt;flags()&lt;/em&gt;. Il n'y aura donc aucun intérêt à ré-implémenter ces méthodes à moins de vouloir traiter les données de ces fonctions. Nous ne les décrirons donc pas ici, mais vous pourrez voir dans le fichier attaché, un exemple d'utilisation.&lt;/p&gt;


&lt;h4&gt;index()&lt;/h4&gt;

&lt;p&gt;Le principe de cette méthode est de générer un index pour notre modèle. L'index doit être valide et réutilisable dans les méthodes &lt;em&gt;rowCount()&lt;/em&gt;, &lt;em&gt;flags()&lt;/em&gt;, &lt;em&gt;columnCount()&lt;/em&gt;, &lt;em&gt;data()&lt;/em&gt;, &lt;em&gt;mapToSource()&lt;/em&gt;.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; row &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; column &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Si la ligne ou la colonne est inférieure à 0, l'index n'est pas valide.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;IndexMap&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; it &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
QModelIndex sourceParent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; mapToSource&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; parent &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceParent.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	it &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceParent.&lt;span style=&quot;color: #202020;&quot;&gt;row&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;A partir de l'index &lt;em&gt;parent&lt;/em&gt; nous retrouvons l'index qui correspond dans le modèle source (&lt;em&gt;sourceParent').  Si l'on ne trouve pas d'index dans le modèle source, nous considérons être sur l'élément racine de notre arbre. Sinon nous recherchons dans la table de &lt;/em&gt;Mapping'' la structure qui correspond.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;Q_ASSERT&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; it &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constEnd&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; it.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;=&lt;/span&gt; row &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Nous vérifions le nombre d'élément dans la structure et nous retournons un index non valide si l'index demandé va au delà de la taille du tableau.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; createIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; row&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; column&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt;it &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Finalement nous retournons l'index créé avec le pointeur vers la structure &lt;em&gt;Mapping&lt;/em&gt; du père en &lt;em&gt;internalData&lt;/em&gt;.&lt;/p&gt;


&lt;h4&gt;parent()&lt;/h4&gt;


&lt;p&gt;Cette méthode permet de retourner pour l'index donné du proxy, l'index du parent. Un index invalide n'a pas de parent.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; static_cast&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;Mapping&lt;span style=&quot;color: #339933;&quot;&gt;*&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;internalPointer&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;On récupère la structure de correspondance stockée dans le pointeur interne de l'objet. Cette  structure nous donne les informations du parent (en effet dans &lt;em&gt;internalPointer()&lt;/em&gt;, on stock la structure &lt;em&gt;Mapping&lt;/em&gt; du parent), et donc l'index dans le modèle source.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceRow &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;index&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRow &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
QModelIndex sourceParent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;index&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRow&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; proxyColumnToSource&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
QModelIndex proxyParent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; mapFromSource&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceParent &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;On utilise alors notre méthode &lt;em&gt;mapFromSource()&lt;/em&gt; pour retrouver l'index du parent dans le référentiel du proxy.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; proxyParent&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;rowCount()&lt;/h4&gt;


&lt;p&gt;Le but de cette méthode est de retourner le nombre de ligne enfant pour un index. Dans le modèle source les indexes n'ont pas d'enfant.
Lorsque l'index vaut &lt;em&gt;QModelIndex()&lt;/em&gt;, cela signifie qu'il faut retourner le nombre de ligne pour notre racine.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;column&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Seul la première colonne a des enfants.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; rootMapping &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; rootMapping&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Pour l'index racine, on récupère le nombre de ligne à la ligne -1 du modèle source.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; parrentMapping &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; static_cast&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;Mapping&lt;span style=&quot;color: #339933;&quot;&gt;*&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;internalPointer&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceRowIndex &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; parrentMapping&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;at&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;row&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; rowMapping &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRowIndex &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; rowMapping&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Sinon on récupère la structure stockée dans le pointeur interne. Cette structure est celle du parent de notre objet. On récupère à l'aide de la méthode &lt;em&gt;row()&lt;/em&gt; de l'index l'emplacement de la ligne source. Cette ligne source nous permet de récupérer la structure de correspondance de notre index, et ainsi le nombre de ligne de notre index.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;columnCount()&lt;/h4&gt;


&lt;p&gt;Notre modèle ne possède qu'une seule colonne.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;proxyColumnToSource()&lt;/h4&gt;


&lt;p&gt;Si la colonne du proxy vaut 0, alors on retourne la colonne 1, sinon on retourne la colonne -1&amp;nbsp;: la colonne n'est pas convertible, elle n'existe pas dans notre proxy.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; proxyColumn &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; list_name&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;sourceColumToProxy()&lt;/h4&gt;


&lt;p&gt;Si la colonne source est 1, alors nous convertissons celle-ci en la colonne 0. Sinon la colonne n'existe pas dans notre proxy.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; list_name &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/qt/table2tree/categoryitemmodel.cpp"
      length="8272" type="text/plain" />
          <enclosure url="http://www.shadoware.org/public/billets/qt/table2tree/categoryitemmodel.h"
      length="3018" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2009/09/10/%5BQt%5D-Transformation-d-une-vue-tableau-en-une-vue-hi%C3%A9rarchique#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/09/10/%5BQt%5D-Transformation-d-une-vue-tableau-en-une-vue-hi%C3%A9rarchique#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/623</wfw:commentRss>
      </item>
    
  <item>
    <title>Parseur XML</title>
    <link>http://www.shadoware.org/post/2009/05/06/Parseur-XML</link>
    <guid isPermaLink="false">urn:md5:c38e3e38c95811c208acff03641cdefb</guid>
    <pubDate>Sun, 31 May 2009 23:13:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Performances</category>
        <category>performance</category><category>planet</category><category>qt</category><category>xml</category>    
    <description>&lt;p&gt;Bonjours à tous,&lt;/p&gt;


&lt;p&gt;L'utilisation des fichiers XML est, à ce jour, un fait dans la plupart des logiciels et est fortement à la mode. Une entreprise qui ne fait pas un peu de XML est souvent &lt;em&gt;has-been&lt;/em&gt;. On utilise alors le XML à bon ou mauvais escient.&lt;/p&gt;    &lt;style&gt;
th {
background-color: #E4E4E4;
weigh: bold;
}
.veryslow {
background-color: #FF0000;
}
.slow {
background-color: #FF8686;
}
.good {
background-color: #C3FFC7;
}
.ignored {
background-color: #E4E4E4;
}
&lt;/style&gt;


&lt;h3&gt;Avantages / Inconvénients&lt;/h3&gt;


&lt;p&gt;Pourquoi utiliser les fichiers XML&amp;nbsp;? Les fichiers XML sont, pour commencer, des fichiers textes, il seront donc toujours lisibles, ce qui garantit une meilleur pérennité de l'information. Les fichiers XML sont structurés hiérarchiquement et suivent une syntaxe stricte. Ainsi le XML est lisible informatiquement par les différents langages de programmation existant, pour organiser vos données, en utilisant différents niveaux. Les fichiers XML peuvent être commenté ce qui peut améliorer la lisibilité pour un humain.&lt;/p&gt;


&lt;p&gt;Le gros inconvénient du XML est sa verbosité. Pour chaque noeud dans la hiérarchie, il y a une balise de début, et une balise de fin contenant le nom de la balise. Le fichier est moins compact que s'il avait été écrit en binaire. Cela peut poser des problèmes comme alourdir les communications réseaux (ex: pour les webservices). Le fichier est aussi plus long à lire qu'un fichier binaire et peut contenir des erreurs.&lt;/p&gt;


&lt;p&gt;Si le fichier n'a pas besoin d'être hiérarchique, il est possible d'utiliser une structure de fichier INI pour ses données.&lt;/p&gt;


&lt;p&gt;Nous nous arrêterons là pour les avantages/inconvénients. L'utilisation ou non d'un fichier XML est ensuite une question (besoin, éthique, ...) à se poser pour ses données et la nécessité de pouvoir les lire autrement que par le programme lui-même.&lt;/p&gt;


&lt;h3&gt;Performance des parseurs.&lt;/h3&gt;


&lt;p&gt;Je me suis amusé à effectuer le test de lecture de différents fichiers de donnée au format XML de taille différentes par une variété de parseur XML en construisant si possible un arbre DOM. Le but est donc de créer un objet par noeud/attribut du fichier XML et de reconstituer la hiérarchie.&lt;/p&gt;


&lt;p&gt;Les parseurs choisis pour ce test sont&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;QtXml&lt;/strong&gt;&amp;nbsp;: Le module XML de la librairie Qt (de la société Nokia)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LibXml2&lt;/strong&gt;&amp;nbsp;: Une librairie C permettant de faire du parsing XML en utilisant DOM ou SAX&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LibExpat&lt;/strong&gt;&amp;nbsp;: Un parseur orienté flux (plus proche de la méthode SAX que du DOM)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SCEW&lt;/strong&gt;&amp;nbsp;: Un parseur basé sur Expat générant un arbre DOM (donc un peu plus comparable aux autre parseur).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TinyXML&lt;/strong&gt;&amp;nbsp;: Encore un autre parseur XML&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Xerces-C++&lt;/strong&gt;&amp;nbsp;: Le parseur XML d’Apache&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Oracle XML Parser&lt;/strong&gt;&amp;nbsp;: Le parseur d’Oracle propriétaire utiliser dans le serveur d’application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pour faire cette suite de benchmark&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/05/06/Parseur-XML#pnote-620-1&quot; id=&quot;rev-pnote-620-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;, j’ai utilisé la librairie QTestLib de Nokia/Qt. Je vous offre donc en avant première le résultat de ce test&amp;nbsp;:&lt;/p&gt;

&lt;table&gt;
&lt;caption&gt;Temps de lecture d'un fichier XML en ms&lt;/caption&gt;
&lt;tr&gt;
  &lt;td/&gt;
  &lt;th&gt;250k&lt;/th&gt;
  &lt;th&gt;9300k&lt;/th&gt;
  &lt;th&gt;11300k&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Qt DOM&lt;/th&gt;
  &lt;td class=&quot;veryslow&quot;&gt;41,42 ms&lt;/td&gt;
  &lt;td class=&quot;veryslow&quot;&gt;2184,34 ms&lt;/td&gt;
  &lt;td class=&quot;veryslow&quot;&gt;2648,71 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;LibXML2&lt;/th&gt;
  &lt;td&gt;16,55 ms&lt;/td&gt;
  &lt;td class=&quot;good&quot;&gt;710,09 ms&lt;/td&gt;
  &lt;td class=&quot;good&quot;&gt;874,42 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Expat (SAX)&lt;/th&gt;
  &lt;td class=&quot;ignored&quot;&gt;5,95 ms&lt;/td&gt;
  &lt;td class=&quot;ignored&quot;&gt;312,02 ms&lt;/td&gt;
  &lt;td class=&quot;ignored&quot;&gt;393,58 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Oracle&lt;/th&gt;
  &lt;td&gt;23,24 ms&lt;/td&gt;
  &lt;td&gt;928,93 ms&lt;/td&gt;
  &lt;td&gt;1135,86 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Scew&lt;/th&gt;
  &lt;td class=&quot;good&quot;&gt;12,05 ms&lt;/td&gt;
  &lt;td&gt;944,37 ms&lt;/td&gt;
  &lt;td&gt;1184,46 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Tiny XML&lt;/th&gt;
  &lt;td class=&quot;slow&quot;&gt;28,91 ms&lt;/td&gt;
  &lt;td class=&quot;slow&quot;&gt;1101,8 ms&lt;/td&gt;
  &lt;td class=&quot;slow&quot;&gt;1369,8 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Xerces (Apache)&lt;/th&gt;
  &lt;td&gt;25,03 ms&lt;/td&gt;
  &lt;td&gt;742,22 ms&lt;/td&gt;
  &lt;td&gt;904,62 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;



&lt;p&gt;La conclusion de ce résultat signifie que le parseur inclu dans Qt (pour la construction d'un arbre DOM) est très lent ;). Mais pour une utilisation dans une interface graphique, sur de petits fichiers, ne devrait pas poser de problème.&lt;/p&gt;


&lt;p&gt;Enfin le parseur le plus rapide (pour les gros fichiers) est Libxml2. Le parseur C d'oracle, bien que propriétaire n'a rien d'exceptionnel (si on compte avec les problèmes présenté également ci-dessous). Peut-être que la version Java est elle plus performante.&lt;/p&gt;


&lt;p&gt;Vous pouvez retrouver quelques graphiques ci-dessous&amp;nbsp;:&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xmlparser/.TestXMLPerf_m.jpg&quot; alt=&quot;TestXMLPerf.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;TestXMLPerf.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Le source du benchmark&lt;/h3&gt;


&lt;p&gt;Vous pouvez trouver attaché au billet, le source de l'application ayant servi au bench. Pour la partie utilisation du Parseur Oracle, il a fallut contourner plusieurs petits problèmes. Ceci est la joie des librairies propriétaires bien documentées.&lt;/p&gt;


&lt;h4&gt;Compilation avec le XDK 9&lt;/h4&gt;


&lt;p&gt;Lors de la compilation avec le XDK 9, l'application ne dépasse pas le stade du &lt;em&gt;linkage&lt;/em&gt;. Les méthodes sont pourtant bien dans les &lt;em&gt;includes&lt;/em&gt;. De plus les librairies sont bien précisées pour le &lt;em&gt;linkage&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;La définition faite dans le projet est&amp;nbsp;:&lt;/p&gt;
&lt;pre&gt;
XDKPATH = xdk9
XDK_LIB = -lxmlg9 -lxml9 -lxsd9
ORA_LIB = -lcore9 -lnls9 -lunls9 -lcore9 -lnls9 -lcore9
NET_LIB = -lnsl
LIBS += -L$$XDKPATH/lib $$XDK_LIB $$ORA_LIB $$NET_LIB -lpthread
INCLUDEPATH += $$XDKPATH/xdk/include
&lt;/pre&gt;


&lt;p&gt;A la suite de ça, lors de la phase de compilation, on se retrouve avec les messages d'erreurs suivants&amp;nbsp;:&lt;/p&gt;
&lt;pre&gt;
g++ -Wl,-O1 -o xmlparserbenchmark libxml2parser.o expatparser.o xercescppparser.o oracleparser.o qtparser.o scewparser.o tinyparser.o tinyxml.o tinystr.o tinyxmlerror.o tinyxmlparser.o xmlparserbenchmark.o moc_xmlparserbenchmark.o -L/usr/lib -lxml2 -lexpat -lxerces-c -Lxdk9/lib -lxmlg9 -lxml9 -lxsd9 -lcore9 -lnls9 -lunls9 -lcore9 -lnls9 -lcore9 -lnsl -lpthread -Lscew/scew -lscew -lQtTest -lQtXml -lQtGui -lQtCore -lpthread
oracleparser.o: In function `parseWithOracleParser(QString const&amp;amp;)':
oracleparser.cpp:(.text+0x82): undefined reference to `XMLParser::xmlinit(unsigned char*, void (*)(void*, unsigned char const*, unsigned int), void*, xmlsaxcb*, void*, unsigned char*)'
oracleparser.cpp:(.text+0xa8): undefined reference to `XMLParser::xmlparse(unsigned char*, unsigned char*, unsigned int)'
oracleparser.cpp:(.text+0x2b4): undefined reference to `XMLParser::getDocumentElement()'
oracleparser.cpp:(.text+0x2ca): undefined reference to `XMLParser::xmlterm()'
&lt;/pre&gt;


&lt;p&gt;J'ai alors essayé de recompiler les exemples de démonstrations mais là, même problème ...&lt;/p&gt;


&lt;h4&gt;Compilation avec le XDK 10&lt;/h4&gt;


&lt;p&gt;Avec cette version du XDK, nous avons le droit à deux problèmes. Le premier est une grosse fuite mémoire (si on écrit le programme tel que décrit dans la démo), et à un problème d'initialisation du parseur.&lt;/p&gt;


&lt;p&gt;Le code permettant de parser le fichier XML et de générer l'arbre DOM ressemble à ceci&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;CXmlCtx &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; ctxp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
try &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	ctxp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; new CXmlCtx&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; catch&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; XmlException &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; e &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;unsigned&lt;/span&gt; ecode &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; e.&lt;span style=&quot;color: #202020;&quot;&gt;getCode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; QString&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Failed to initialize XML context, error %1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;arg&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; ecode &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
Factory&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;CXmlCtx&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;xmlnode&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; fp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
try &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	fp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; new Factory&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;CXmlCtx&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;xmlnode&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; ctxp &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; catch&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; FactoryException &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; fe &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;unsigned&lt;/span&gt; ecode &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; fe.&lt;span style=&quot;color: #202020;&quot;&gt;getCode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; QString&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Failed to create create parser, error %1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;arg&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; ecode &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
DOMParser&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;CXmlCtx&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;xmlnode&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; parserp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
try &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	parserp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; fp&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;createDOMParser&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; DOMParCXml&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; NULL &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; catch&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; FactoryException &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; fe &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	delete fp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;unsigned&lt;/span&gt; ecode &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; fe.&lt;span style=&quot;color: #202020;&quot;&gt;getCode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; QString&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Failed to create parser, error %1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;arg&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; ecode &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;char&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; fname &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; filename&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
FileSource &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; isrcp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; new FileSource&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;oratext&lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; fname &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
try &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	DocumentRef&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;xmlnode&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; docrefp &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; parserp&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;parse&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; isrcp&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; FALSE &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; docrefp &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; NULL &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; QString&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;NULL document&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	xmlnode &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; np &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; docrefp&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;getDocumentElement&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; np &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; NULL &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; QString&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Empty document&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	docrefp&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;markToDelete&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	delete docrefp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; catch&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; ParserException &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt; pe &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	delete parserp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	delete isrcp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	delete fp&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #993333;&quot;&gt;unsigned&lt;/span&gt; ecode &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; pe.&lt;span style=&quot;color: #202020;&quot;&gt;getCode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; QString&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Failed to parse the document, error %1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;arg&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; ecode &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;//	delete parserp;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;//	delete isrcp;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;//	delete fp;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;//	delete ctxp;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Le premier problème se situe lors de la suppression du contexte (dernière ligne, en commentaire). Si cette ligne est exécutée, alors nous avons une grosse erreur de segmentation. J'ai le problème, quels que soient les &lt;code&gt;delete&lt;/code&gt; que je fais avant.
Même en faisant le maximum de &lt;code&gt;delete&lt;/code&gt; (soit parserp, isrcp, fp), le fait de ne pas supprimer le context (ctxp), fait qu'au bout de plusieurs itérations, nous avons une bonne fuite mémoire&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/05/06/Parseur-XML#pnote-620-2&quot; id=&quot;rev-pnote-620-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Vient ensuite le second problème, celui des erreurs d'intialisation. Si le parseur est lancé plusieurs fois de suite, alors l'application affiche les erreurs suivantes à l'écran&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;
LPX-00202: Message 202 not found; No message file for product=XDK, facility=LPX
FAIL!  : XmlParserBenchmark::oracleParser(file250k.xml) Failed to parse the document, error 202
   Loc: [oracleparser.cpp(73)]
&lt;/pre&gt;


&lt;p&gt;Aucune explication sur le pourquoi. Parfois ça marche, parfois non... Pour contourner le problème, j'ai forké le parseur pour l'exécuter isolé du reste.&lt;/p&gt;

&lt;pre class=&quot;c c&quot; style=&quot;font-family:inherit&quot;&gt;pid_t pid &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; fork&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; pid &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	waitpid&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; pid&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; pid &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt; filename.&lt;span style=&quot;color: #202020;&quot;&gt;isEmpty&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
		parse&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; qPrintable&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; filename &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	exit&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	QFAIL&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Cannot fork&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/05/06/Parseur-XML#rev-pnote-620-1&quot; id=&quot;pnote-620-1&quot;&gt;1&lt;/a&gt;] Ces tests ont été réalisé dans un chroot 32-bits allant à 2,4GHz. Les temps sont une moyenne sur 100 itérations&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/05/06/Parseur-XML#rev-pnote-620-2&quot; id=&quot;pnote-620-2&quot;&gt;2&lt;/a&gt;] Si quelqu'un a déjà utilisé ce parseur, et qu'il sait comment il fonctionne, il peut m'écrire&lt;/p&gt;&lt;/div&gt;
</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/xmlparser/benchmark_100iterations.ods"
      length="13231" type="application/vnd.oasis.opendocument.spreadsheet" />
          <enclosure url="http://www.shadoware.org/public/billets/xmlparser/xmlparser-bench.7z"
      length="15716" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2009/05/06/Parseur-XML#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/05/06/Parseur-XML#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/620</wfw:commentRss>
      </item>
    
  <item>
    <title>XINX 0.8.1.0</title>
    <link>http://www.shadoware.org/post/2009/05/22/XINX-0.8.1.0</link>
    <guid isPermaLink="false">urn:md5:75e07ca2c9687d04d7fd0d4cf88369df</guid>
    <pubDate>Tue, 26 May 2009 08:30:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>XINX</category>
        <category>egx</category><category>generix</category><category>generix group</category><category>qt</category><category>xinx</category>    
    <description>    &lt;p&gt;Bonjour à tous,&lt;/p&gt;


&lt;p&gt;&lt;ins&gt;&lt;strong&gt;Erratum&amp;nbsp;: &lt;/strong&gt; La dernière version est numéroté 0.8.1.1. Un petit bug (pouvant être gênant lors de l'ouverture de feuille de style sans utilisation du mode projet) a été corrigé dans la foulé. La page est corrigé en conséquence&lt;/ins&gt;&lt;/p&gt;


&lt;p&gt;Je souhaite vous annoncer la sortie de la version &lt;del&gt;0.8.1.0&lt;/del&gt; 0.8.1.1 de XINX. Pas d'énorme changement pour vous depuis la version 0.8.0.0 (sinon nous serions passés à la version 0.9.0.0) mais de gros changements internes.&lt;/p&gt;


&lt;h3&gt;Vue Contenue&lt;/h3&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.ContentViewDock_s.jpg&quot; alt=&quot;ContentViewDock.png&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;ContentViewDock.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;En fait, la partie gérant la vue contenue a été complètement ré-écrite. Elle est maintenant parallélisée et partagée entre les différents éditeurs. Au final l'empreinte mémoire, ainsi que la fluidité a chargé les différents fichiers de XINX devrait être amélioré. (Enfin j'espère, car je n'ai pas fait de benchmark). De ce coté le code est lui aussi beaucoup plus propre et plus souple.&lt;/p&gt;


&lt;p&gt;XINX étant toujours dans les versions 0.XX, je n'ose vous rappeler que ce n'est pas ce qu'on appelle une version finie, mais une série de bêta &lt;img src=&quot;/dotclear/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt; . Étant donné le peu de test que j'ai pu faire sur cette version en particulier j'aurais dû la nommer en -rc ou en -beta mais je me suis dit que cela serait redondant, et que si ça ne convenait pas vous ajouteriez un ticket sur ce site pour me prévenir. Enfin j'espère que cette version ne sera pas trop miner. :D&lt;/p&gt;


&lt;p&gt;La ré-écriture de la partie &lt;em&gt;Vue Contenue&lt;/em&gt; permet donc de préciser dans les propriétés du projet quelques fichiers qui seront pré-chargés au chargement du projet. Ces fichiers étant pré-chargés, l'ouverture des feuilles de styles devrait être accéléré. Si de votre coté, XINX présente quelques faiblesses, merci de me prévenir. La complétion a également été améliorée (avec la suppression des bug, comme l'affichage de balise with-param en double). Lors de vos déplacements dans l'éditeur, la vue contenue vous indique votre emplacement dans la vue contenue.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.PreloadedFiles_s.jpg&quot; alt=&quot;PreloadedFiles.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;PreloadedFiles.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Dictionnaire&lt;/h3&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.Dictionary_s.jpg&quot; alt=&quot;Dictionary.png&quot; style=&quot;float:left; margin: 0 1em 1em 0;&quot; title=&quot;Dictionary.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;L'autre nouveau point et l'ajout d'un nouveau Dock par l'intermédiaire des plugins. Ce Dock vous propose l'affichage du dictionnaire dans les versions GCE130 et GCE140. Pour l'instant le seul intérêt de ce dock est l'affichage du dictionnaire à la recherche d'un label. C'est un point de départ pouvant vous servir à faire des tickets sur des améliorations à apporter. (Celle que j'ai en tête est la gestion de la complétion sur les libellés du dictionnaire). Merci de passer par le système de ticket pour proposer d'autres améliorations sur le DOCK Dictionnaire.&lt;/p&gt;


&lt;h3&gt;Pré-visualisation&lt;/h3&gt;


&lt;p&gt;Enfin, dernière évolution intéressante, est l'affichage de la pré-visualisation de la page. Cette fonctionnalité est à noter comme &lt;em&gt;extrêmement expérimental&lt;/em&gt;,et n'évoluera peut-être pas (selon les demandes qui sont faites dessus, ainsi que suivant les problèmes techniques rencontrés), et ne fonctionnera peut-être pas avec les prochaines versions de GCE. (En version 140, les libellés ne sont pas remplacés).&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.CustomWebPlugin_s.jpg&quot; alt=&quot;CustomWebPlugin.png&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;CustomWebPlugin.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Pour faire fonctionner la prévisualisation, vous devez renseigner l'emplacement de la &lt;em&gt;ServletControl&lt;/em&gt;, configurer, dans les propriétés du plugin WEB, le parseur à utiliser&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/05/22/XINX-0.8.1.0#pnote-621-1&quot; id=&quot;rev-pnote-621-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt; et de configurer le lecteur (je vous conseille Webkit).&lt;/p&gt;


&lt;p&gt;De là, lors des développements de feuille de style en mode projet, si vous sélectionnez un flux de présentation XML (dans le dock associé) et appuyé sur F9, vous devriez avoir la prévisualisation de votre feuille de style.&lt;/p&gt;


&lt;p&gt;Le même principe peut-être appliqué pour une page HTML. Là, pas besoin de parseur, ni de flux de présentation. Vous pouvez avoir directement la prévisualisation de votre page HTML.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.ParseXsl_m.jpg&quot; alt=&quot;ParseXsl.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;ParseXsl.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;h3&gt;Gestion des plugins&lt;/h3&gt;


&lt;p&gt;Enfin, la gestion des plugins n'a cessé de s'améliorer. Il est de plus en plus facile d'étendre &lt;em&gt;'XINX&lt;/em&gt;'. Ceci par l'intermédiare de Script ou de Plugins. Si une fonctionnalité vous manque, vous pouvez donc non seulement la proposer, mais aussi l'écrire en script, ou si le script est trop limité, vous pouvez aussi écrire le plugin. Les plugins permettent donc d'ajouter des actions à XINX, des Docks, des éditeurs, des gestionnaires de version, des pages de configuration du projet, ...&lt;/p&gt;


&lt;h3&gt;D-BUS&lt;/h3&gt;


&lt;p&gt;Alors que D-BUS avait été ajouté dans les précédentes versions afin de permettre une plus grande interopérabilité, ce dernier a été retiré pour cette version. Ainsi XINX est maintenant indépendant de D-BUS. Il a été décidé de retirer D-BUS pour plusieurs raisons&amp;nbsp;: Simplification de la compilation, source de problème sous MS/Windows. Il devient maintenant beaucoup plus simple de compiler XINX sous Windows. L'interface avec D-BUS reviendra dans une future version mais sera alors optionnel.&lt;/p&gt;


&lt;p&gt;Je vous souhaite une bonne installation.&lt;/p&gt;


&lt;h4&gt;Téléchargement&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/downloads/45&quot; hreflang=&quot;fr&quot;&gt;binaire i386 windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://xinx.shadoware.org/downloads/46&quot; hreflang=&quot;fr&quot;&gt;source&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sous Debian, ajout du dépôt&amp;nbsp;: &lt;br /&gt;
&lt;code&gt;deb http://apt.shadoware.org/ sid main&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/05/22/XINX-0.8.1.0#rev-pnote-621-1&quot; id=&quot;pnote-621-1&quot;&gt;1&lt;/a&gt;] je vous conseille celui d'Oracle, Il est plus long à se lancer mais permet de gérer les noms de domaine Generix.&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2009/05/22/XINX-0.8.1.0#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/05/22/XINX-0.8.1.0#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/621</wfw:commentRss>
      </item>
    
  <item>
    <title>KMyMoney - Logiciel de compte</title>
    <link>http://www.shadoware.org/post/2009/02/24/KMyMoney-Logiciel-de-compte</link>
    <guid isPermaLink="false">urn:md5:a8f1185e40fdd9ff15ac06145d59a8af</guid>
    <pubDate>Sat, 23 May 2009 12:31:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Logiciels</category>
        <category>argent</category><category>debian</category><category>kde</category><category>libre</category><category>planet</category><category>qt</category>    
    <description>    &lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kmymoney/logo.png&quot; alt=&quot;Logo KMyMoney&quot; style=&quot;float:left; margin: 0 1em 1em 0;&quot; title=&quot;Logo KMyMoney, fév. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Voilà un bon logiciel sur lequel on peut compter (mouarf&amp;nbsp;! mouarf&amp;nbsp;! mouarf !), KMyMoney est un éditeur de compte. Je l'utilise quotidiennement,  et je décide donc d'en parler un peu, pour que d'autres personnes puissent s'intéresser aussi à  ce logiciel.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kmymoney/.Summary_m.jpg&quot; alt=&quot;Summary.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Summary.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;KMyMoney est un logiciel de gestion de compte pour particulier. Il vous permet de gérer plusieurs de vos comptes en banque, en vous permettant de saisir les dépenses et les recettes sur chacun de vos comptes.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kmymoney/.Registres_m.jpg&quot; alt=&quot;Registres.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Registres.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Vous pouvez également lui indiquer vos échéances (par exemple&amp;nbsp;: forfait téléphone, prêt immobilier&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/24/KMyMoney-Logiciel-de-compte#pnote-615-1&quot; id=&quot;rev-pnote-615-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;, mais aussi salaire, vos virements internes ou externes, ...) qu'il s'occupera de mettre à jour dans le registre automatiquement ou à votre demande.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kmymoney/.Echeancier_m.jpg&quot; alt=&quot;Echeancier.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Echeancier.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Après une année d'utilisation, il vous permet également de sortir un rapport détaillé sur vos dépenses et vos recettes suivant les catégories saisies pour vos opérations. Cette information peut vous être très utile pour voir où se trouve le &quot;trou&quot; de votre porte monnaie et ainsi  faire une rustine. Il vous permet aussi de vous projeter vers l'avenir et de faire votre budget pour l'année prochaine. KMyMoney vous offre pour cela, la saisie de votre budget, ainsi que plusieurs rapports d'écart, vous permettant ainsi de retrouver facilement où vous avez finalement dépensé plus que le budget prévu, et où vous avez dépensé moins.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kmymoney/.Rapport_m.jpg&quot; alt=&quot;Rapport.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Rapport.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;En plus de vos comptes en banque &lt;em&gt;normaux&lt;/em&gt;, KMyMoney vous permet également de gérer vos comptes titre, et les actions que vous y avez mises. Vous pouvez alors facilement suivre la chute vertigineuse de la bourse et votre portefeuille fondre littéralement, mais aussi la remontée (on espère), des actions d'ici quelques ... siècles.&lt;/p&gt;


&lt;p&gt;Enfin pour les paranos, vos comptes peuvent être cryptés à l'aide de votre clé GnuPG automatiquement par KMyMoney &lt;img src=&quot;/dotclear/themes/default/smilies/smile.png&quot; alt=&quot;:)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kmymoney/.Cryptage_m.jpg&quot; alt=&quot;Cryptage.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Cryptage.png, mai 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Après cette courte présentation, je vous souhaite bon compte &lt;img src=&quot;/dotclear/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;


&lt;blockquote&gt;&lt;p&gt;Pour une vie équilibrée, n'oubliez pas de profiter du soleil, au lieu de passer votre temps sur votre ordinateur&lt;/p&gt;&lt;/blockquote&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/24/KMyMoney-Logiciel-de-compte#rev-pnote-615-1&quot; id=&quot;pnote-615-1&quot;&gt;1&lt;/a&gt;] Il s'occupera d'ailleurs de calculer la durée des échéances, ... en fonction des différents chiffres que vous allez lui entrer.&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2009/02/24/KMyMoney-Logiciel-de-compte#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/02/24/KMyMoney-Logiciel-de-compte#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/615</wfw:commentRss>
      </item>
    
  <item>
    <title>KDE4 devient instable ...</title>
    <link>http://www.shadoware.org/post/2009/04/11/KDE4-passe-dans-sid</link>
    <guid isPermaLink="false">urn:md5:8d9737fde2f18ddfb08a0869850ed3d6</guid>
    <pubDate>Sat, 11 Apr 2009 11:29:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Logiciels</category>
        <category>debian</category><category>kde</category><category>planet</category><category>qt</category>    
    <description>    &lt;p&gt;Titre trolleur, cela ne veux pas dire que KDE 4 est moins stable qu'avant mais qu'il a passé une étape supplémentaire chez Debian.&lt;/p&gt;


&lt;p&gt;Voilà quelques jours déjà que la distribution &lt;strong&gt;Gnu/Debian&lt;/strong&gt; intègre &lt;strong&gt;KDE 4&lt;/strong&gt; dans sa version instable. C'est une grande nouvelle car cela va permettre à toute les personnes se trouvant en instable et n'ayant pas touchées à la branche expérimental de Debian de pouvoir tester &lt;strong&gt;KDE 4&lt;/strong&gt;.&lt;/p&gt;


&lt;p&gt;Malheureusement pour les &lt;em&gt;traumatisé de KDE 4&lt;/em&gt;, l'intégration de ce dernier remplace KDE 3.5 et ne viens pas se positionner en parallèle. Il me semble pourtant que lors du passage de KDE 2 à KDE 3, il était possible d'avoir les deux bureaux en même temps sur sa machine et de switcher de l'un à l'autre sans difficulté. Cela signifie donc peut-être aussi la perte d'utilisateur pour KDE sous Gnu/Debian au profit d'un autre environnement de bureau.&lt;/p&gt;


&lt;p&gt;Afin d'effectuer la migration en douceur, Gnu/Debian propose un assistant de migration de KDE du nom de Kaboom. Cet assistant, démarrer lors de la première connexion de l'utilisateur et vous propose alors de sauvegarder votre ancien dossier de configuration KDE 3 et de migrer le dossier .kde vers la version 4.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kaboom/.kaboom1_s.jpg&quot; alt=&quot;kaboom1.png&quot; title=&quot;kaboom1.png, avr. 2009&quot; /&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kaboom/.kaboom2_s.jpg&quot; alt=&quot;kaboom2.png&quot; title=&quot;kaboom2.png, avr. 2009&quot; /&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/kaboom/.kaboom3_s.jpg&quot; alt=&quot;kaboom3.png&quot; title=&quot;kaboom3.png, avr. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Je viens donc de passer à KDE 4 et m'émerveille des nouvelles fonctionnalités de KWin (cube, placement des fenêtres) que je n'avais pas avant, car n'avait jamais installé Compiz ...&lt;/p&gt;


&lt;p&gt;Bonne installation,&lt;/p&gt;</description>
    
    
    
          <comments>http://www.shadoware.org/post/2009/04/11/KDE4-passe-dans-sid#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/04/11/KDE4-passe-dans-sid#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/619</wfw:commentRss>
      </item>
    
  <item>
    <title>XINX 0.8.0.0</title>
    <link>http://www.shadoware.org/post/2009/03/06/XINX-0.8.0.0</link>
    <guid isPermaLink="false">urn:md5:bb0b61b90ea40245272ba7dd11a09eaa</guid>
    <pubDate>Fri, 06 Mar 2009 20:39:00 +0100</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>XINX</category>
        <category>debian</category><category>egx</category><category>generix</category><category>generix group</category><category>paquets</category><category>qt</category><category>trolltech</category><category>xinx</category>    
    <description>&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.editeur_de_texte_s.jpg&quot; alt=&quot;Editeur de texte&quot; style=&quot;float:left; margin: 0 1em 1em 0;&quot; title=&quot;Editeur de texte, mar. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;J'ai le plaisir de vous annoncer la sortie de la nouvelle version de &lt;strong&gt;XINX&lt;/strong&gt;.&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; est un éditeur de projet web basé sur les technologies XSL, HTML, CSS, JavaScript. Il possède un mode projet permettant de dériver les projets à la manière des consultants GCE de l'entreprise &lt;em&gt;Generix Group&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Cette dernière version a mis beaucoup de temps pour sortir et est moins complète que celle que je souhaitais faire à l'origine. Cela viens de plusieurs raison&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;de gros changement interne&lt;/li&gt;
&lt;li&gt;moins de temps le soir et le week-end.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;La prochaine version 0.8.1 contiendra les développements que je n'ai pu mettre dans cette version. N'hésitez pas à faire un retour sur les problèmes que vous rencontrez pour que ces derniers soit également corriger pour la prochaine version.&lt;/p&gt;


&lt;p&gt;Nous allons détailler ci-dessous les différentes amélioration incluse dans cette version.&lt;/p&gt;    &lt;h3&gt;QCodeEdit - Le nouvel éditeur&lt;/h3&gt;


&lt;p&gt;L'éditeur de texte de cette version a complètement été remplacé. On est passé de QTextEdit (&lt;em&gt;éditeur de texte de Qt Software&lt;/em&gt;) à QCodeEdit (&lt;em&gt;Développé par Luc Bruant aka fullmetalcoder&lt;/em&gt;). Heureusement que les APIs de ces deux éditeurs sont très similaire ce qui a permis d'effectuer les changements assez rapidement (quelques mois au lieu de quelques années &lt;img src=&quot;/dotclear/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt; ).&lt;/p&gt;


&lt;p&gt;Je tiens également à remercier &lt;em&gt;fullmetalcoder&lt;/em&gt; de sa réactivité sur le développement de QCodeEdit.&lt;/p&gt;


&lt;p&gt;Les nouveautés qu'apportent ce nouvel éditeur par rapport à QTextEdit sont&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;le folding&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/marqueur.png&quot; alt=&quot;Mark&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Mark, mar. 2009&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;les couleurs de fond sur les marque pages et les erreurs (pour une plus grande clarté).&lt;/li&gt;
&lt;li&gt;un chargement plus rapide des fichiers (exemple&amp;nbsp;: &lt;code&gt;configuration.xml&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;pourvoir faire des sélections verticales (à l'aide de Ctrl+Shift) comme le font certain éditeurs&lt;/li&gt;
&lt;li&gt;afficher les correspondances de parenthèses&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Test du XPATH&lt;/h3&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.xpath_s.jpg&quot; alt=&quot;X-Quey&quot; style=&quot;float:left; margin: 0 1em 1em 0;&quot; title=&quot;X-Quey, mar. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Cette boite de dialogue permet d'exécuter un X-PATH (ou une requête XQuery) sur un fichier de présentation. Cela permet de tester rapidement les X-PATH compliqué avant de lancer la page sous le navigateur.&lt;/p&gt;


&lt;p&gt;Il est possible de saisir des X-PATH relativement à un X-PATH sélectionné dans le flux de présentation ou  de manière absolu.&lt;/p&gt;


&lt;h3&gt;Script automatique&lt;/h3&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; permet également d'appeler un script lors de la sauvegarde d'un fichier. Pour cela un nouvel objet permettant de modifier le contenue de l'éditeur plus facilement a été créé.
Comme exemple à la sauvegarde de script ont été mis à jours&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;La mise à jours des key('url-param','') par des X-PATH&lt;/li&gt;
&lt;li&gt;La mise à jours du nom du fichier dans les feuilles de styles.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;javascript javascript&quot; style=&quot;font-family:inherit&quot;&gt;obj.&lt;span style=&quot;color: #660066;&quot;&gt;beforeSave&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
obj.&lt;span style=&quot;color: #660066;&quot;&gt;run&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; search &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;new&lt;/span&gt; DocumentSearch&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; textEdit &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	search.&lt;span style=&quot;color: #660066;&quot;&gt;options&lt;/span&gt;.&lt;span style=&quot;color: #660066;&quot;&gt;regExp&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	search.&lt;span style=&quot;color: #660066;&quot;&gt;searchText&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;key&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;('url-param', '(.*)'&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;)&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	search.&lt;span style=&quot;color: #660066;&quot;&gt;replaceText&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #3366CC;&quot;&gt;&amp;quot;/layout_data/application_data/temporaire/param[@name='&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;1']&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; search.&lt;span style=&quot;color: #660066;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;La nouveauté se trouve dans l'ajout de quatre nouvelle méthodes. La méthode utilisé ici est &lt;code&gt;beforeSave&lt;/code&gt; et permet de faire des modifications au texte avant sauvegarde. Tout comme &lt;code&gt;afterSave&lt;/code&gt; permet d'effectuer des modifications au texte après sauvegarde. Nous avons également deux méthodes beforeLoad et afterLoad pour les opérations à faire lors de la lecture.&lt;/p&gt;


&lt;h3&gt;Autres nouveautés&lt;/h3&gt;


&lt;p&gt;Bien sur cet version apporte aussi d'autres nouveautés comme&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;la fermeture automatique de balise&lt;/li&gt;
&lt;li&gt;des nouvelles options, ...&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Installation&lt;/h3&gt;


&lt;h4&gt;Sous Ms/Windows&lt;/h4&gt;


&lt;p&gt;Pour installer la dernière version de &lt;strong&gt;XINX&lt;/strong&gt; vous pouvez télécharger le &lt;a href=&quot;http://xinx.shadoware.org/downloads/40&quot; hreflang=&quot;fr&quot;&gt;programme d'installation&lt;/a&gt; et le lancer. Il remplacera automatiquement l'ancienne version.&lt;/p&gt;


&lt;p&gt;Si vous avez des fichiers de données modifiés (template, script, ...) pensez à les sauvegarder.&lt;/p&gt;


&lt;h4&gt;Sous Gnu/Linux&lt;/h4&gt;


&lt;p&gt;Sous Debian, vous pouvez ajouter le dépôt dans le fichier /etc/apt/sources.list. Ainsi vous serez automatiquement prévenu des mises à jours éventuelle.&lt;/p&gt;

&lt;pre&gt;
deb http://apt.shadoware.org/ sid main
&lt;/pre&gt;


&lt;p&gt;puis dans une console&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash bash&quot; style=&quot;font-family:inherit&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-cache&lt;/span&gt; search xinx
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;aptitude&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; xinx&lt;/pre&gt;


&lt;p&gt;Pour les autres distributions ou pour les machines MacOS vous pouvez compiler &lt;strong&gt;XINX&lt;/strong&gt; à partir des sources.&lt;/p&gt;</description>
    
    
    
          <comments>http://www.shadoware.org/post/2009/03/06/XINX-0.8.0.0#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/03/06/XINX-0.8.0.0#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/618</wfw:commentRss>
      </item>
    
  <item>
    <title>Qt 4.5 est sortie</title>
    <link>http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie</link>
    <guid isPermaLink="false">urn:md5:64ae6f28b3981e32fa5d8e9568c8220c</guid>
    <pubDate>Tue, 03 Mar 2009 16:42:00 +0100</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Logiciels</category>
        <category>kde</category><category>nokia</category><category>planet</category><category>qmake</category><category>qt</category>    
    <description>    &lt;p&gt;Voilà quelques heures que la dernière version de &lt;em&gt;Qt&lt;/em&gt; est sortie. Cette version, numéroté 4.5, est essentiellement orienté performance.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/logo_nokia_qt.png&quot; alt=&quot;Logo Nokia/Qt&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Logo Nokia/Qt, fév. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Elle contient entre autre &lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie#pnote-617-1&quot; id=&quot;rev-pnote-617-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Une mise à jour de &lt;em&gt;QtWebKit&lt;/em&gt; vers un version de &lt;em&gt;WebKit&lt;/em&gt; plus récente (avec un nouveau moteur JavaScript plus rapide, la possibilité d'ajouter des greffons comme &lt;em&gt;Flash&lt;/em&gt;...). Il est également possible d'utiliser les balises d'HTML 5.&lt;/li&gt;
&lt;li&gt;Amélioration des performances sur le moteur de rendu ainsi que sur le rendu du texte. Une librairie permettant de faire des tests de performance a été incluse&amp;nbsp;: &lt;em&gt;QtBenchLib&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Le support de &lt;em&gt;Mac OS X Cocoa&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;La possibilité de faire des transformations XSLT&lt;/li&gt;
&lt;li&gt;Un débuggeur &lt;em&gt;QtScript&lt;/em&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie#pnote-617-2&quot; id=&quot;rev-pnote-617-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/qtscript-debugger-small.png&quot; alt=&quot;Qt Script Debuger&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Qt Script Debugger, mar. 2009&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Le support du format &lt;em&gt;OpenDocument&lt;/em&gt; (ODF version 1.0, ne supportant que le texte et les images)&lt;/li&gt;
&lt;li&gt;Amélioration du support des proxys&lt;/li&gt;
&lt;li&gt;Amélioration de &lt;em&gt;QtDesigner&lt;/em&gt;, &lt;em&gt;QtLinguist&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Une meilleur intégration au thème Gtk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cette nouvelle version apporte également une grande nouveauté puisqu'elle est &lt;em&gt;LGPL&lt;/em&gt;. Il est donc désormais possible de faire une application propriétaire à l'aide de cette librairie sans prendre une licence chez &lt;em&gt;Qt Software&lt;/em&gt;. Par contre si une entreprise souhaite un support pour la librairie, il faudra tout de même acheter une licence.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/.ScreenShot166_s.jpg&quot; alt=&quot;Téléchargement de Qt 4.5&quot; style=&quot;float:right; margin: 0 0 1em 1em;&quot; title=&quot;Téléchargement de Qt 4.5, mar. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;La sortie de &lt;em&gt;Qt&lt;/em&gt; 4.5 est accompagné de &lt;em&gt;Qt Creator&lt;/em&gt; 1.0. &lt;em&gt;Qt Creator&lt;/em&gt; est l'outil dernier né de chez &lt;em&gt;Qt Software&lt;/em&gt; (branche de &lt;em&gt;Nokia&lt;/em&gt;) et est un IDE de développement de programme &lt;em&gt;Qt&lt;/em&gt;. Un paquet est proposé contenant &lt;em&gt;Qt&lt;/em&gt;, &lt;em&gt;Qt Creator&lt;/em&gt;, ainsi que &lt;em&gt;MinGW&lt;/em&gt; et permettant d'avoir une installation tout en un d'un poste de développement.&lt;/p&gt;


&lt;p&gt;Vous pouvez donc aller télécharger la dernière version de &lt;em&gt;Qt&lt;/em&gt;, ainsi que de &lt;em&gt;Qt Creator&lt;/em&gt; (attention les serveurs sont surchargés) à cette &lt;a href=&quot;http://www.qtsoftware.com/downloads&quot; hreflang=&quot;fr&quot;&gt;adresse&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Je remercie toute l'équipe de nouvellement &lt;em&gt;Qt Software&lt;/em&gt; de cette nouvelle version.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie#rev-pnote-617-1&quot; id=&quot;pnote-617-1&quot;&gt;1&lt;/a&gt;] pour plus de détail voir &lt;a href=&quot;http://doc.trolltech.com/4.5/qt4-5-intro.html&quot; hreflang=&quot;fr&quot;&gt;http://doc.trolltech.com/4.5/qt4-5-intro.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie#rev-pnote-617-2&quot; id=&quot;pnote-617-2&quot;&gt;2&lt;/a&gt;] L'image du debugger viens du site &lt;em&gt;Qt Software&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/qt/changes-4.5"
      length="59463" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/03/03/Qt-4.5-est-sortie#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/617</wfw:commentRss>
      </item>
    
  <item>
    <title>XINX - Editeur de feuille de style</title>
    <link>http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier</link>
    <guid isPermaLink="false">urn:md5:970880929e6507cf3b788a388c53e206</guid>
    <pubDate>Wed, 18 Feb 2009 19:00:00 +0100</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>XINX</category>
        <category>egx</category><category>generix</category><category>generix group</category><category>nokia</category><category>qt</category><category>trolltech</category><category>xinx</category>    
    <description>&lt;p&gt;Bonjours à tous,&lt;/p&gt;


&lt;p&gt;Ce billet, parle de &lt;strong&gt;XINX&lt;/strong&gt;, un logiciel libre que j'ai développé et que je continue à développer sur mon temps libre. Le but de se billet est de présenter &lt;strong&gt;XINX&lt;/strong&gt; et d'être le début d'une longue série de billet parlant de son développement.&lt;/p&gt;


&lt;p&gt;En effet, même si le programme est propre à une utilisation particulière pour un cercle de personne restreint, les méthodes, classes, et idées utilisées dans ce programme peuvent intéresser d'autres personnes.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/.ScreenShot151_m.jpg&quot; alt=&quot;Nouvelle version de XINX&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Nouvelle version de XINX, fév. 2009&quot; /&gt;&lt;/p&gt;    &lt;h3&gt;Présentation&lt;/h3&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; est un éditeur de feuille de style sur lequel je travail depuis début 2006. En faite j'avais commencé un autre éditeur à l'aide de &lt;strong&gt;Borland/Delphi 7&lt;/strong&gt; mais il a été rapidement arrêté pour prendre une nouvelle direction dans un nouveau langage avec un nouveau départ&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#pnote-613-1&quot; id=&quot;rev-pnote-613-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Cet éditeur de feuille de style à la particularité de pouvoir être utilisé dans le cadre de mon travail&amp;nbsp;: sur l'application &lt;em&gt;eGx&lt;/em&gt; (de la société &lt;strong&gt;&lt;a href=&quot;http://www.fr.generixgroup.com&quot; hreflang=&quot;fr&quot;&gt;Générix&lt;/a&gt;&lt;/strong&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#pnote-613-2&quot; id=&quot;rev-pnote-613-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;). &lt;strong&gt;XINX&lt;/strong&gt; permet non seulement l'édition de feuille de style (XSL), en proposant une &lt;em&gt;complétion&lt;/em&gt; intuitive, mais propose également un mode projet,  dans lequel il est possible de dérivé une feuille de style plutôt que de la remplacer (de façon spécifique à notre méthode de travail en projet chez le client).&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; est un acronyme récursive&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#pnote-613-3&quot; id=&quot;rev-pnote-613-3&quot;&gt;3&lt;/a&gt;]&lt;/sup&gt; qui signifie &lt;em&gt;XINX Is Not XDME&lt;/em&gt;. Ce nom a été choisis car &lt;strong&gt;XINX&lt;/strong&gt; est le complément idéal à &lt;strong&gt;XDME&lt;/strong&gt; (l'éditeur de fichier de configuration d&lt;em&gt;'eGx&lt;/em&gt;).&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/logo_nokia_qt.png&quot; alt=&quot;Logo Nokia/Qt&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Logo Nokia/Qt, fév. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Au niveau du choix du langage, a contrario des autres applications &lt;strong&gt;Generix&lt;/strong&gt; écritent en &lt;em&gt;JAVA&lt;/em&gt;, &lt;strong&gt;XINX&lt;/strong&gt; a été programmé en &lt;em&gt;C++&lt;/em&gt;. Le framework &lt;em&gt;Qt&lt;/em&gt; de la société &lt;del&gt;Trolltech&lt;/del&gt;&lt;strong&gt;Nokia&lt;/strong&gt; a été choisis pour simplifier la programmation. Pourquoi ce choix de langage&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;XINX&lt;/strong&gt; est une application écrite sur mon temps libre, j'ai donc choisis un langage que je souhaité apprendre. En faite la raison de l'existence de &lt;strong&gt;XINX&lt;/strong&gt;, et la volonté d'apprendre à utiliser ce framework.&lt;/li&gt;
&lt;li&gt;Le framework &lt;em&gt;Qt&lt;/em&gt; est utilisé par l'environnement de bureau &lt;strong&gt;KDE&lt;/strong&gt;. Cet environnement de bureau est celui que j'utilise tous les jours, pendant mon temps libre (chez moi), sous &lt;strong&gt;Gnu/Linux&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;La version 4 de ce framework est utilisable sous &lt;strong&gt;MS/Windows&lt;/strong&gt;, sans payer de licence, dans le cadre de l'écriture d'un logiciel libre (au bureau tout nos poste sont sous &lt;strong&gt;MS/Windows&lt;/strong&gt;)&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#pnote-613-4&quot; id=&quot;rev-pnote-613-4&quot;&gt;4&lt;/a&gt;]&lt;/sup&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Architecture&lt;/h3&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/xinx/archiXINX.png&quot; alt=&quot;Architecture PNG&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;Architecture PNG, fév. 2009&quot; /&gt;&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;XINX&lt;/strong&gt; est décomposé en plusieurs parties&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;la librairie de composant (contenant un gestionnaire de plugin en Qt, un combobox pour choisir une couleur, une liste de valeur avec les boutons pour ajouter ou supprimer des éléments, une barre d'édition pour faciliter l'édition de dossier)&lt;/li&gt;
&lt;li&gt;la librairie principale (externalisant ce qui peut être nécessaire aux plugins).&lt;/li&gt;
&lt;li&gt;une série de plugin permettant, dans &lt;strong&gt;XINX&lt;/strong&gt; de
&lt;ul&gt;
&lt;li&gt;gérer CVS&lt;/li&gt;
&lt;li&gt;gérer SubVersion&lt;/li&gt;
&lt;li&gt;gérer les extentions XSL, JS, XML, HTML&lt;/li&gt;
&lt;li&gt;gérer les WebServices&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;l'application elle-même&lt;/li&gt;
&lt;li&gt;une application de migration de projet (pour migrer les fichiers projets &lt;strong&gt;XINX&lt;/strong&gt; quand ces derniers changent)&lt;/li&gt;
&lt;li&gt;une librairie gérant l'éditeur de code (l'éditeur utilisé pour la prochaine version est &lt;a href=&quot;http://qcodeedit.edyuk.org/&quot; hreflang=&quot;fr&quot;&gt;QCodeEdit&lt;/a&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#pnote-613-5&quot; id=&quot;rev-pnote-613-5&quot;&gt;5&lt;/a&gt;]&lt;/sup&gt;)&lt;/li&gt;
&lt;li&gt;les librairies du framework &lt;em&gt;Qt&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Vous pouvez une documentation sur l'écriture de &lt;a href=&quot;http://xinx.shadoware.org/wiki/XinxPlugins&quot; hreflang=&quot;fr&quot;&gt;plugins&lt;/a&gt; sur le site de &lt;strong&gt;&lt;a href=&quot;http://xinx.shadoware.org&quot; hreflang=&quot;fr&quot;&gt;XINX&lt;/a&gt;&lt;/strong&gt;  ainsi qu'une documentation au format &lt;a href=&quot;http://xinx.shadoware.org/doxygen/main.html&quot; hreflang=&quot;en&quot;&gt;Doxygen&lt;/a&gt; des librairies.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#rev-pnote-613-1&quot; id=&quot;pnote-613-1&quot;&gt;1&lt;/a&gt;] &lt;strong&gt;Borland/Delphi 7&lt;/strong&gt; étant limité à la plateforme de Microsoft, et l'application ayant pris dés le début une mauvaise direction (orienté fichier de configuration plutôt que feuille de style)&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#rev-pnote-613-2&quot; id=&quot;pnote-613-2&quot;&gt;2&lt;/a&gt;] &lt;strong&gt;Generix&lt;/strong&gt; est un éditeur de logiciel de gestion d'entreprise, dit &lt;em&gt;ERP&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#rev-pnote-613-3&quot; id=&quot;pnote-613-3&quot;&gt;3&lt;/a&gt;] Un acronyme qui contient l'acronyme même, comme &lt;strong&gt;Gnu&lt;/strong&gt; pour &lt;em&gt;Gnu Is not Unix&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#rev-pnote-613-4&quot; id=&quot;pnote-613-4&quot;&gt;4&lt;/a&gt;] &lt;strong&gt;XINX&lt;/strong&gt; est un logiciel libre non parce que je n'avais pas le choix dû à la double licence de la librairie &lt;em&gt;Qt&lt;/em&gt; mais bien par choix personnelle de développer du logiciel libre sur mon temps personnel.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#rev-pnote-613-5&quot; id=&quot;pnote-613-5&quot;&gt;5&lt;/a&gt;] QCodeEdit est un éditeur de code écrit pour Qt. Il est très performant, et possède beaucoup de fonctionnalité utile. &lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2009/02/18/Contenue-d-un-fichier#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/613</wfw:commentRss>
      </item>
    
  <item>
    <title>Nouvelles fonctionnalités de Qt Designer 4.5</title>
    <link>http://www.shadoware.org/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45</link>
    <guid isPermaLink="false">urn:md5:70738bd05352d99baffe0f66326567aa</guid>
    <pubDate>Sun, 19 Oct 2008 19:24:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Logiciels</category>
        <category>nokia</category><category>planet</category><category>qt</category><category>trolltech</category>    
    <description>    &lt;p&gt;Sur &lt;em&gt;&lt;del&gt;Trolltech&lt;/del&gt;Nokia Labs Blogs&lt;/em&gt;, Friedelann Kleint nous présente aujourd'hui les nouvelles fonctionnalités de Qt Designer 4.5&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45#pnote-610-1&quot; id=&quot;rev-pnote-610-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;


&lt;p&gt;Au menu, on peut trouver l'ajout de filtre sur l'éditeur de propriétés ainsi que sur l'inspecteur d'objet (Ce qui peut permettre de sélectionner un composant et d'en modifier les propriétés plus rapidement).&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/qtdesigner4.5/objectinspector.png&quot; alt=&quot;objectinspector.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;objectinspector.png, oct 2008&quot; /&gt;&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/qtdesigner4.5/propertyeditorfilter.png&quot; alt=&quot;propertyeditorfilter.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;propertyeditorfilter.png, oct 2008&quot; /&gt;&lt;/p&gt;


&lt;p&gt;L'arrangement de la boite à outil est également différent&amp;nbsp;:&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/qtdesigner4.5/widgetbox_iconmode.png&quot; alt=&quot;widgetbox_iconmode.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;widgetbox_iconmode.png, oct 2008&quot; /&gt;&lt;/p&gt;


&lt;p&gt;De plus il est maintenant possible de&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sélectionner l'objet ancêtre d'un &lt;em&gt;widget&lt;/em&gt; en sélectionnant &lt;em&gt;Select ancestors&lt;/em&gt; du menu contextuel.&lt;/li&gt;
&lt;li&gt;Changer le &lt;em&gt;Layout&lt;/em&gt; sans casser et reconstruire le &lt;em&gt;Layout&lt;/em&gt; de la feuille&lt;/li&gt;
&lt;li&gt;Ajouter facilement une nouvelle ligne au layout (L'action &lt;em&gt;Add form layout row&lt;/em&gt; ouvrant la boite de dialogue ci-dessous)&lt;/li&gt;
&lt;li&gt;Créer des Assistants (&lt;em&gt;Wizard&lt;/em&gt;) linéaires&lt;/li&gt;
&lt;li&gt;Désactiver la traduction de certaine chaîne.&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/public/billets/qt/qtdesigner4.5/formlayout.png&quot; alt=&quot;formlayout.png&quot; style=&quot;display:block; margin:0 auto;&quot; title=&quot;formlayout.png, oct 2008&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Enfin, pour terminer, comme le dit Friedemann&amp;nbsp;:
&lt;q&gt;The general focus of the 4.5 release is on stability and performance.&lt;/q&gt;
Soit&amp;nbsp;: Le but principal de la version 4.5 est la stabilité et les performances.&lt;/p&gt;


&lt;p&gt;Pour plus de précision, je vous conseille d'aller voir la page d'origine et/ou de télécharger la &lt;em&gt;snapshot&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45#rev-pnote-610-1&quot; id=&quot;pnote-610-1&quot;&gt;1&lt;/a&gt;] Référence : &lt;a href=&quot;http://labs.trolltech.com/blogs/2008/10/16/new-features-of-qt-designer-45/&quot; title=&quot;http://labs.trolltech.com/blogs/2008/10/16/new-features-of-qt-designer-45/&quot;&gt;http://labs.trolltech.com/blogs/200...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/610</wfw:commentRss>
      </item>
    
  <item>
    <title>QT 4.4.2 puis QT 4.4.3 sont sorties</title>
    <link>http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie</link>
    <guid isPermaLink="false">urn:md5:d8ea4848af513b7f9e2ec06ccd707535</guid>
    <pubDate>Mon, 06 Oct 2008 17:02:00 +0200</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Logiciels</category>
        <category>nokia</category><category>planet</category><category>qt</category><category>trolltech</category>    
    <description>    &lt;p&gt;En une semaine sont sortie les versions 4.4.2 et 4.4.3 de &lt;em&gt;Qt&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;La version 4.4.2 corrige de nombreux bugs (dont des fuites mémoires sur la partie &lt;em&gt;XmlPatterns&lt;/em&gt;). Vous pouvez trouver la listes des changements &lt;a href=&quot;http://www.shadoware.org/public/billets/qt/changes-4.4.2&quot;&gt;attachée&lt;/a&gt; au billet, ou dans l'archive &lt;em&gt;Qt&lt;/em&gt; se trouvant sur le site &lt;em&gt;Trolltech&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;La version 4.4.3&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie#pnote-609-1&quot; id=&quot;rev-pnote-609-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt; modifie chaque entête de fichiers, les icônes, ... pour refléter l'achat de &lt;em&gt;Trolltech&lt;/em&gt; par &lt;em&gt;Nokia&lt;/em&gt;. Par la même occasion le site de &lt;em&gt;Trolltech&lt;/em&gt; a été complètement refait (&lt;a href=&quot;http://trolltech.com&quot; hreflang=&quot;en&quot;&gt;http://trolltech.com&lt;/a&gt;).&lt;/p&gt;


&lt;p&gt;Donc si vous avez la version 4.4.2, il n'est pas nécessaire de récupérer la 4.4.3 (sauf si vous souhaiter absolument la dernière version au nom de Nokia), par contre si vous êtes encore à la version 4.4.0 ou 4.4.1, il peut être intéressant d'installer la dernière version (suivant les fonctionnalités que vous utilisez).&lt;/p&gt;


&lt;p&gt;Enfin, la question, sans réponse, est, est-ce que le site de &lt;em&gt;Trolltech&lt;/em&gt; et de &lt;em&gt;Nokia&lt;/em&gt; vont fusionner ou vont-il rester séparer&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie#pnote-609-2&quot; id=&quot;rev-pnote-609-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;&amp;nbsp;?&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie#rev-pnote-609-1&quot; id=&quot;pnote-609-1&quot;&gt;1&lt;/a&gt;] http://trolltech.com/about/news/qt-4.4.3-released&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie#rev-pnote-609-2&quot; id=&quot;pnote-609-2&quot;&gt;2&lt;/a&gt;] ce dernier est tout de même plus pratique, je trouve&lt;/p&gt;&lt;/div&gt;
</description>
    
          <enclosure url="http://www.shadoware.org/public/billets/qt/changes-4.4.2"
      length="19829" type="text/plain" />
          <enclosure url="http://www.shadoware.org/public/billets/qt/changes-4.4.3"
      length="1221" type="text/plain" />
    
    
          <comments>http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2008/09/29/QT-442-puis-QT-443-est-sortie#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/609</wfw:commentRss>
      </item>
    
  <item>
    <title>Paquet Debian et Qt</title>
    <link>http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt</link>
    <guid isPermaLink="false">urn:md5:98bc4b24cff491d05aba301c4e3acd97</guid>
    <pubDate>Mon, 08 Sep 2008 20:45:00 +0000</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Distribution</category>
        <category>debian</category><category>dépots</category><category>paquets</category><category>planet</category><category>qmake</category><category>qt</category><category>trolltech</category>    
    <description>&lt;p&gt;A titre personnel je fabrique quelques programmes en Qt. Comme j'utilise un système &lt;em&gt;Gnu/Debian&lt;/em&gt;, j'ai cherché à fabriquer des paquets pour mon système (plus pour le plaisir qu'autre chose, car la plus grande partie de mes utilisateurs sont sous &lt;em&gt;MS/Windows&lt;/em&gt;).&lt;/p&gt;


&lt;p&gt;Ce billet explique la création de paquet &lt;em&gt;Gnu/Debian&lt;/em&gt; pour des applications Qt 4 utilisant QMake&lt;/p&gt;    &lt;h3&gt;Installation des paquets&lt;/h3&gt;


&lt;p&gt;Pour la création des paquets pour des programmes utilisant &lt;code&gt;qmake&lt;/code&gt;, il faut &lt;code&gt;cdbs, dh_make, dpkg-buildpackage&lt;/code&gt;.&lt;/p&gt;

&lt;pre class=&quot;bash&quot;&gt;aptitude &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; cdbs dh-&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; fakeroot devscripts&lt;/pre&gt;


&lt;h3&gt;Création du paquet&lt;/h3&gt;


&lt;h4&gt;Préparation&lt;/h4&gt;


&lt;p&gt;Vous pouvez donc choisir un de vos programmes que vous voulez empaqueter. Pour cela vous allez commencer par nettoyer l'arborescence de votre projet pour retirer les fichiers de sauvegarde ainsi que les fichiers de construction (&lt;code&gt;*~ *.o&lt;/code&gt;, ...). Ce petit nettoyage va permettre d'avoir un paquet source &lt;em&gt;propre&lt;/em&gt;.&lt;/p&gt;


&lt;p&gt;Il faut que vous placiez les sources dans un dossier du nom de &lt;code&gt;&amp;lt;programme&amp;gt;-&amp;lt;version&amp;gt;&lt;/code&gt;.&lt;/p&gt;


&lt;p&gt;Voici un exemple de fichier projet&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;
TARGET = qgenconfig
TEMPLATE = app

CONFIG += exceptions warn_on qt
QT += xml

HEADERS += src/loadconfigimpl.h \
   src/setupfile.h \
   src/configfile.h \
   src/p_configfile.h
SOURCES += src/loadconfigimpl.cpp \
   src/setupfile.cpp \
   src/main.cpp \
   src/configfile.cpp
FORMS = ui/loadconfig.ui

DESTDIR = bin
MOC_DIR = build
OBJECTS_DIR = build
UI_DIR = build
&lt;/pre&gt;


&lt;p&gt;Pour générer le &lt;code&gt;Makefile&lt;/code&gt;, vous pouvez faire comme d'habitude&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;bash&quot;&gt;qmake-qt4 qgenconfig.pro&lt;/pre&gt;


&lt;h4&gt;Création des scripts&lt;/h4&gt;


&lt;p&gt;Pour créer les paquets, il faut un ensemble de script dans le dossier &lt;code&gt;debian&lt;/code&gt;. Pour se faciliter la vie, il est possible de créer les scripts avec &lt;code&gt;dh_make&lt;/code&gt;.&lt;/p&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;DEBFULLNAME=&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Ulrich Van Den Hekke&amp;quot;&lt;/span&gt; dh_make -e ulrich.vdh&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;@&lt;/span&gt;shadoware.org -n -s -c gpl&lt;/pre&gt;


&lt;p&gt;Voici la description de la liste des paramètres&amp;nbsp;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DEBFULLNAME&lt;/code&gt; indique le nom du mainteneur.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-e&lt;/code&gt; Permet de préciser l'email (suivis de l'email).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-n&lt;/code&gt; Produit un paquet natif pour &lt;em&gt;Gnu/Debian&lt;/em&gt; (quand l'auteur fait ses paquets lui-même).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-s&lt;/code&gt; Indique que le paquet ne va contenir qu'un simple exécutable (si vous voulez faire plusieurs paquets, il suffit de ne pas mettre cette option).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-c&lt;/code&gt; Indique la licence d'utilisation (ici &lt;code&gt;gpl&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Vous pouvez ensuite supprimer les fichiers exemples (mais pas nécessairement si vous voulez les étudier).&lt;/p&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;rm&lt;/span&gt; debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/*&lt;/span&gt;.ex  debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/*&lt;/span&gt;.EX  debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;docs  debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;dirs&lt;/span&gt;&lt;/pre&gt;


&lt;h5&gt;Paquet simple&lt;/h5&gt;


&lt;p&gt;Nous allons commencer par créer un paquet simple. Cela signifie qu'il n'y aura qu'un seul exécutable dans le paquet (pas de librairie, ...).&lt;/p&gt;


&lt;p&gt;Dans le fichier &lt;code&gt;control&lt;/code&gt;, il faut que vous renseignez les informations du paquet que vous allez créer.&lt;/p&gt;

&lt;pre&gt;
Source: qgenconfig
Section: devel
Priority: extra
Maintainer: Ulrich Van Den Hekke &amp;lt;ulrich.vdh@shadoware.org&amp;gt;
Build-Depends: debhelper (&amp;gt;= 7)
Standards-Version: 3.7.3
Homepage: http://projects.shadoware.org/qgenconfig

Package: qgenconfig
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Create a config class in Qt after loading a XML file.
 Load an XML description file of a settings object and create a class
 that can be used to load and save information in a QSettings class. To
 load information structure are used.
&lt;/pre&gt;


&lt;p&gt;Dans le paquet ci-dessus, on créait un paquet binaire et un paquet source. Les variables de dépendance (dans &lt;code&gt;Depends&lt;/code&gt;) sont remplacées automatiquement à la génération du paquet. La description est celle écrite dans &lt;code&gt;aptitude&lt;/code&gt;. La première ligne est la description courte, les suivantes (précédées d'un espace) sont la description longue.&lt;/p&gt;


&lt;p&gt;Ensuite on va remplacer le fichier &lt;code&gt;debian/rules&lt;/code&gt; en utilisant &lt;code&gt;cdbs&lt;/code&gt;&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/usr/bin/make -f&lt;/span&gt;
include &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;cdbs&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;rules&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debhelper.mk
include &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;cdbs&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;class&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;qmake.mk
&lt;span style=&quot;color: #007800;&quot;&gt;QMAKE=&lt;/span&gt;qmake-qt4
&amp;nbsp;
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;qgenconfig::
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;DEB_DESTDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;DEB_DESTDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;qgenconfig $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;DEB_DESTDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;En premier lieu on définit les variables pour la compilation, puis ensuite on définit les opérations d'installations dans la cible &lt;code&gt;install/qgenconfig&lt;/code&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt#pnote-36-1&quot; id=&quot;rev-pnote-36-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;.
Dans les opérations, vous allez copier votre exécutable dans le dossier de génération de debian (dossier &lt;code&gt;debian/&amp;lt;cible&amp;gt;&lt;/code&gt;).&lt;/p&gt;


&lt;h5&gt;Paquet multiple&lt;/h5&gt;


&lt;p&gt;Créer plusieurs paquets à partir d'une même source avec &lt;code&gt;cdbs&lt;/code&gt; est assez simple. Il suffit de rajouter des cibles, correspondantes au fichier &lt;code&gt;control&lt;/code&gt;, dans le fichier &lt;code&gt;rules&lt;/code&gt; .&lt;/p&gt;


&lt;p&gt;Dans le fichier de &lt;code&gt;control&lt;/code&gt; on va avoir plusieurs paquets binaires pour un seul paquet source.&lt;/p&gt;

&lt;pre&gt;
Source: xinx
Section: devel
Priority: extra
Maintainer: Ulrich Van Den Hekke &amp;lt;xinx@shadoware.org&amp;gt;
Build-Depends: debhelper (&amp;gt;= 7)
Standards-Version: 3.7.3
Homepage: http://xinx.shadoware.org/

Package: xinx
Section: devel
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, xinx-scripts (&amp;gt;= 0.7.2.0)
Recommends: xinx-plugins-services, xinx-plugins-cvs, xinx-plugins-svn
Suggests: xinx-doc
Description: XSL/JS/HTML editor for Generix
 XINX is an editor of XSL stylesheet, JavaScript, Cascading Style Sheet.
 This editor is used with egx.

Package: xinx-doc
Section: doc
Architecture: all
Depends: xinx (&amp;gt;= 0.7.2.0)
Description: Documentation for xinx
 Technical Documentation of XINX
&lt;/pre&gt;


&lt;p&gt;Nous allons définir dans le fichier &lt;code&gt;rules&lt;/code&gt; les différentes cibles que nous avons dans le fichier &lt;code&gt;control&lt;/code&gt;&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt#pnote-36-2&quot; id=&quot;rev-pnote-36-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;.&lt;/p&gt;

&lt;pre class=&quot;bash&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/usr/bin/make -f&lt;/span&gt;
include &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;cdbs&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;rules&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debhelper.mk
include &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;cdbs&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;class&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;qmake.mk
&lt;span style=&quot;color: #007800;&quot;&gt;QMAKE=&lt;/span&gt;qmake-qt4 project.pro
&amp;nbsp;
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx::
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinxprojectwizard&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinxprojectwizard $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; -a $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libxinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libsharedxinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;*&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; -a $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;components&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libxinxcmp&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;*&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc::
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; -a $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/*&lt;/span&gt; $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;
	&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;rm&lt;/span&gt; -rf $&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;CURDIR&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;xinx-doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;html&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;.svn&lt;/pre&gt;


&lt;p&gt;Ici on génère deux paquets, le paquet binaire et la documentation.&lt;/p&gt;


&lt;h4&gt;Génération du paquet&lt;/h4&gt;


&lt;h5&gt;Mise à jour des informations du paquets&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Pour modifier le changelog sur la version courante&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;dch -a&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Pour créer une nouvelle version&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;dch -i&lt;/pre&gt;


&lt;h5&gt;Création du paquet&lt;/h5&gt;


&lt;pre&gt;dpkg-buildpackage -rfakeroot&lt;/pre&gt;


&lt;p&gt;L'application va signer le paquet s'il trouve la clé assignée à l'utilisateur.&lt;/p&gt;


&lt;h3&gt;Création d'un dépôt&lt;/h3&gt;


&lt;p&gt;Après avoir créé des paquets, il peut-être intéressant de créer un dépôt pour installer ces paquets. voici la marche à suivre pour créer le dépôt.&lt;/p&gt;


&lt;p&gt;Sur votre serveur internet (nous ne parlerons pas ici de la mise à disposition sur Internet), vous allez devoir créer un dossier contenant votre référentiel (exemple&amp;nbsp;: &lt;code&gt;/www/sites/apt&lt;/code&gt;).&lt;/p&gt;


&lt;h4&gt;Création de l'arborescence&lt;/h4&gt;


&lt;p&gt;Vous allez devoir créer une arborescence comme suite&amp;nbsp;:&lt;/p&gt;


&lt;pre&gt;dists
   +- main 
       |- binary-i386
       |- binary-amd64
       +- source&lt;/pre&gt;


&lt;p&gt;Parmi les fichiers générés vous allez devoir mettre le fichier &lt;code&gt;.deb&lt;/code&gt; dans le dossier binaire, et les fichiers &lt;code&gt;.changes&lt;/code&gt;, &lt;code&gt;.dsc&lt;/code&gt;, et &lt;code&gt;.tar.gz&lt;/code&gt; dans le dossier &lt;code&gt;source&lt;/code&gt;.&lt;/p&gt;


&lt;h4&gt;Création d'un fichier apt-ftparchive.conf&lt;/h4&gt;


&lt;p&gt;Nous allons commencer par créer un fichier &lt;code&gt;apt-ftparchive.conf&lt;/code&gt;  dans lequel nous allons définir les fichiers à créer.&lt;/p&gt;

&lt;pre&gt;
Dir {
	ArchiveDir &amp;quot;.&amp;quot;;
	CacheDir &amp;quot;.&amp;quot;;
};

Tree &amp;quot;dists/unstable&amp;quot; {
	Sections &amp;quot;main&amp;quot;;
	Architectures &amp;quot;amd64 source&amp;quot;;
};

BinDirectory &amp;quot;dists/unstable/main/binary-amd64&amp;quot; {
	Packages &amp;quot;dists/unstable/main/binary-amd64/Packages&amp;quot;;
	Contents &amp;quot;dists/unstable/Contents-amd64&amp;quot;;
	SrcPackages &amp;quot;dists/unstable/main/source/Sources&amp;quot;;
};
&lt;/pre&gt;


&lt;h4&gt;Création du fichier apt-unstable-release.conf&lt;/h4&gt;

&lt;pre&gt;
APT::FTPArchive::Release::Origin	&amp;quot;shadoware.org&amp;quot;;
APT::FTPArchive::Release::Label		&amp;quot;shadoware.org&amp;quot;;
APT::FTPArchive::Release::Suite		&amp;quot;unstable&amp;quot;;
APT::FTPArchive::Release::Codename	&amp;quot;unstable&amp;quot;;
APT::FTPArchive::Release::Architectures	&amp;quot;amd64 source&amp;quot;;
APT::FTPArchive::Release::Components	&amp;quot;main&amp;quot;;
APT::FTPArchive::Release::Description	&amp;quot;Paquets du site Shadoware.Org&amp;quot;;
&lt;/pre&gt;


&lt;h4&gt;Création du fichier update-archive.sh&lt;/h4&gt;


&lt;p&gt;Ce fichier est celui que l'on doit exécuter pour la génération du contenu de l'arborescence&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;bash&quot;&gt;apt-ftparchive generate apt-ftparchive.conf
apt-ftparchive -c apt-unstable-release.conf release dists&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;unstable &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; dists&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;unstable&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;Release&lt;/pre&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt#rev-pnote-36-1&quot; id=&quot;pnote-36-1&quot;&gt;1&lt;/a&gt;] D'autres cibles sont disponibles (cf la doc de &lt;code&gt;cdbs&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt#rev-pnote-36-2&quot; id=&quot;pnote-36-2&quot;&gt;2&lt;/a&gt;] A cause d'un bogue, ou d'une mauvaise utilisation, la variable &lt;code&gt;$(DEB_DESTDIR)&lt;/code&gt; ne me ramenait pas la bonne valeur, je l'ai donc remplacée par &lt;code&gt;$(CURDIR)/debian&lt;/code&gt;.&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2008/09/08/45-paquet-debian-et-qt#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/36</wfw:commentRss>
      </item>
    
  <item>
    <title>Mémo Qt</title>
    <link>http://www.shadoware.org/post/2008/01/21/42-qabstractitemmodel-qt</link>
    <guid isPermaLink="false">urn:md5:53141e35fc9be789b2dcf98bfbf07cb9</guid>
    <pubDate>Mon, 21 Jan 2008 20:06:00 +0000</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>C++</category>
        <category>cmake</category><category>model</category><category>planet</category><category>qt</category>    
    <description>&lt;p&gt;Ceci est un petit mémo pour me permettre de ne pas oublier quelques astuces lors de la programmation avec Qt. En parlant de cela, je me suis commandé le livre suivant&amp;nbsp;: &lt;a href=&quot;http://www.amazon.fr/GUI-Programming-Qt4-Jasmin-Blanchette/dp/0132354160/ref=sr_11_1?ie=UTF8&amp;amp;qid=1199972515&amp;amp;sr=11-1&quot; hreflang=&quot;en&quot;&gt;C++ GUI Programming with Qt4&lt;/a&gt;.&lt;/p&gt;    &lt;h3&gt;QAbstractItemModel&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Lors de l'insertion (avec beginInsertRows()), les éléments insérés ne doivent pas contenir de sous éléments (rowCount() == 0) sous peine de causer des plantages.&lt;/li&gt;
&lt;li&gt;Un model de donnée interne, pouvant être utilisé avec QAbstractItemModel pour afficher une arborescence et étant capable de se rafraîchir à la lecture d'un fichier, se trouve dans les fichiers &lt;a href=&quot;http://xinx.shadoware.org/browser/branches/v0.7.0/libxinx/filecontentstructure.cpp&quot; hreflang=&quot;fr&quot;&gt;filecontentstructure.cpp&lt;/a&gt; et &lt;a href=&quot;http://xinx.shadoware.org/browser/branches/v0.7.0/libxinx/filecontentstructure.h&quot; hreflang=&quot;fr&quot;&gt;filecontentstructure.h&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;CMake et Qt&lt;/h3&gt;


&lt;h4&gt;Compilation d'une librairie static&lt;/h4&gt;


&lt;pre&gt;add_definitions(-DQT_SHARED)
add_library(xinxplugins STATIC ${xinxplugins_SRCS} ${xinxplugins_MOC_SRCS})&lt;/pre&gt;


&lt;h4&gt;Compilation d'un plugin&lt;/h4&gt;


&lt;h5&gt;dynamique&lt;/h5&gt;


&lt;pre&gt;add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_NO_DEBUG)
add_definitions(-DQT_SHARED)
add_library(webplugin SHARED ${webplugin_SRCS} ${webplugin_MOC_SRCS})&lt;/pre&gt;


&lt;h5&gt;static&lt;/h5&gt;


&lt;pre&gt;?&lt;/pre&gt;


&lt;h4&gt;Compilation de fichier RC pour Windows&lt;/h4&gt;


&lt;pre&gt;if(WIN32)
       add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xinx_ico.obj
               COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/xinx_ico.obj -i${CMAKE_CURRENT_SOURCE_DIR}/${xinx_RCS}
       )
       set(xinx_RESS ${CMAKE_CURRENT_BINARY_DIR}/xinx_ico.obj)
endif(WIN32)&lt;/pre&gt;</description>
    
    
    
          <comments>http://www.shadoware.org/post/2008/01/21/42-qabstractitemmodel-qt#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2008/01/21/42-qabstractitemmodel-qt#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/33</wfw:commentRss>
      </item>
    
  <item>
    <title>De retour</title>
    <link>http://www.shadoware.org/post/2007/08/04/25-de-retour</link>
    <guid isPermaLink="false">urn:md5:f930020e8cded8b402f64cb4783501e2</guid>
    <pubDate>Sat, 04 Aug 2007 10:45:00 +0000</pubDate>
    <dc:creator>Ulrich Van Den Hekke</dc:creator>
        <category>Ma Vie</category>
        <category>dédié</category><category>kde</category><category>qt</category><category>raid</category><category>vie</category>    
    <description>&lt;p&gt;Salut tout le monde,&lt;/p&gt;


&lt;p&gt;Cela fait très longtemps que je n'ai pas écrit sur ce blog&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-1&quot; id=&quot;rev-pnote-23-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;. Donc me voilà de retour à écrire quelques lignes.
Bon, je suis sûr que ma vie ne vous intéresse pas et que vous vous foutez de mon voyage à &lt;a href=&quot;http://ulrich.vdh.free.fr/blog/index.php?gallery/vie-courrante/la-rochelle&quot; hreflang=&quot;fr&quot;&gt;La Rochelle&lt;/a&gt; ou de celui que j'ai fait à &lt;a href=&quot;http://ulrich.vdh.free.fr/blog/index.php?gallery/vie-courrante/tours&quot; hreflang=&quot;fr&quot;&gt;Tours&lt;/a&gt;, mais je vais quand même vous en parler un peu.  Mais rien qu'un peu.&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-1&quot; id=&quot;pnote-23-1&quot;&gt;1&lt;/a&gt;] Et certaines personnes sont là pour me le faire constater &lt;img src=&quot;/dotclear/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;&lt;/div&gt;
    &lt;h3&gt;Les aléas du métier&lt;/h3&gt;


&lt;p&gt;Donc il y a environ 2 mois de cela, j'étais parti en clientel en Belgique. Bon, même si de par chez moi, la Belgique n'est pas loin, Bruxelles est quand même à 1 heure et demi de route. J'ai donc fait l'aller-retour presque tous les jours, et je n'ai pas trouvé beaucoup le temps d'écrire&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-1&quot; id=&quot;rev-pnote-23-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;. Dur de rester éveillé avec 3 heures de voiture par jour, pendant plus d'un mois et demi .... Ce projet ne m'a, bien sûr, pas déplu, ayant appris pas mal de choses au cours de ce mois et demi, même si parfois il y avait un peu de pression dans la cocotte.
Ensuite après cela, je me suis retrouvé sur un autre projet&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-2&quot; id=&quot;rev-pnote-23-2&quot;&gt;2&lt;/a&gt;]&lt;/sup&gt;, qui me prenaient jusqu'ici un peu (euphémisme ...) de temps. Je suis d'ailleurs pour l'instant toujours sur ce projet, projet que j'apprécie également.&lt;/p&gt;


&lt;p&gt;Bref le soir, un peu crevé, je n'écris pas sur mon blog, et le week-end ....&lt;/p&gt;


&lt;h3&gt;Qt4&lt;/h3&gt;


&lt;p&gt;Depuis quelques temps je m'intéresse à &lt;a href=&quot;http://trolltech.com/products/qt&quot; hreflang=&quot;en&quot;&gt;Qt4&lt;/a&gt; de la société &lt;a href=&quot;http://trolltech.com/&quot; hreflang=&quot;en&quot;&gt;Trolltech&lt;/a&gt;. Qt est un toolkit graphique permettant le développement d'application multi-plateforme (pour ceux qui ne connaissent pas). Qt est le toolkit graphique utilisé par l'environnement &lt;a href=&quot;http://www.kde.org/&quot; hreflang=&quot;en&quot;&gt;KDE&lt;/a&gt; sous Gnu/Linux.&lt;/p&gt;


&lt;p&gt;Jusqu'ici KDE 3.5 utilisait la bibliothèque Qt3. Cette bibliothèque permettait le développement d'application libre&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-3&quot; id=&quot;rev-pnote-23-3&quot;&gt;3&lt;/a&gt;]&lt;/sup&gt; sous Linux, et devenait payante pour des développements d'applications Windows (libre ou non) ainsi que pour faire des applications commerciales (Linux ou non).&lt;/p&gt;


&lt;p&gt;La version 4 de Qt permet quant à elle la création d'application Windows et Linux sous licence libre&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-4&quot; id=&quot;rev-pnote-23-4&quot;&gt;4&lt;/a&gt;]&lt;/sup&gt; à l'aide d'une version Opensource de Qt. Par contre pour le développement d'application commercial, il faut toujours payer une licence à la société Trolltech. (Un prêté pour un rendu). Cette bibliothèque est la base du future KDE 4.&lt;/p&gt;


&lt;p&gt;J'ai donc décidé de m'intéresser à cette bibliothèque, et d'apprendre à l'utiliser. J'avais d'ailleurs écrit une application sous KDE 3 en utilisant l'ancienne version de Qt (programme dont je parle ici). Ce programme n'avance malheureusement pas beaucoup. Je n'en ai pas trop la motivation en ce moment&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-5&quot; id=&quot;rev-pnote-23-5&quot;&gt;5&lt;/a&gt;]&lt;/sup&gt;. J'espère ainsi, en apprenant à utiliser cette techno qu'est Qt4 de pouvoir écrire plus tard des applications pour le futur KDE4&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-6&quot; id=&quot;rev-pnote-23-6&quot;&gt;6&lt;/a&gt;]&lt;/sup&gt;&lt;/p&gt;


&lt;p&gt;Pour cela je me suis lancé dans l'écriture d'une application en Qt4. Cette application étant projet personnel, n'est diffusée qu'à un nombre restreint de personne, pour le moment. Ce programme en Qt4 essaie d'utiliser toute la puissance du toolkit graphique&lt;sup&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#pnote-23-7&quot; id=&quot;rev-pnote-23-7&quot;&gt;7&lt;/a&gt;]&lt;/sup&gt;. J'utilise les outils pour faire de la Complétion, pour faire de la coloration syntaxique, surveillance de la modification des fichiers, Thread, Processus, Model/View, .... Le but de l'application est un éditeur XSL et Javascript, un peu avancé. Je peux toujours vous montrer une petite capture d'écran, qui ne vous donne qu'un petit aperçu.&lt;/p&gt;


&lt;p&gt;&lt;img src=&quot;http://www.shadoware.org/blog/images/xinx/xinx1.png&quot; alt=&quot;Capture d&amp;#039;écran de XINX&quot; style=&quot;display:block; margin:0 auto;&quot; /&gt;&lt;/p&gt;


&lt;p&gt;Mouais, pas très nette cette photo ....&lt;/p&gt;


&lt;p&gt;Je passe donc depuis quelques temps déjà quelques heures le soir, et quelques heures le Week-end à écrire cet éditeur de fichier XML et Javascript. J'y ai même écris un petit module WebServices (qui ne comprend pas tout, mais bon ...).  Bon celle-ci possède encore quelques malheureux bugs, mais à part cela elle est tout à fait fonctionnelle.&lt;/p&gt;


&lt;h3&gt;Projets&lt;/h3&gt;


&lt;h4&gt;C'est RAID&lt;/h4&gt;


&lt;p&gt;Comme j'en ai déjà parlé précédemment, j'ai monté mes disques durs sur un RAID 1. Lors de coupure de courant (ou après le plantage de Gnu/Linux lors du réveil d'une mise en veille), le RAID se reconstruit. La reconstruction du RAID prend un peu de temps (presque deux heures). Je n'ai pour l'instant trouvé aucune application graphique qui permettrait de voir que le système reconstruit son RAID, où il en est, .... . Pour l'instant je dois faire un &lt;code&gt;cat /proc/mdstat&lt;/code&gt; pour avoir toutes ces informations.&lt;/p&gt;


&lt;p&gt;J'ai donc bien envie d'écrire un petit outil graphique qui permettrait de voir cela rapidement (EVMS ne me convient pas).&lt;/p&gt;


&lt;p&gt;Enfin j'ai bien envie de faire marcher cette mise en veille, continuer un peu le programme que je nomme XINX.&lt;/p&gt;


&lt;h4&gt;Serveur dédié&lt;/h4&gt;


&lt;p&gt;Je réfléchis également à l'utilité d'avoir son propre serveur dédié. Je pense par exemple au billet suivant sur le site &lt;a href=&quot;http://linuxfr.org/comments/854857.html#854857&quot; hreflang=&quot;fr&quot;&gt;LinuxFR&lt;/a&gt; qui parle du serveur dédié http://www.kimsufi.com/&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hébergement site&lt;/li&gt;
&lt;li&gt;Stockage d'un Subversion pour mes différents projets&lt;/li&gt;
&lt;li&gt;Un serveur IMAP me permettant d'accéder à mes mails perso de n'importe où&lt;/li&gt;
&lt;li&gt;Backup crypté.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quel est également l'utilité par rapport à un serveur tournant 24h/24 dans son chez soi&amp;nbsp;?&lt;/p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;h4&gt;Notes&lt;/h4&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-1&quot; id=&quot;pnote-23-1&quot;&gt;1&lt;/a&gt;] Bien que sans ça, je n'aurais pas forcément trouvé le temps non plus&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-2&quot; id=&quot;pnote-23-2&quot;&gt;2&lt;/a&gt;] qui me permet de changer un peu des habituels projets.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-3&quot; id=&quot;pnote-23-3&quot;&gt;3&lt;/a&gt;] sous licence GPL&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-4&quot; id=&quot;pnote-23-4&quot;&gt;4&lt;/a&gt;] toujours GPL&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-5&quot; id=&quot;pnote-23-5&quot;&gt;5&lt;/a&gt;] surtout que je vois des applications tel que Clonzilla, Partimage, ... qui fonctionnent très bien, ils ne leur manquent plus qu'une bonne interface graphique &lt;img src=&quot;/dotclear/themes/default/smilies/wink.png&quot; alt=&quot;;)&quot; class=&quot;smiley&quot; /&gt;&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-6&quot; id=&quot;pnote-23-6&quot;&gt;6&lt;/a&gt;] Même si je n'écris pas énormément d'application pour la communauté, j'ai toujours la profonde motivation de le faire. Il ne reste plus qu'à trouver le projet qui me motive suffisamment.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;http://www.shadoware.org/post/2007/08/04/25-de-retour#rev-pnote-23-7&quot; id=&quot;pnote-23-7&quot;&gt;7&lt;/a&gt;] que je parle bien moi !!&lt;/p&gt;&lt;/div&gt;
</description>
    
    
    
          <comments>http://www.shadoware.org/post/2007/08/04/25-de-retour#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/post/2007/08/04/25-de-retour#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/feed/atom/comments/23</wfw:commentRss>
      </item>
    
</channel>
</rss>
