From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../docs/examples/customwidget/custom_widget.js | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 kjsembed/docs/examples/customwidget/custom_widget.js (limited to 'kjsembed/docs/examples/customwidget/custom_widget.js') diff --git a/kjsembed/docs/examples/customwidget/custom_widget.js b/kjsembed/docs/examples/customwidget/custom_widget.js new file mode 100755 index 00000000..dbab2d8f --- /dev/null +++ b/kjsembed/docs/examples/customwidget/custom_widget.js @@ -0,0 +1,57 @@ +#!/usr/bin/env kjscmd + +// +// Script demonstrating how to create a custom widget. +// + +function createField( parent ) +{ + var hbox = new QHBox( box, 'hb' ); + + var label = new QLabel( hbox ); + label.text = 'Filename:'; + var ed = new QLineEdit( hbox, 'lineed' ); + ed.text = './my_file.txt'; + var pb = new QPushButton( hbox, 'button' ); + pb.text = 'Br&owse'; + var led = new KLed( hbox, 'led' ); +} + +function createGroup( parent ) +{ + var grp = new QGroupBox( box, 'grp' ); + grp.columns = 1; + grp.title = 'A QGroupBox'; + + var cb1 = new QCheckBox( grp, 'check1' ); + var cb2 = new QCheckBox( grp, 'check2' ); + cb1.text = 'Check Box One'; + cb2.text = 'Check Box Two'; + + return grp; +} + +// Outer layout +var box = new QVBox(); +box.margin = 6; + +// Title +var ttl = new QLabel( box, 'title' ); +ttl.text = '

KJSEmbed Object Creation Demo


'; + +// Named field +createField( box ); + +// Text editor +var l = new QLabel( box, 'tl' ); +l.txt = 'Editable Text Widget:'; +var txt = new QTextEdit( box, 'text_edit' ); +txt.text = 'This is an editable text widget created from Javascript using the ' + + 'KJSEmbed library. As you can see, the facilities are powerful enough ' + + 'for many useful applications to be found.'; + +// Group of check boxes +var grp = createGroup( box ); + +box.show(); +application.exec(); -- cgit v1.2.1