<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://www.shadoware.org/index.php/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 - Tag - trolltech</title>
  <link>http://www.shadoware.org/index.php/</link>
  <atom:link href="http://www.shadoware.org/index.php/feed/tag/trolltech/rss2" rel="self" type="application/rss+xml"/>
  <description>Moi, mes idées, mes logiciels ...</description>
  <language>fr</language>
  <pubDate>Tue, 27 Jul 2010 05:56:41 +0200</pubDate>
  <copyright>Ulrich VANDENHEKKE</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>[Qt] Transformation d'une vue tableau en une vue hiérarchique</title>
    <link>http://www.shadoware.org/index.php/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>Logiciels libres</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/index.php/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/index.php/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&quot;&gt;virtual QModelIndex index&lt;span style=&quot;color: #66cc66;&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: #993333;&quot;&gt;int&lt;/span&gt; column, &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt; QModelIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;amp;&lt;/span&gt; parent &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;;
virtual QModelIndex parent&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;amp;&lt;/span&gt; index &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;;
&amp;nbsp;
virtual &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; rowCount&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;amp;&lt;/span&gt; parent &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;;
virtual &lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; columnCount&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;amp;&lt;/span&gt; parent &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; QModelIndex&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;;
&amp;nbsp;
virtual QModelIndex mapFromSource &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;amp;&lt;/span&gt; sourceIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&lt;/span&gt;;
virtual QModelIndex mapToSource &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;amp;&lt;/span&gt; proxyIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333;&quot;&gt;const&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;struct&lt;/span&gt; Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; id, parrentId;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; index, parentIndex;
	QVector&amp;lt;int&amp;gt; source_rows;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;;
&lt;span style=&quot;color: #993333;&quot;&gt;typedef&lt;/span&gt; QMap&amp;lt;int,Mapping&lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;&amp;gt; IndexMap;
&amp;nbsp;
IndexMap m_sourcesIndexMapping;
QHash&amp;lt;int,int&amp;gt; m_categoryIdMapping;&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&quot;&gt;qDeleteAll&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; m_sourcesIndexMapping &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;clear&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
m_categoryIdMapping.&lt;span style=&quot;color: #202020;&quot;&gt;clear&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; source_rows &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;rowCount&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt;; i &amp;lt; source_rows; &lt;span style=&quot;color: #66cc66;&quot;&gt;++&lt;/span&gt;i &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; new Mapping;
	IndexMap&lt;span style=&quot;color: #66cc66;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; it &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; IndexMap&lt;span style=&quot;color: #66cc66;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; i, m &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;index &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; i;
	m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;parrentId &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;
	m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;parentIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;
&amp;nbsp;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; i &amp;gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
		QSqlRecord record &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;record&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
		m_categoryIdMapping&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; list_id &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;toInt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; i;
		m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; record.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; list_id &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;toInt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// Create the root Item&lt;/span&gt;
		m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;id &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;
		m_categoryIdMapping&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt;;
	&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;; i &amp;lt; source_rows; &lt;span style=&quot;color: #66cc66;&quot;&gt;++&lt;/span&gt;i &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	QSqlRecord record &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;record&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; parentCategoryId &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; record.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; list_parentid &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;toInt&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; parentCategoryIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_categoryIdMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; parentCategoryId, &lt;span style=&quot;color: #cc66cc;&quot;&gt;-2&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	Q_ASSERT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; parentCategoryIndex &amp;gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-2&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	mapping&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;parentIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; parentCategoryIndex;
	mapping&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;parrentId   &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; parentCategoryId;
&amp;nbsp;
	Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; categoryMapping &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; parentCategoryIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	categoryMapping&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; i &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #66cc66;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!&lt;/span&gt; sourceIndex.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!=&lt;/span&gt; m_sourceModel &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	qWarning&lt;span style=&quot;color: #66cc66;&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: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #66cc66;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; row &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; sourceIndex.&lt;span style=&quot;color: #202020;&quot;&gt;row&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
