Forum Discussion

zakyn's avatar
zakyn
Occasional Contributor
15 years ago

Qt Object and calling QT methods

Hello,



I am in trouble with calling method of the qt object. TestComplete helps me and offers me that method but I have a problem with constructing correct parameter.



For Example. I would like to set Text to QT LineEdit control but method setText(object param1) does not work, or I am not able to use it correctly. I use JScript.



I try

Aliases............LineEdit.setText("example");

- the result is bad type of parameter



Of course I can use

Aliases............LineEdit.setFocus();

and then

Aliases............LineEdit.Keys("example");



Could you help me?



My general question is if TestComplete allows to call native public QT methods or set or get public properties of QT objects.



Thanks a lot



Vladimir

5 Replies


  • Hello Vladimir,





    Yes, TestComplete provides special objects that wrap Qt controls, so you can use the wrappers' properties and methods instead of the control's native properties and methods. Please go through the 'Working With Qt Controls' help topic - it contains the information you need.





    TestComplete's QtLineEdit object is a wrapper for the Qt LineEdit control, and to set the text of the control, you can use the object's wText property. For example:



    Please see the 'QtLineEdit Object' help topic for details.
  • jxgxldl's avatar
    jxgxldl
    Occasional Contributor
    Hi, I am also interest in this problem.  The answer which you provide (" lineEdit.wText = "texts" ) is not the expected one.



    Because I want to use Qt method to set the texts, not use the methods or properties which provide by TestComplete.



    Simplely to say, I want to use the method of QLineEdit,  not the QtLineEdit.



    so for the method : setText(),  it has a parameter, how to operate with it? could you please give me a example ?
  • Hello Dingliang,


    Actually, the setText method requires a parameter of the QString class. That is why, TestComplete provides the QtLineEdit object that gives you scripting access to the control. Also, the QtLineEdit object allows you to test custom controls which are based on the QLineEdit control.

  • jxgxldl's avatar
    jxgxldl
    Occasional Contributor
    yes. But for some other widgets ( controls ) in Qt,  which the TC doesn't provide the corresponding controls, how to deal with them?