Experimenting with KJSEmbed
Some time ago I came across a service by Merriam-Webster OnLine which offers audio prononciations of the english words additionally to its online dictionary. I think this is particularly useful when learning new words. However, it’s a bit laborious to click through the page, so I made a little script to simplify this yesterday.
I took it as an opportunity to play around with KJSEmbed, KDE’s ECMAScript bindings. The examples helped a lot. I have never been very comfortable with the JavaScript language, but the implementation was pretty straightforward and it took definitely less time than it would have with C++.
What confused me at first was the fact that Qt properties are not accessed with get- and set-methods like in C++. Instead they behave like public member variables. Sometimes it wasn’t really clear to me if the element I wanted to access is a property or if it is an ordinary “setter method” (e.g. QWidget.setEnabled(…))… Oh well, I guess I can live with that.
The script uses a Qt designer .ui file to describe the user interface, downloads the .wav files using KJSEmbed’s NetAccess and plays them using an embedded Kaboodle KPart.
![]()
June 21st, 2004 at 12:03 am
Hi Sandro,
You can tell if something is a setter/getter or a property by checking if the set or get method is a slot. You can access pretty much any slot just as you would in C++. The properties that are provided are the same as the ones listed in the Qt docs for the object as a property.
Please feel free to send any feedback to the KJSEmbed ML (details of finding it are at the above URL).
Rich.
June 21st, 2004 at 6:15 pm
Hi Sandro,
cool screenshot, is that Plastik you use? Which colour scheme, which win deco?
June 22nd, 2004 at 3:52 pm
It’s a new style. Not much to tell yet, look forward to Lindows related news. *hint*