Skip navigation.
KDE Developer's Journals

Exposure of properties in KJSEmbed...

geiseri's picture

Well, I finally got around to implementing my pet pieve with KJSEmbed. When you imported a UI File, you would just get the top level widget.

Now after my modifications, it will add the child widgets as JavaScript properties of the parent. This is nice because now you can just call a UI file as:

var Form1 = Factory.loadui("Form1.ui");
var text = Form1.TextGroupBox.NameLineEdit.text;

instead of

var Form1 = Factory.loadui("Form1.ui");
var TextGroupBox = Form1.child("TextGroupBox");
var NameLineEdit = Form1.child("NameLineEdit");
var text = NameLineEdit.text;

Much clearer no?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
floyd's picture

Typo?

Shouldn't it read:

var NameLineEdit = TextGroupBox.child("NameLineEdit");

instead?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.