IndexMap&lt;span style=&quot;color: #66cc66;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; it &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; row &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
Q_ASSERT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; it &lt;span style=&quot;color: #66cc66;&quot;&gt;!=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constEnd&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; parentRow &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; it.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;parentIndex;
IndexMap&lt;span style=&quot;color: #66cc66;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; parentIt &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; parentRow &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
Q_ASSERT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; parentIt &lt;span style=&quot;color: #66cc66;&quot;&gt;!=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constEnd&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; parentIt.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; proxyRow    &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;indexOf&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; row &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; proxyColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; sourceColumnToProxy&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; proxyColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; createIndex&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; proxyRow, proxyColumn, &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;parentIt &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!&lt;/span&gt; proxyIndex.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!=&lt;/span&gt; this &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	qWarning&lt;span style=&quot;color: #66cc66;&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: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #66cc66;&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&quot;&gt;Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; static_cast&amp;lt;Mapping&lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;&amp;gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; proxyColumnToSource&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceRow &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;at&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;index&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRow, sourceColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; row &amp;lt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; || &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; column &amp;lt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;IndexMap&lt;span style=&quot;color: #66cc66;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #202020;&quot;&gt;const_iterator&lt;/span&gt; it &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
QModelIndex sourceParent &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; mapToSource&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; parent &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	it &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constFind&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #66cc66;&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&quot;&gt;Q_ASSERT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; it &lt;span style=&quot;color: #66cc66;&quot;&gt;!=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;constEnd&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;lt;&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; row &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; createIndex&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; row, column, &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;it &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; m &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; static_cast&amp;lt;Mapping&lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;&amp;gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceRow &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;index;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRow &lt;span style=&quot;color: #66cc66;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
QModelIndex sourceParent &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourceModel&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;index&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRow, proxyColumnToSource&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
QModelIndex proxyParent &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; mapFromSource&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceParent &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; proxyParent;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;!&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;isValid&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; rootMapping &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; rootMapping&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;
	Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; parrentMapping &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; static_cast&amp;lt;Mapping&lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt;&amp;gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	&lt;span style=&quot;color: #993333;&quot;&gt;int&lt;/span&gt; sourceRowIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; parrentMapping&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;at&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
	Mapping &lt;span style=&quot;color: #66cc66;&quot;&gt;*&lt;/span&gt; rowMapping &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; m_sourcesIndexMapping.&lt;span style=&quot;color: #202020;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceRowIndex &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; rowMapping&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&amp;gt;source_rows.&lt;span style=&quot;color: #202020;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&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&quot;&gt;&lt;span style=&quot;color: #66cc66;&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; proxyColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&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&quot;&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sourceColumn &lt;span style=&quot;color: #66cc66;&quot;&gt;==&lt;/span&gt; list_name &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;
&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;-1&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/index.php/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/index.php/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/index.php/feed/atom/comments/623</wfw:commentRss>
      </item>
    
  <item>
    <title>XINX 0.8.0.0</title>
    <link>http://www.shadoware.org/index.php/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;/themes/shadoware/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&quot;&gt;obj.&lt;span style=&quot;color: #006600;&quot;&gt;beforeSave&lt;/span&gt; = &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #006600;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
obj.&lt;span style=&quot;color: #006600;&quot;&gt;run&lt;/span&gt; = &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&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: #003366; font-weight: bold;&quot;&gt;new&lt;/span&gt; DocumentSearch&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; textEdit &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;
&amp;nbsp;
	search.&lt;span style=&quot;color: #006600;&quot;&gt;options&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;regExp&lt;/span&gt; = &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;true&lt;/span&gt;;
	search.&lt;span style=&quot;color: #006600;&quot;&gt;searchText&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;;
	search.&lt;span style=&quot;color: #006600;&quot;&gt;replaceText&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;;
&amp;nbsp;
	&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; search.&lt;span style=&quot;color: #006600;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&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&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; apt-cache search xinx
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; aptitude &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/index.php/post/2009/03/06/XINX-0.8.0.0#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/index.php/post/2009/03/06/XINX-0.8.0.0#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/index.php/feed/atom/comments/618</wfw:commentRss>
      </item>
    
  <item>
    <title>XINX - Editeur de feuille de style</title>
    <link>http://www.shadoware.org/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/post/2009/02/18/Contenue-d-un-fichier#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/index.php/post/2009/02/18/Contenue-d-un-fichier#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/index.php/feed/atom/comments/613</wfw:commentRss>
      </item>
    
  <item>
    <title>Nouvelles fonctionnalités de Qt Designer 4.5</title>
    <link>http://www.shadoware.org/index.php/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 libres</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/index.php/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/index.php/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>
    
          <enclosure url="http://www.shadoware.org/public/billets/qt/qtdesigner4.5/objectinspector.png"
      length="19868" type="image/png" />
          <enclosure url="http://www.shadoware.org/public/billets/qt/qtdesigner4.5/propertyeditorfilter.png"
      length="15094" type="image/png" />
          <enclosure url="http://www.shadoware.org/public/billets/qt/qtdesigner4.5/widgetbox_iconmode.png"
      length="40180" type="image/png" />
          <enclosure url="http://www.shadoware.org/public/billets/qt/qtdesigner4.5/formlayout.png"
      length="12589" type="image/png" />
    
    
          <comments>http://www.shadoware.org/index.php/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/index.php/post/2008/10/19/Nouvelles-fonctionnalites-de-Qt-Designer-45#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/index.php/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/index.php/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 libres</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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/post/2008/09/29/QT-442-puis-QT-443-est-sortie#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/index.php/post/2008/09/29/QT-442-puis-QT-443-est-sortie#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/index.php/feed/atom/comments/609</wfw:commentRss>
      </item>
    
  <item>
    <title>Paquet Debian et Qt</title>
    <link>http://www.shadoware.org/index.php/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>Logiciels libres</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/index.php/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/index.php/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/index.php/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/index.php/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/index.php/post/2008/09/08/45-paquet-debian-et-qt#comment-form</comments>
      <wfw:comment>http://www.shadoware.org/index.php/post/2008/09/08/45-paquet-debian-et-qt#comment-form</wfw:comment>
      <wfw:commentRss>http://www.shadoware.org/index.php/feed/atom/comments/36</wfw:commentRss>
      </item>
    
</channel>
</rss>