[texworks] Scripts: Exploration of TW objects

Paul A Norman paul.a.norman at gmail.com
Thu Nov 4 13:38:20 CET 2010


From: http://doc.trolltech.com/4.4/qtscript.html

"Accessing Child QObjects

"Every named child of the QObject (that is, for which
QObject::objectName() is not an empty string) is by default available
as a property of the QtScript wrapper object. For example, if you have
a QDialog with a child widget whose objectName property is "okButton",
you can access this object in script code through the expression"

Paul

On 4 November 2010 22:52, Paul A Norman <paul.a.norman at gmail.com> wrote:
> Put this (the below) as a script, I called it tw_OBJECTS.js in a script folder.
>
> Refresh scripts.
>
> Position the cursor  in a New blank document in Tw.
>
> And run the script.
>
> Does the result suggest that all the found children can in some way be
> slotted into and even **safely** called by QtScript?
>
> Paul
>
> //TeXworksScript
> //Title:  Experimental TW
> //Description: Exploration of TW objects
> //Author:  Paul A. Norman
> //Version: 0.3
> //Date:  2010-11-04
> //Script-Type: standalone
> //Context: TeXDocument
> //Shortcut: Alt+T, Alt+W
>
>
> // TW.information(null, "", TW.app.findChildren());
>
>  study = TW.target.findChildren() +'';
>  study = study.replace(/,/g,",\n")
>
> TW.target.insertText(study);
>
>  null;
>
> //========== Results ===========
>



More information about the texworks mailing list