<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QUiLoader loading CustomWidget, called setter twice]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">i have a question about the QUiLoader. I load an ui-file with quiloader.load(&amp;file). The ui-file contains some customwidget. The setters from my customwidgets are always called twice. I wondering if i do something wrong or is it a bug?</p>
<p dir="auto">My problem is, that i have a setter that does slightly more complex things and i dont want to work with flags in the setter like "if(notAlreadyDone){...}". Any ideas how i can avoid that?</p>
<p dir="auto">Pseudocode:<br />
.h-File<br />
@<br />
class QDESIGNER_WIDGET_EXPORT MyLineEdit : public QWidget{<br />
Q_OBJECT<br />
Q_PROPERTY(QString labelText READ getLabelText WRITE setLabelText)<br />
private:<br />
QString labelText;<br />
public:<br />
void setLabelText(const QString&amp; labelText);<br />
};<br />
@</p>
<p dir="auto">cpp-File:<br />
@<br />
MyLineEdit::MyLineEdit(QWidget* parent) : QWidget(parent){}</p>
<p dir="auto">void MyLineEdit::setLabelText(const QString&amp; labelText){<br />
qDebug() &lt;&lt; <strong>PRETTY_FUNCTION</strong> &lt;&lt; "LabelText:" &lt;&lt; labelText;<br />
this-&gt;labelText = labelText;<br />
}<br />
@</p>
<p dir="auto">Load-UI-File:<br />
@<br />
qDebug() &lt;&lt; "--&gt; before" &lt;&lt; uiMaskFileName;<br />
QUiLoader loader;<br />
QWidget* parent = new QWidget();<br />
QWidget* formWidget = loader.load(&amp;file, parent);<br />
qDebug() &lt;&lt; "--&gt; after";<br />
@</p>
<p dir="auto">UI-File:<br />
@<br />
...<br />
&lt;item&gt;<br />
&lt;widget class="MyLineEdit" name="myLineEdit"&gt;<br />
&lt;property name="labelText"&gt;<br />
&lt;string&gt;Test:&lt;/string&gt;<br />
&lt;/property&gt;<br />
&lt;/widget&gt;<br />
&lt;/item&gt;<br />
...<br />
@</p>
<p dir="auto">Consolen-output:<br />
@<br />
--&gt; before "/tmp/my.ui"<br />
void MyLineEdit::setLabelText(const QString&amp;) LabelText: "Test:"<br />
void MyLineEdit::setLabelText(const QString&amp;) LabelText: "Test:"<br />
--&gt; after<br />
@</p>
]]></description><link>https://forum.qt.io/topic/43230/quiloader-loading-customwidget-called-setter-twice</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 11:57:17 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/43230.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Jul 2014 09:40:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QUiLoader loading CustomWidget, called setter twice on Fri, 11 Jul 2014 06:27:26 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">can someone reproduce/confirm the behavior?</p>
]]></description><link>https://forum.qt.io/post/235447</link><guid isPermaLink="true">https://forum.qt.io/post/235447</guid><dc:creator><![CDATA[Faema]]></dc:creator><pubDate>Fri, 11 Jul 2014 06:27:26 GMT</pubDate></item><item><title><![CDATA[Reply to QUiLoader loading CustomWidget, called setter twice on Fri, 04 Jul 2014 09:59:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">i have created some files/projects similar to my real project.</p>
<p dir="auto">I uploaded a zipfile to a sharing site, because i saw no possiblity to upload files here.</p>
<p dir="auto">The zipfile contains:</p>
<ul>
<li>1 designer lib</li>
<li>1 shared lib</li>
<li>1 main-program</li>
<li>1 ui-file</li>
<li>1 Readme</li>
</ul>
<p dir="auto">System:</p>
<ul>
<li>Qt-version is 5.2.0</li>
<li>OS openSuse 12.1</li>
<li>IDE Eclipse</li>
</ul>
<p dir="auto">"Download zip":<a href="http://www.fileconvoy.com/dfl.php?id=g6da5f12a22f919f09995252123a96d0dc5e4d0085" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.fileconvoy.com/dfl.php?id=g6da5f12a22f919f09995252123a96d0dc5e4d0085</a></p>
<p dir="auto">Best regards</p>
]]></description><link>https://forum.qt.io/post/234599</link><guid isPermaLink="true">https://forum.qt.io/post/234599</guid><dc:creator><![CDATA[Faema]]></dc:creator><pubDate>Fri, 04 Jul 2014 09:59:34 GMT</pubDate></item><item><title><![CDATA[Reply to QUiLoader loading CustomWidget, called setter twice on Thu, 03 Jul 2014 23:43:41 GMT]]></title><description><![CDATA[<p dir="auto">Can you share a minimal compilable example that shows the behavior ?</p>
<p dir="auto">Also, what version of Qt and what OS are you running on ?</p>
]]></description><link>https://forum.qt.io/post/234537</link><guid isPermaLink="true">https://forum.qt.io/post/234537</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 03 Jul 2014 23:43:41 GMT</pubDate></item><item><title><![CDATA[Reply to QUiLoader loading CustomWidget, called setter twice on Thu, 03 Jul 2014 06:13:39 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">thanks for your reply.</p>
<p dir="auto">Yes i am sure. I wrote a test-class with only 1 constructor and 1 set-/getter. No additional signal/slots/connects.</p>
]]></description><link>https://forum.qt.io/post/234432</link><guid isPermaLink="true">https://forum.qt.io/post/234432</guid><dc:creator><![CDATA[Faema]]></dc:creator><pubDate>Thu, 03 Jul 2014 06:13:39 GMT</pubDate></item><item><title><![CDATA[Reply to QUiLoader loading CustomWidget, called setter twice on Wed, 02 Jul 2014 21:49:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">Are you sure that in your custom widget you don't have multiple connect calls ?</p>
]]></description><link>https://forum.qt.io/post/234388</link><guid isPermaLink="true">https://forum.qt.io/post/234388</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 02 Jul 2014 21:49:31 GMT</pubDate></item></channel></rss>