Wednesday, March 04, 2009

Qt Eclipse Integration

Recently, I started to play with Qt 4 also under Windows, in order to be able to port some of my Linux applications that use Qt. Usually, I'm using KDevelop under Linux to develop Qt applications, but under Windows? Then I noticed that Trolltech provides Qt Eclipse Integration, i.e., an Eclipse plugin to program Qt programs with Eclipse. So I gave it a try...

IMPRESSIVE, really a nice piece of software!

The installation is immediate, and you get a menu item to run Eclipse already setup to start programming with Qt (relying on the CDT plugin for the C++ part). To try it, I followed the tutorial you find here.

The new project wizard now provides also Qt project options:

I chose the Qt Gui Project, and you'll have a skeleton project with an ui file (and you can then choose possible further libraries you might want to use):

If you haven't done that already, you'll need to configure a Qt version by providing the paths of your Qt installation:

Building the project relies, obviously, on qmake:

If you open the ui file, you'll see the nice integration with QtDesigner, perfectly fit in Eclipse, with all the useful views:

You can then create new files, classes and in particular UI classes:

And note the nice project file editor

And here's how you can easily manage signals and slots:

Following the tutorial you'll get an address book application that looks like this:

Summarizing, the qt eclipse integration plugin really impressed me in a positive way! And now I want to try it also under Linux. :-)

Sunday, March 01, 2009

PDT, XDebug, Eclipse in Linux

I finally had a working version of PDT (Php eclipse plugin) and XDebug, so that I can finally debug, not only php script, but also php web sites! :-)

This blog post helped me a lot, but I must also admit that pdt people did a wonderful job, and now everything seems to work out of the box!

First of all I relied on the pdt all in one version (i.e., eclipse together with all the requested plugins and the pdt plugin), that can be found at

However, you also need to install xdebug and (k)ubuntu already has a package for this, so you just need to type

apt-get install php5-xdebug

Now just check the path of the library file, in my case it is


then you'll need to add some parts in the php.ini configuration file, so you need to add at the end of your /etc/php5/apache2/php.ini these lines (use the path of above):

; XDebug
xdebug.remote_host="" ; if debugging on remote server,
; put client IP here
Also, set implicit flush on in the same php.ini file, so you need to search for implicit_flush in the file and make sure it is set to on:

implicit_flush = On

Now you're set and you can run eclipse, and try to make a new Php project with a simple file, and try to debug it!

You need to create a new debug configuration, in particular a "Php Web Page" debug configuration. Also make sure that the server debugger is set to XDebug. Then specify the php file you want to test (in this example is newfile.php). Unless the project and all files are already in the root directory of your web server, you need to manually set the URL, so uncheck "Auto Generate" check box and write the complete path (starting from the root of your webserver directory, or, as in my case, a path relative to my user web space); this is also a way of passing, for instance, some GET arguments in the URL, as in this example: xamplevar=30&other=foobar.

Before starting the debugger, make sure you have the web browser set in eclipse; I'm using the internal web browser (actually the only one available in this eclipse installation). NOTE: sometimes, when starting eclipse, the web browser seems to have been lost, and you'll get an error when starting the debugger; in this case I simply restart eclipse.

Now let's run our debug configuration and debug our script!

Note the values of the variables (including the GET variables) and the output in the browser view! You can also see the output as the actual text, in the debug output window.

Remeber, when your program comes to the end, the debugger session is still active, and you must close with the red button, after selecting the "Remote Launch":