<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[QElectroTech — Edition élément embarqué et état modifié]]></title>
		<link>https://qelectrotech.org/forum/viewtopic.php?id=1487</link>
		<atom:link href="https://qelectrotech.org/forum/extern.php?action=feed&amp;tid=1487&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Edition élément embarqué et état modifié.]]></description>
		<lastBuildDate>Wed, 18 Sep 2019 18:40:40 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Edition élément embarqué et état modifié]]></title>
			<link>https://qelectrotech.org/forum/viewtopic.php?pid=10602#p10602</link>
			<description><![CDATA[<p> Bonsoir,</p><p>quand tu modifies un élément embarqué depuis le widget collection / Project /éléments embarqués tu n&#039;as aucune vérification, ton élément sera écrasé et tu verras la différence à la ré ouverture du projet qu&#039; a condition que tu l&#039;ais sauvegardé.<br />Car son UUID ne sera pas modifié par l’éditeur lors de l&#039;enregistrement, et donc pour le programme l’élément est le même donc ton projet ne sera pas marqué modifié!<br />C&#039;est très utile à condition de savoir ce que l&#039;on fait!</p><p>Le mieux est d’éditer ton élément puis de le sauvegarder dans ta collection user puis de le drag and drop n&#039;importe ou dans ton projet juste pour lancer ImportElementDialog qui te proposera plusieurs solutions, remplacer l’élément, faire cohabiter les deux versions, etc, et là le projet sera marqué comme modifié. Apres tu peux supprimer l&#039;élément que tu viens juste de drag and drop.</p><p>Comme tu le vois tu a deux méthodes une plus rapide et sans vérification, l&#039;autre un peu plus longue mais plus sure.</p><br /><div class="codebox"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">//Element already exist in the embedded collection, we ask what to do to user</span><br />&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>m_elements_collection<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>exist<span style="color: #008000;">&#40;</span>import_path<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ElementsLocation existing_location<span style="color: #008000;">&#40;</span>import_path, <span style="color: #0000dd;">this</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">//@existing_location and @location have the same uuid, so it is the same element</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>existing_location.<span style="color: #007788;">uuid</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> location.<span style="color: #007788;">uuid</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> existing_location<span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; ImportElementDialog ied<span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>ied.<span style="color: #007788;">exec</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> QDialog<span style="color: #008080;">::</span><span style="color: #007788;">Accepted</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QET<span style="color: #008080;">::</span><span style="color: #007788;">Action</span> action <span style="color: #000080;">=</span> ied.<span style="color: #007788;">action</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">//Use the exisitng element</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>action <span style="color: #000080;">==</span> QET<span style="color: #008080;">::</span><span style="color: #007788;">Ignore</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> existing_location<span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">//Erase the existing element, and use the newer instead</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>action <span style="color: #000080;">==</span> QET<span style="color: #008080;">::</span><span style="color: #007788;">Erase</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ElementsLocation parent_loc <span style="color: #000080;">=</span> existing_location.<span style="color: #007788;">parent</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span> m_elements_collection<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>copy<span style="color: #008000;">&#40;</span>location, parent_loc<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">//Add the new element with an other name.</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>action <span style="color: #000080;">==</span> QET<span style="color: #008080;">::</span><span style="color: #007788;">Rename</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">int</span> a <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QString parent_path <span style="color: #000080;">=</span> existing_location.<span style="color: #007788;">parent</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>.<span style="color: #007788;">projectCollectionPath</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QString name_ <span style="color: #000080;">=</span> existing_location.<span style="color: #007788;">fileName</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name_.<span style="color: #0000dd;">remove</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;.elmt&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div><p> </p>]]></description>
			<author><![CDATA[null@example.com (scorpio810)]]></author>
			<pubDate>Wed, 18 Sep 2019 18:40:40 +0000</pubDate>
			<guid>https://qelectrotech.org/forum/viewtopic.php?pid=10602#p10602</guid>
		</item>
		<item>
			<title><![CDATA[Edition élément embarqué et état modifié]]></title>
			<link>https://qelectrotech.org/forum/viewtopic.php?pid=10600#p10600</link>
			<description><![CDATA[<p> Bonjour,<br />quand on modifie un élément embarqué (un bornier par exemple): on fait enregistrer sur l&#039;éditeur d&#039;élément, le projet n&#039;apparait pas modifié et à enregistré et si on ferme le projet sans enregistrer la modification est perdu.<br />Cordialement. </p>]]></description>
			<author><![CDATA[null@example.com (galexis)]]></author>
			<pubDate>Wed, 18 Sep 2019 09:29:21 +0000</pubDate>
			<guid>https://qelectrotech.org/forum/viewtopic.php?pid=10600#p10600</guid>
		</item>
	</channel>
</rss>
