info about signals and validator sequence

50 views
Skip to first unread message

Luigi Ferraris

unread,
Feb 12, 2014, 8:21:56 AM2/12/14
to qtcon...@googlegroups.com
Hi Pritpal,
this is only a request for information, clarification related with signals and validator and probably it's the normal Qt behaviour.

I have observed that signals (ie) "textChanged" is emitted before use of validator and/or fixup.
I have searched on internet, but I haven't found information about it; only "when text changed signal is emitted...": thanks, I know!

A very brief example:

oLineEdit := QLineEdit
oLineEdit:setInputMask( "XXX" )
oLineEdit:setText( "123" )
oLineEdit:setValidator( HBQValidator( {|cText,nPos| Qvalidator( cText, nPos ) }, {|cText| Qfixup( cText ) } )
oLineEdit:connect( "textChanged(QString)", { |cText| QtextChanged(cText) } )

Some knowledge:
1) Qfixup is used ONLY when there is a inputMask and, for some reason, text doesn't rispect the mask: ok
2) Qvalidator always used: ok

In my log I see this sequence:
1) Qtextchanged
2) Qfixup
3) Qvalidator

My POV is: before I need to run Qfixup and Qvalidator then signal emitted with arranged value else ...follow this example:
on video there is 123. I delete first char so, now, is " 23"
a) qtextchanged receive " 23" (oh, is wrong because there is a space!)
b) qfixup manage " 23" and set text on video to  "023" because I don't want (ie) space

Can you help me? This is right or this is the Qt behaviour?

TIA
Luigi Ferraris

Pritpal Bedi

unread,
Feb 15, 2014, 12:04:19 AM2/15/14
to qtcon...@googlegroups.com
Hi Luigi


this is only a request for information, clarification related with signals and validator and probably it's the normal Qt behaviour.


As such I have no analysis at hand to describe. You need to study 
hbqtwidgets/getsys.prg in detail. Infact this is a complex subject to answer 
in words, only program flow is the best friend. I did struggle a lot on this front.


Pritpal Bedi

Luigi Ferraris

unread,
Feb 15, 2014, 6:08:22 AM2/15/14
to qtcon...@googlegroups.com
Il 15/02/2014 6.04, Pritpal Bedi ha scritto:
> As such I have no analysis at hand to describe. You need to study
> hbqtwidgets/getsys.prg in detail. Infact this is a complex subject to
> answer
> in words, only program flow is the best friend. I did struggle a lot
> on this front.
>
You are right: it's very strange and a complex subject. Infact, I read
your getsys.prg and I'm doing some test (without using your great
getsys.prg) to understand Qt "logic".
I understand that validator part is always run and fixup only when there
is an inputmask AND when some chars don't rispect mask....
There is a (one of more....) difference between your code and my test: I
don't use sl_fixupCalled (I think to avoid double execution....). For
this reason, I see in my log this sequence:
1) validator
2) fixup
3) validator

Probably, I must create (if I'm able) a little C++ source to see IF
there are difference....

I will inform you if I will find something...

BR
Luigi Ferraris

Reply all
Reply to author
Forward
0 new messages