[dot] FQyoto C#/Mono Bindings for Qt4, New QtRuby release and PHP Bindings Coming Soon

Dot Stories stories at kdenews.org
Tue Jul 3 15:22:56 CEST 2007


URL: http://dot.kde.org/1183467123/

From: Richard Dale <richard.j.dale at gmail.com>
Dept: ninja-monkeys
Date: Tuesday03/Jul/2007, @05:52

FQyoto C#/Mono Bindings for Qt4, New QtRuby release and PHP Bindings Coming Soon
================================================================================

   After the recent final release of QtJambi
[http://trolltech.com/products/qt/jambi/index], Trolltech's Java
bindings, I'm pleased to announce another new member of the Qt bindings
family, the Qyoto C#/Mono bindings for Qt 4.3, which are available for
download on the Qyoto/Kimono site [http://www.qyoto.org], where there is
also a help forum for your Qyoto programming questions. Big thanks to
David Canar for setting up the site, and organizing the release. Read on
for more details.

     Additionally, I've just released QtRuby 1.4.9 on the Korundum
Rubyforge site [http://rubyforge.org/projects/korundum/] with many
improvements. Meanwhile Thomas Moenicke is working on another binding
using the Smoke library - PHP-Qt - see last week's Commit-Digest
[http://commit-digest.org/issues/2007-06-24/] for details. What with
these bindings, and all the action with Kross scripting of KDE apps and
Plasma (and PyQt/PyKDE of course), these are exciting times for fans of
non-C++ languages in KDE!
     Arno Rehn and myself have given a presentation and demo of Qyoto at
aKademy 2007 [http://akademy2007.kde.org/]. We will show how you can
quickly build user interfaces with Qt Designer/uics, easily communicate
with other applications via the QtDBus framework, and how other CLR
languages, such as IronPython, work with Qyoto.

     Qyoto includes very complete coverage of the Qt classes, and
optionally the QScintilla text editing framework, along with the 'uics'
tool for compiling Qt Designer .ui files to C#, and 'csrcc' a resource
compiler based on Qt's rcc. The code is based on QtRuby, which in turn
was derived from PerlQt, and it uses the same language independent Smoke
library as those bindings. That should mean that Qyoto will be quite
solid and mature for a first release.

     Now for a brief summary of how the Qt language features look in
Qyoto. You define slots by marking methods in your class like this:
 [Q_SLOT] public void MySlot(int arg) { ...
     Signals are defined in an interface associated with the class, with
the signatures being marked with a 'Q_SIGNAL' attribute:
 public interface IMyButtonSignals : IQPushButtonSignals { [Q_SIGNAL]
void Clicked(bool arg);
     To emit a signal you, use a special property called 'Emit' like
this:
 Emit.Clicked(true);
     Note that Qyoto signals are typesafe and can be checked by the
compiler because they must conform to the type signatures defined in
your signals interface. Qt properties are mapped directly on C#
properties, and so instead of setting the text of a button with a
setText() method call:
 mybutton.setText("Hello World!");
     You set a 'Text' property like this:
 mybutton.Text = "Hello World!";
     If you wish properties to appear in the QMetaObject data for your
class, so that you can export them over DBus perhaps, you can mark them
like this:
 [Q_PROPERTY] public string Text { ...
     Connecting a signal to a slot is very similar to C++:
 Connect(quit, SIGNAL("clicked()"), app, SLOT("quit()"));
     But note the quotes round the signal/slot signatures.

     Well that pretty much sums up the differences - the api is so
similar to the C++ api that very little explanation should be needed.
Although Qyoto has its own distinctive personality with method names
beginning with capital letters and much use of getting/setting
properties, the code examples should be very easy to follow, and getting
up to speed straightforward for those familiar with Qt. The MonoDevelop
IDE works well with Qyoto, and there is a MonoDevelop project file
'Qyoto.mpb' provided, which is a very useful way to browse the classes
in the api.

     Happy C#/Mono hacking with Qyoto!



More information about the dot-stories mailing list