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 --- kjsembed/docs/examples/connect/connect.js | 45 +++++++++ kjsembed/docs/examples/connect/connect.ui | 160 ++++++++++++++++++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 kjsembed/docs/examples/connect/connect.js create mode 100644 kjsembed/docs/examples/connect/connect.ui (limited to 'kjsembed/docs/examples/connect') diff --git a/kjsembed/docs/examples/connect/connect.js b/kjsembed/docs/examples/connect/connect.js new file mode 100644 index 00000000..aa56a366 --- /dev/null +++ b/kjsembed/docs/examples/connect/connect.js @@ -0,0 +1,45 @@ +#!/usr/bin/env kjscmd + +// +// Demo that connects C++ signals to JS slots of various types. +// + +// Load the demo gui +var top = Factory.loadui( 'connect.ui' ); + +// Util func to print a msg +function msg(s) +{ + top.child('output').append(s); +} + +// JS object we connect to +function DemoObj() +{ + this.func_void = function() { msg('void'); } + this.func_bool = function(b) { msg(b); } + this.func_int = function(i) { msg(i); } + this.func_string = function(s) { msg(s); } + this.func_double = function(d) { msg(d); } +} + +// +// Main +// + +var obj = new DemoObj(); + +var ve = top.child('v'); +var be = top.child('b'); +var ie = top.child('i'); +var se = top.child('s'); +var de = top.child('d'); + +top.connect( ve, 'clicked()', obj, 'func_void' ); +top.connect( be, 'toggled(bool)', obj, 'func_bool' ); +top.connect( ie, 'valueChanged(int)', obj, 'func_int' ); +top.connect( se, 'textChanged(const QString&)', obj, 'func_string' ); +top.connect( de, 'valueChanged(double)', obj, 'func_double' ); + +top.show(); +application.exec(); diff --git a/kjsembed/docs/examples/connect/connect.ui b/kjsembed/docs/examples/connect/connect.ui new file mode 100644 index 00000000..5b172a8d --- /dev/null +++ b/kjsembed/docs/examples/connect/connect.ui @@ -0,0 +1,160 @@ + +demo + + + demo + + + + 0 + 0 + 434 + 348 + + + + Connect Demo + + + + unnamed + + + + s + + + + + textLabel2_2 + + + + 160 + 239 + 139 + + + + Box + + + Slot Output + + + AlignCenter + + + + + d + + + + + i + + + + + textLabel1_2 + + + + 160 + 239 + 139 + + + + Box + + + Plain + + + Signal Source + + + AlignCenter + + + + + b + + + Bool + + + + + v + + + Void + + + + + textLabel3 + + + Double: + + + + + textLabel2 + + + Int: + + + + + textLabel1 + + + String: + + + + + output + + + + 7 + 7 + 1 + 0 + + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + + + klineedit.h + knuminput.h + ktextbrowser.h + + -- cgit v1.2.1