Squish/nativeType Function: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
It can be the case that you need to type some text and be picked up by the application but which the receiver of the text is either unknown or very hard to predict. Think along the lines of an event filter being installed or if an object redirects events to its children.
It can be the case that you need to type some text and be picked up by the application but which the receiver of the text is either unknown or very hard to predict. Think along the lines of an event filter being installed or if an object redirects events to its children.


It’s in these situations that you should always recur to the function nativeType().
It's in these situations that you should always recur to the function nativeType().


It works very similarly to type() however it doesn’t take an object as its target, rather, it emulates the typing a user would do to the application. This allows it to be redirected through the same paths and be picked by the proper objects.
It works very similarly to type() however it doesn't take an object as its target, rather, it emulates the typing a user would do to the application. This allows it to be redirected through the same paths and be picked by the proper objects.
 
Do note, however, that squish heavily advises not to use this function. The problem with nativeType() is that, since it simulates what a user would do, it can be blocked if its target loses its focus.

Revision as of 11:03, 24 February 2015

It can be the case that you need to type some text and be picked up by the application but which the receiver of the text is either unknown or very hard to predict. Think along the lines of an event filter being installed or if an object redirects events to its children.

It's in these situations that you should always recur to the function nativeType().

It works very similarly to type() however it doesn't take an object as its target, rather, it emulates the typing a user would do to the application. This allows it to be redirected through the same paths and be picked by the proper objects.