Develop Qt C++ applications in Eclipse

Posted by aportale on July 11, 2007 · 23 comments

Trolltech is about to release its development tools as Qt Eclipse Integration. Here is a short introduction in Q&A style to what it is and how you can start hacking, today, plus a few screenshots.

About

  • What is Eclipse?
    Many people think of it as just a Java IDE. But Eclipse is a plugin-based platform for creating (for example) IDEs. It is often shipped with the Java development tools, hence it offers a Java IDE out-of-the-box in those cases.
  • Does Eclipse support C++ development?
    Support for programming languages in Eclipse is realized via plugins. There are Eclipse plugins for all possible languages. The standard C++ Plugin for Eclipse is called CDT. It brings GDB based debugging, managed makefiles, simple refactoring and so much more to Eclipse. Trolltechs Qt Eclipse Integration is built on top of the CDT.
  • What does the Qt Eclipse Integration add to Eclipses C++?
    The Qt Eclipse Integration seamlessly integrates the whole Qt development workflow:

    • Pure qmake based project management (not imposing Eclipse specific project file formats) with a .pro file importer and graphical project editor
    • Embedded, well known UI Designer with its Form- Property- Signal/Slot- and Action editor
    • Wizards for creation of new Qt gui and console projects. Wizards for creation of new Qt classes.
    • Embedded Qt Resource editor
    • Integrated Qt reference, a Qt Eclipse tutorial and a “cheat sheet”
  • Which platforms are supported?
    The plugin runs on Windows and Linux x86. Debugging does not work on Windows x64, because GDB crashes, there. OSX will be supported in a later release.
  • What do I need in order to start?
    Download and install the following ingredients:

  • How do I start?
    Start Eclipse (on Windows, use the “Start Eclipse with MinGW” shortcut from the Start Menu). Follow the instructions of the Qt Eclipse Integration cheat sheet, which will guide you through the necessary steps.
  • Who will help me?
    Subscribe to the Qt preview mailing list and post your question and browse the archive. You will get polite and competent answers

New Qt Gui Application Wizard

Define the name of the project, the type of the first UI class and the required Qt modules.
New Qt Gui Application Wizard

Code editor with auto completion

Editing code can be easy and fun when the auto completion actually works and gives usable suggestions.
Code editor with auto completion

The Qt designer components, embedded into Eclipse

The seamlessly embedded Qt Designer reduces the creation of great UIs to a few clicks. No external Designer instance needs to be launched.
The Qt designer components, embedded into the Eclipse based IDE

QShare(this)

Possibly related posts:

  1. Qt 4.6 for Maemo 5 applications on Mac OS X, take II
  2. Bringing Qt applications to Android – a quickstart video

23 comments

1 chris July 11, 2007 at 5:27 pm
 

Please don’t clip the post to a summary in RSS, it makes it impossible to read offline—one of the main reasons I use an RSS aggregator.

2 Rob Winchester July 11, 2007 at 5:42 pm
 

Bring on the Mac version! At least the Win people have VS integration… we have XCode “not so good.”

3 Alessandro July 11, 2007 at 6:35 pm
 

@chris: Should be unclipped, now. Let’s hope your aggregator still cares for it.
@Rob: We care for the Mac and its users :) There are still issues with embedding Qt widgets into SWT containers (more precisely the underlying HIViews) on the Mac. However, feedback like yours tells us to reprioritize it.

4 David July 11, 2007 at 6:38 pm
 

This is so great. I really like Qt and I also like Eclipse and now I can actually use them together.

Thank you very much!

David

5 Olivier Tristan July 11, 2007 at 6:48 pm
 

Yeah Mac version would be great.
Don’t know much about Eclipse on OSX…Xcode is not that bad :)
but fully working QT widgets inside native window as parent would be great as
I plan to use Qt in a plugin on Mac.
Good Luck.

6 Alessandro July 11, 2007 at 7:06 pm
 

@David: Thanks. You are welcome :)
@Olivier: It is already technically possible to embed Qt widgets on a toplevel widget basis (filling a complete native window), also on Mac. That is what QtJambi does, afaik. But I am afraid that this is not what you mean. Did you already post that to a mailing list, or contacted Trolltechs support about it?

7 Jason July 11, 2007 at 11:26 pm
 

What do us commercial users have to do to get it working?

8 Daniel July 12, 2007 at 8:02 am
 

Will there be any eclipse integrated Jambi generator?

9 matthias July 12, 2007 at 11:05 am
 

Last time I checked, code completion in eclipse was rather slow. Has this been fixed by now..?
Great work!

10 gunnar July 12, 2007 at 1:14 pm
 

Daniel: Are you asking for a Graphical Frontend to the Qt Jambi Generator that runs inside eclipse. The answer to this is currently no. We are investigating the option of adding a Graphical Frontend to the Qt Jambi Generator, but there even if we make such a tool I don’t see much added value for integrating such a tool into Eclipse. Should such a tool come into existence it would be a stand alone tool that works independently of Eclipse or IntelliJ or other IDE’s for that matter.

