Sunday, September 16, 2012

Qyoto - C# bindings for Qt installation

I have recently taken an interest in C# and have been looking for a GUI toolkit to use. For development, I use MonoDevelop under Kubuntu. There are a few options, the three major ones seem to be Gtk#, Winforms and Qyoto. For me, Qyoto seems like a very good option especially since I have bit of a background using Qt with C++.

I haven't seen a lot of documentation online and if there is, it's a bit outdated. Therefore I have decided to write down my experience with the latest version it.

First of all I would recommend checking out the project's webpage on kde techbased: http://techbase.kde.org/Development/Languages/Qyoto

Now for installing, I strongly recommend you install both Qyoto AND Smoke (one of it's deps) from source. I've had problems trying to compile Qyoto using Ubuntu's packaged version of Smoke - so make sure that it's uninstalled first. You can download the git repos from here: https://projects.kde.org/projects/kde/kdebindings/smoke
First install smokegen, then smokeqt and finally install assemblygen (from https://gitorious.org/assemblygen). If you're unfamiliar with cmake, read below.

All of them use cmake so the build procedure is the same.
To install for example smokegen, clone the git repo (source) and then:
cd smokegen
mkdir build
cd build
cmake ../
// if cmake complains about deps, install them (qt4, phonon, mono, etc) and rerun cmake ../)
make
make install

If all has gone well, launch MonoDevelop, create a new Empty C# Project and add the qyoto-qtcore and qyoto-qtgui references. You'll notice that are many more, but for now these will suffice. Now the fun can begin.

Remember that the Main(String[]) function should look like:
{
new QApplication();
(new MainWindow()).Show(); // this is the custom class
QApplication.Exec();
}

No comments: