Sunday, May 5, 2013

SoC 2: Qt as a button

Today's Summer of Code experience is learning a little of Qt and GTK+, both of which are somewhat simple GUI tools. Qt has the benefit of working on almost everything, including mobile devices, but GTK+ was built specifically for GNOME, a well-known favorite in the linux community. Generally speaking Qt has faster load times, but may consume more memory than GTK+. GTK+, though, is heavily used in a number of desktop environments for linux users (KDE being a notable exception). On my own Openbox set-up, I use a mixture of the two toolkits, and have configured them both to look like GTK+ for aesthetics. That being said, this will be my first time generating real UI's from both.


GTK+

I figured I would start on a positive note with GTK+ using this guide. The guide does precisely what I did in my previous post and highlights all the essential features of the code line by line. That being said, I feel it would be redundant for me to do the same thing here. By the end of the first page, I had created the following "counting" function:


Sure, it's nothing special, but I thought it was a pretty neat first step. GTK+'s similarity to C syntax is quite apparent, though after looking at some OpenGL code, I suppose it is not all that unusual. Truth be told, this was one of the first times I had ever formed a non-web GUI, and the functions (such as gtk_main_quit() or gtk_window_set_title()) were extremely annoying to type due to the underscore key being so far away from my typical hand-reach. It is not too big of a deal, but it may get annoying in the future.


Qt

I honestly have no idea why Qt is called Qt, but it's easy enough to remember. It also took me a while to figure out how to compile it on my system. It has a number of developmental options, such as Qt Quick and Qt Widgets, along with good old fashioned C++, which is what I opted to use for today. I decided to follow a guide from the same site, because it seemed the most straightforward. I realize the tutorial covers Qt4 while the latest version is Qt5, but after spending a few hours navigating the Qt main site, I settled for something that seemed a little less convoluted. That being said, even though I pulled up a simple window, it seemed so much easier to do in GTK+. Afterwards, I began navigating through some of the Qt examples installed on my system for Qt5, and found some simple GUI's I could work with. After running some of the example codes with the qmake and make commands, I feel I have a much better grasp of this toolkit and would recommend it. 

Between the two toolkits, I feel there is not a clear winner for me, as a new user. Though GTK+ was definitely easier for me to use at this stage, I feel once I have a better grasp of Qt, it will be just as useful (if not moreso). I will probably spend more time over the summer working on GUI programming, and will hopefully know some pretty nifty tricks when it is all said and done.

Thanks for reading,
Leios

No comments:

Post a Comment