11 Alessandro July 12, 2007 at 2:14 pm
 

@Jason: Good point. The Qt Eclipse integration relies on the CDT, which itself expects to find make/g++/GDB on the system. Our Qt Windows OpenSource package comes with binaries which were build with those tools. The Qt Windows commercial package, however, comes with prebuilt Visual Studio binaries, something that the CDT or (make/g++/GDB) can not handle.
We added a small hidden feature to the Eclipse plugin which makes it possible to compile with the Visual Studio compiler from within Eclipse, but debugging does still not work, in that case.
In order to have the full functionality in Eclipse, you can compile the commercial sources package with MinGW. If that is not satisfying, please tell me, and I try to find out more possibilities.

@matthias: In the last CDT release, version 4, the code indexer was improved. I think, it is worth another try. On my machine with decent hardware, it definitely autocompletes quickly.

12 Peter July 12, 2007 at 3:48 pm
 

Speaking of CDT: Unfortunately Qt Eclipse Integration has a constraint that prevents installing the freshest CDT 4.0.0 from within Eclipse. I keep getting a warning
“Qt Eclipse integration (0.9.0) requires feature “org.eclipse.cdt (3.1.2)”, or compatible.” when trying to do so.

13 Alessandro July 12, 2007 at 4:13 pm
 

@Peter: That is a bug in the Qt plugin, or more precisely, a wrong version requirement of CDT in the plugins “feature”. You can delete the folder “features/com.trolltech.qtcpp.feature_0.9.0″ which is located next to the plugins folder, usually under the eclipse folder. Then this should not happen, anymore. The feature will be fixed, thanks for reporting.

14 caglar10ur July 12, 2007 at 10:45 pm
 

eclipse-3.3 with Qt integration crashes like following

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0xa8dc94c5, pid=17161, tid=3076708016
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_12-b04 mixed mode, sharing)
# Problematic frame:
# C [libQtGui.so.4+0x1a34c5] _Z17qt_memfill32_sse2Pjji+0×75

c++filt _Z17qt_memfill32_sse2Pjji
qt_memfill32_sse2(unsigned int*, unsigned int, int)

15 Alessandro July 13, 2007 at 6:52 pm
 

@caglar10ur: It is not easy to understand from that crash log what goes wrong. Here my first try: One common crash reason can be that in KDE under “GTK Styles and Fonts”, a style that uses Qt3 is set for GTK applications. If sthat is Your case, could You try to switch that style to e.g. “Cleanlooks” and see if it still crashes? If it does not help, could You post informations about Your system to http://lists.trolltech.com/qt4-preview-feedback/ ?. There are more people who can give answers.

16 Abraxis July 14, 2007 at 12:47 pm
 

Please please add support for Eclipse@Mac – it’s really frustrating to run Eclipse in Linux in VMWare Fusion ;-)

17 Ali July 15, 2007 at 8:31 pm
 

wow its like dream

i didnt download these yet but since my 3rd year in college (when i saw JAVA and eclipse) i just forgot every thing about other languages like C++ and others

when i knew eclipse can be used to program in C++ i hoped there will be a plugin to create visual interfaces

well i dont know much about QT but i really really want to learn it now and hopefully tomorrow (at my work place) i will download these pluge-ins and tell other developers there about it

18 Jeroen Jacobs July 18, 2007 at 9:47 am
 

I’m new to Eclipse and to Qt.

I installed Eclipse, QT and the Eclipse plug-in. Everything works except auto-completion.
How am I supposed to enable this ?

Thank you,

J.

19 Alessandro July 18, 2007 at 11:25 am
 

@Jeroen: If you type a few initial letters of a Qt class, let’s say “QAb”, and press Ctrl + Space, a list of suggestions should pop up. Did you try that?

20 Jeroen Jacobs July 18, 2007 at 12:04 pm
 

It shows me “No completions available”…

Greetings,

J.

21 liushiyan July 18, 2007 at 12:05 pm
 

非常棒!

22 Jason July 20, 2007 at 6:59 pm
 

CTRL + ‘left mouse click’ing a class or function doesn’t hyperlink to class/function prototype or definition. Instead in the bottom on the left hand side is displayed in red something like “Could not find symbol in index”. Is there a preference option or something else that i’m missing here to get this working correctly?

23 Alessandro July 25, 2007 at 7:40 pm
 

@Jeroen, Jason: This may happen because the Qt PLugin in the project specific include pathes list, currently only adds an “QT_DIR/include” entry. The next build will add all the subpathes in order to make sure that the indexer finds everything. Hope that will help you. Otherwise, please post a report containing details of your setup to the mailing list.

Comments on this entry are closed.

Previous post:

Next post: