Qt new style signals/slots
dirk at hohndel.org
Sat Jan 18 22:14:32 PST 2020
On my phone.
The first 'this' is wrong. That needs to be the address of the specific qdatetomeedit in the UI.
On January 18, 2020 9:32:43 PM PST, Willem Ferguson <willemferguson at zoology.up.ac.za> wrote:
>On 2020/01/18 21:32, Dirk Hohndel wrote:
>> Hi Willem,
>>> On Jan 18, 2020, at 3:48 AM, Willem Ferguson
>>> <willemferguson at zoology.up.ac.za
>>> <mailto:willemferguson at zoology.up.ac.za>> wrote:
>>> My formulation, reflecting my strong deficiencies in Qt coding but
>>> following the above, for the new connection is:
>>> The second parameter needs to be a pointer, for which I used
>>> ui.timeDiffEdit. The timeChanged() signal needs a QTime value, so I
>>> provided that with ui.timeDeffEdit->time(), the actual amount of
>>> by which the timeDiffEdit has been changed.
>>> The last parameter also needs an address, provided by
>>> this->timeDiffEditChanged() is the response to the signal
>>> fromtimeDiffEdit->timeChanged(). It is a void function and the
>>> of build problems. The compiler generates an error:
>>> error: invalid use of void expression
>>> connect(this, ui.timeDiffEdit->timeChanged(ui.timeDiffEdit->time()),
>>> this, this->timeDiffEditChanged());
>>> Obviously, accessing the pointer this->timeDiffEditChanged() should
>>> not return a void value. I have no idea of how to respond to this
>>> error. Any suggestions are very welcome.
>> How about
>> connect(this, &QTimeEdit::timeChanged, this,
>> That seems like it would follow the syntax suggested above, right?
>Thank you very much for your time.
>For Dirk's suggestion I get:
>constructor ‘ImportGPS::ImportGPS(QWidget*, QString,
>no matching function for call to ‘ImportGPS::connect(ImportGPS*, void
>(QDateTimeEdit::*)(const QTime&), ImportGPS*, void (ImportGPS::*)())’
> connect(this, &QTimeEdit::timeChanged, this,
>I suspect this means that there is a problem in the types of parameters
>in the call to connect() ??
>For Bill's formulation there is an apparent problem with the signal
>of the call to connect():
>invalid use of non-static member function ‘void
> connect(ui.timeDiffEdit, ui.timeDiffEdit->timeChanged, this,
>I just do not know how to proceed.
>This message and attachments are subject to a disclaimer.
>Please refer to
From my phone
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the subsurface