cancel
Showing results for 
Search instead for 
Did you mean: 

Qt Object and calling QT methods

zakyn
Occasional Contributor

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 5

RE: Qt Object and calling QT methods


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.
--
Dmitry Nikolaev

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
jxgxldl
Occasional Contributor

RE: Qt Object and calling QT methods

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 ?

RE: Qt Object and calling QT methods

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.


Best regards,
Alexey

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
jxgxldl
Occasional Contributor

RE: Qt Object and calling QT methods

yes. But for some other widgets ( controls ) in Qt,  which the TC doesn't provide the corresponding controls, how to deal with them?
YMinaev
Staff

RE: Qt Object and calling QT methods

Hi,



See this thread.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors