Recently I began using QtCreator to try and do some development on Amarok. During my day job as a Java developer I get to work with tools like Intellij, which is a great IDE when you can put aside the problems of Java GUI apps on Linux. For a long time I’ve been using vim for my KDE development which has been more than sufficient, but lately I’m craving some of that productivity win that a fully fledged IDE can give.
Today I’ll show you how you can set up your KDE application in Qt Creator and use it’s interactive debugging to enhance your development speed. I’ll assume that you have an existing KDE project and you’re using Qt Creator 1.1, and I’m not going to do any whining about bugs and that rubbish.
Firstly, you’ll need to open a project. It’s as easy as File > Open and then find your CMakeLists.txt file. Your project should be parsed and opened. While we’re at it, let’s make sure that our compilation is optimised to use all of our computational power. Visit the Projects tab, select Amarok and under Build Steps add -j5 (or similar) to the additional arguments input.

Now let’s get straight to the debugging. Back in the Projects tab, find the Run Settings panel and add –nofork as an argument. This tells the application to run without forking so we can attach to the process without worrying about magic foo computer stuff. I’d also recommend enabling the debugging helper which can be turned on in the settings window (under debugging).
Press F5 to start the debugging the application. Either before or during, or after the application has started up, set breakpoints in the application by clicking on a margin in a source file. You’ll see a little red icon display.

When you hit a breakpoint, the application will stop as it waits for the debugger. Here’s where using the interactive debugger wins over using gdb directly. You can easily see objects in the stack and navigate between callers. You can easily switch between thread dumps, and view local variables. You can set watches and not have to worry about remembering all the fiddly commands and what you are and aren’t watching. Stepping over and into functions is a breeze with the keyboard shortcuts (F10 and F11 to step over and into respectively).
This quick guide should hopefully be applicable to any KDE app, not just Amarok. I’ll let you discover the intricacies of using gdb as a debugging tool from within the IDE.








“…tab, select Amarok and under…” should probably read “…tab, select the name of the project and under…” or similar to avoid confusion.
Apart from that, thanks for this little walkthrough.
You just posted pretty much what I was writing in a half complete blog post I started yesterday
Thanks for the walk through, I installed 1.1 over the weekend and was really pleased with the CMake integration. That coupled with the debugging and Git integration makes for a really nice IDE. I will certainly be recommending Qt Creator.
Is this feature specific to QTCreator 1.1? I am using 1.0 and when I tried opening a cmakefiles.txt, it just opened that file with out opening project.
@Karthik: CMake support was greatly improved for Qt Creator 1.1. I remember also having problems trying to open a CMake project with 1.0.
Pingback: Wieści z Planety nr 2 - Silezja.eu