开发者

findChild() in qt jambi is not working for me

i'm looking for a code snippet that uses the findChild() function in qt jambi开发者_如何学JAVA i've looked on google but it seems that qt jambi is not well documented any way here is what i found in the documentation :

public final QObject findChild(java.lang.Class cl,
                           java.lang.String name)

This functions searches for descendant(s) of this QObject. 

let take a QLabel for exemple ,if we want to look for a QLabel named "myLabel" ,the syntaxe should be like this :

QLabel l = this.findChild(QLabel,"MyLabel");

i tried this code and its not working. ps: in qt the syntaxe for this is :

findChildren<QLabel *>("myLabel");

any suggestions ? how to convert it to java syntax ?


To get the Class object for a class QLabel, you write "QLabel.class" -- i.e.,

QLabel l = this.findChild(QLabel.class,"MyLabel");

I don't know if it's genericized or not, or if you have to cast the result:

QLabel l = (QLabel) this.findChild(QLabel.class,"MyLabel");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