#52WeeksOfCode Week 20 – Qt

Week: 20

Language: Qt

IDE(s): Qt Creator

 

History (official):

(From the Qt Project ‘About Us’ page)

“Qt (“cute”) is a leading cross-platform application and UI development framework for leading desktop, embedded and mobile operating systems. Qt uses standard C++ and is widely used for developing software applications with a GUI and also for developing non-GUI applications with features such as file handling, database access, XML parsing, thread management and network support.

Qt’s powerful full-framework capabilities allows for the creation of highly-performing native applications as well as for hybrid development where the developer can choose which tools provide the best user experience.

Qt is created by developers for developers where making developers’ lives easier is top priority. We strive to provide an incomparable developer experience with the tools necessary to create amazing user experiences. Qt is platform agnostic and believes in making sure that all developers are privy of being able to target multiple platforms with one framework by simply reusing code. We believe in providing freedom to the developer. Code less. Create more. Deploy everywhere.”

History (real):

Qt allows C++ developers to create modern-looking GUI applications without having to learn more current languages such as C#.

(NOTE: I have no problem with C++. It was my first object-oriented language and I’ll always have a soft spot for it in my nerdy heart.)

The code is quite portable between different operating systems, making rapid, cross-platform deployment straightforward.

BUT…there’s a price.

In programming, as in life, you get nothing for free. The cost of portability is that you can’t rely on any particular operating system to do things for you. For example, Windows may have a perfectly fine software routine for rendering a menu, but you can’t use it. If you do, then you’ll have to rewrite your code every time you want to run your application on a different operating system that uses different code for menu-rendering. In a related issue, you have to include the code libraries that your applications uses because you can’t assume that your target computer (even if it runs the same operating system) has them.

Because of this, Qt has to reinvent the wheel for almost everything it does.

Another consequence of this independence is that the owners of the operating systems you’re targeting are always ahead of you with shiny new graphics features and new hardware. As a result, your applications are always going to look kind of shabby compared to the ones that are native to the platform. (Java has a similar problem.)

That being said, I like the idea of Qt. Cross-platform, particularly for a rich development framework, is a good thing.

It turns out that the reality fell a bit short.

 

Discussion:

Though Qt works with different IDEs (including a plain old text editor), I decided to use the native development environment Qt Creator. It’s free and since it pulls the install files from the Internet, the installer is a quick download. Since Qt is by definition a stranger wherever it goes, I decided to use Mac OS X as my development platform.

I fired up Qt Creator. It seemed straightforward enough, with plenty of documentation and tutorials.

QT Creator GUI

QT Creator GUI

I decided to go with a simple graphical application project. I typed in the project name, chose a folder for it and clicked on Save.

My project was nowhere to be found. It wasn’t in Qt Creator. It wasn’t in the folder I had created. Not only that, but the menu selection to create a new project was now grayed out.

(“I felt a great disturbance in the Force, as if millions of voices suddenly cried out in terror and were suddenly silenced.”)

Not a promising start.

I quit Qt Creator and re-started it. This time after naming the project, I just accepted the defaults. Now my project showed up. Now I just need to build and run it.

Hello World in Qt Creator

Hello World in Qt Creator

After a bit of searching in the documentation, it seems that I need to set up a Build and Run Kit.

After a bit more searching, it looks like I have to drop down to a command line and type in a bunch of code to create the kit by hand. You know, just like the Founding Fathers because FREEDOM.

I’m not going to do it.

I’m not stupid. I have all of the developer tools installed. I don’t have a problem typing commands in a terminal. I understand the reasons that this is happening is that Mac OS X deploys applications as self-contained packages and since Qt has its own code libraries, I have to hand-carry the bits into a package, as it were.

This is 2014. You offer me a graphical code editor that produces graphical applications on a modern operating system. If you can’t let me develop, build and run from the GUI out of the box with your own IDE, then I’m done with you.

I realize that at this point thousands of Qt developers are probably lining up outside my door to punch me in the throat, BUT…

If I was a professional Mac developer, with experience using XCode, Xamarin, Eclipse and even Visual Studio (which I have), what POSSIBLE reason could you give me to try Qt after this experience?

This is fixable, fellows. Get on it.

2 thoughts on “#52WeeksOfCode Week 20 – Qt

  1. Hi,

    sorry to hear about your problems with evaluating Qt. The fact that there were no kits installed and you stated going for “Qt Creator” somewhat implies to me that you downloaded the Qt Creator standalone packages and not Qt. If that is the case, please be noted that Qt Creator can (and is actively) used outside of the Qt context for C++ development as well. Hence to evaluate Qt, you should download Qt itself (available here: http://www.qt.io/download/ ), which contains Qt Creator as one package.

    Please don’t punch me in the throat if I misread your article, just trying to understand what went wrong in your setup. 😉

    Would you be able to tell a bit more about which package you downloaded, where you installed Qt etc.? You can also use our bugtracker available at https://bugreports.qt-project.org in case you have time.

    Looking forward to your feedback.

    • Based on your comment, I went back to read my post on Qt.
      Wow, I think I must have been having a bad day. That was *cranky*.
      Anyway, I’d like to thank you for the great comment. There’s a lot of outrage on the Internet these days so it’s refreshing to find polite and constructive feedback.
      I’m not sure if you’ve read any of my other #52WeeksOfCode postings but I approach each language or framework as an interested amateur who isn’t a professional programmer (I’m not) but has a programming background (I’ve taught undergrad programming classes and I also code as a hobby). The first question I have with each technology is “How many barriers are between me and the code?”.
      For the most part, the Qt Project does a good job. I just had a problem with the final step: building and running a simple project. I’d like to talk to you about this further, if you don’t mind. Please drop me an email at tsinclair552 AT gmail DOT com and we can continue this in a more conversational manner. (Plus I have a few more questions for you that I’d like to ask offline.)

Leave a comment