<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Following excellent review of a recent PR, I was asked to update
the conventional string-based Qt connections to the new-style Qt
connections. (<a class="moz-txt-link-freetext" href="https://wiki.qt.io/New_Signal_Slot_Syntax">https://wiki.qt.io/New_Signal_Slot_Syntax</a>) The old
style is: <br>
</p>
<pre>connect(
sender, SIGNAL( valueChanged( QString, QString ) ),
receiver, SLOT( updateValue( QString ) )
);
</pre>
<p>My old-style connection is:</p>
<p><tt>connect(ui.timeDiffEdit, SIGNAL(timeChanged(const QTime)),
this, SLOT(timeDiffEditChanged()));</tt><br>
</p>
<p>For the new style the specification in the Qt documentation is:<br>
</p>
<pre>connect(
sender, &Sender::valueChanged,
receiver, &Receiver::updateValue
);</pre>
<p>My formulation, reflecting my strong deficiencies in Qt coding
but following the above, for the new connection is:</p>
<p> <tt> connect(this,
ui.timeDiffEdit->timeChanged(ui.timeDiffEdit->time()),</tt><tt>
this, this->timeDiffEditChanged());</tt></p>
The second parameter needs to be a pointer, for which I used <tt>ui</tt><tt>.timeDiffEdit.</tt>
The <tt>timeChanged()</tt> signal needs a <tt>QTime</tt> value, so
I provided that with <tt>ui.timeDeffEdit->time(),</tt> the
actual amount of time by which the <tt>timeDiffEdit</tt> has been
changed.<br>
<p>The last parameter also needs an address, provided by <tt>this-></tt><tt>timeDiffEditChanged()</tt>
is the response to the signal from<tt> </tt><tt>timeDiffEdit->timeChanged().</tt>
It is a void function and the source of build problems. The
compiler generates an error:</p>
<p><tt>/home/willem/src/subsurface/desktop-widgets/importgps.cpp:30:104:
error: invalid use of void expression</tt><tt><br>
</tt> <tt> connect(this,
ui.timeDiffEdit->timeChanged(ui.timeDiffEdit->time()),
this, this->timeDiffEditChanged());</tt><tt><br>
</tt><tt>
^</tt><tt><br>
</tt></p>
<p>Obviously, accessing the pointer <tt>this->timeDiffEditChanged()</tt>
should not return a void value. I have no idea of how to respond
to this error. Any suggestions are very welcome. For completeness
I attach the code for the full object to this email.</p>
<p>Kind regards,</p>
<p>willem</p>
<p><br>
</p>
<p><br>
</p>
</body>
</html>
<br>
<div style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:10.0pt;line-height:105%;font-family:"Segoe UI",sans-serif">This message and attachments are subject to a disclaimer.<br>
Please refer to <a href="http://upnet.up.ac.za/services/it/documentation/docs/004167.pdf" target="_blank">http://upnet.up.ac.za/<wbr>services/it/documentation/<wbr>docs/004167.pdf</a> </span><span style="font-size:10pt;line-height:105%;font-family:Tahoma,sans-serif">for
full details.</span></div>