Gui toolkits, which should I use? [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am writing a fairly large and complex data analysis program and I have reached the point where I think it is about time to build a GUI for the program. So my question is:
Which GUI toolkit should I use?
I am completely new to coding and building GUIs and would appreciate any guidance that can be offered. It doesn't have to be the simplest tool kit in the world, I learn rather fast. However, it does need to be able to do the following things (some if not all of these are probably incredibly basic for any given toolkit but I thought that it would be good to throw all this out there just in case).
It has to allow me to draw directly to the screen so that I can put graphs (spectra really), plots and things like them up for the user to see. I need to be able to collect position information on where they clicked on aforementioned spectra. I need to be able to display text and take text input from the user. It needs to be able to generate menus (you know File, Edit, etc). If it were to have some built in widget for generating tables that would be handy (though I can surmount a lack of that if I can draw directly to the screen). It needs to be able to pop up warnings, dialogue boxes, save and open boxes, etc. That is pretty much it, most of these seem pretty basic when I write them out but I don't want to get the GUI partly coded and then realize that I I need to rewrite it with a different toolkit.
It should be noted that I have written this program in C++ and that I don't want to have to write the GUI part in C or something else so the toolkit needs to support C++.
Additionally a cross platform toolkit would be preferable over a single platform toolkit. However if it must be a single platform toolkit then I would prefer it be for Linux.
Finally, I would DRAMATICALLY prefer an open source toolkit to a closed source toolkit.
Beyond that I cannot think of anything to add. Thank you in advance for your time and answers.
Hmmm based on the answers I shall look at both Qt and wxWidgets and see which appeals to me more. I with I could accept multiple answers as accepted but I can't, and since I am looking at two things it would be unfair to only accept one of the answers, perhaps in a week or two then I have looked at the toolkits and figured out which I want to use.

For C++, in my opinion, Qt is the least frustrating and most fully featured toolkit. Its also fully cross platform. Note that Qt will be LGPL licensed some time in March 2009, when version 4.5 becomes available. Currently, its only offered in a GPL and commercial license version.
Qt's GUI designer is good. It has lots of utility functions (scene graph library, translation support, built-in Javascript engine, built-in WebKit library). Via the MOC (a special pre-compiler) it also brings a few run-time binding capabilities and introspection to C++.
For your technical application, you might find that Qwt (http://qwt.sourceforge.net/) provides what you need. It is built upon Qt.
Qt can even be used "headless" if you want its utility support (such as networking, etc) without a GUI.
The other cross platform C++ option is wxWidgets, which is usable but not really comparable to Qt. Its a much lower level toolkit, and isn't as easy to use or fully rounded. Gtkmm is another option, in the spirit of GTK+.

Try WxWidgets. Cross platform (compile on Linux, Mac OS X, and Windows) and widely accepted.
http://www.wxwidgets.org/
Open Source too!

I see nobody commented on GTKmm. It is the C++ incarnation of GTK+, and it is a real pleasure to use. I have also used Qt, but I don't like the messy signal/connect code, the moc_XXX generated files, etc. GTKmm has signals and such, but not that preprocessing step, as well as almost all of the Qt toolkit can offer in the graphics arena.

I'd say it depends on whether or not you want the native Look and Feel of the OSes you're targeting for your application. Qt, like said earlier, is probably the easiest of the cross platform toolkits to use, however it is its own widget set. You don't get a native app look & feel unless you happen to be running on KDE.
I use wxWidgets at work. It can be frustrating at times and in some places not very polished, but it does give the native look and feel for the platforms you're targeting. It actually wraps the native UI controls to give them a common API on all platforms that wxWidgets is ported to.

I had the same question and searched for good GUI toolkits.
At the end I found out, that a GUI toolkit isn't enough - I need a complete platform independent solution providing me the build environment, IDE integration and lower level functions like network sockets and file I/O.
My result? Since nearly 9 years I use Qt (but the first years only for GUI stuff) - now I have highly complex networking apps with load balancing, massive multithreading and image processing.
You can use Qt as commercial user with professional support (like me) or just start your own projects under GPL and with 4.5 with LGPL (which allows commercial use).
The other alternatives like wxWidgets and GTK++ are very good choices for GUI programming.
But if you want a well documented and complete solution, then Qt is your choice.
Best Regards,
3DH

I'd also recommend wxWidgets together with DialogBlocks, which is a really nice visual GUI builder.
I will say that wxWidgets has a few rough edges, but the development community is very active and extremely responsive to bug reports / questions / contributions.

I use wxWidgets(toolkit) + wxFormBuilder(gui-designer) + eclipse(ide).
All tools are cross-platform and free.

Qt. Also you can use KDE which is built on top of Qt.

Related

Advantages of Windows API for C++ GUI Programming [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I started C++ programming not long before and I want to learn GUI programming in C++. I looked at windows programming and the syntax looks really difficult. So my question is, should I use windows api at all? If so, what are the advantages of windows api over a toolkit like Qt or Direct2D?
It somewhat depends what sort of application you are trying to build. Most frameworks provide a level of abstraction over the Windows API but do so at the cost of flexibility. You should try and pick a framework that's designed to build the sort of application that you are trying to build.
For building Windows client applications then the Windows API (I assume you mean the Win32 API) will do the job but is very low level. The advantage is it gives you a great deal of control and also forces you to learn how a Windows application really works. For a lot of people these aren't always positives.
If you are trying to create a more graphically rich application then Direct2D gives you this but also means that you have to learn COM and some would say this API is also quite complex.
If you are just learning C++ and want to build simple graphical applications then I would recommend checking out Cinder. It's perfectly possible to build simple graphically rich applications and games in a few hundred lines of C++. Here's an example of the Conway's Game of Life written in a couple of hundred lines.
Qt is also an option but I've not used it. Again it depends on you goal. For example one of Qt's features is cross platform portability, which may, or may not be important if you are just starting out with C++.
If you are just creating some projects for your own learning, then I would suggest that you create some GUI using Windows API without any framework. This will help you learn the internals on how things work (messaging, etc).
But to make any real world project you must choose existing framework (MFC, Qt etc) so that you can save a lot of time. You will understand the framework better if you create some GUI projects with plain Windows API SDK.
If you platform is only Windows, then you can in fact develop faster using .Net Framework. Of course there is also Xamarin that will allow you to write in C# for cross platform.
So what you choose depends on your goals.
With WinAPI you can use all Windows GUI features, controls, styles, respond to some rarely used messages etc.
It's easier to achieve native Windows look&feel.
Higher-lever GUI libraries, especially multiplatform ones, are usually "least common denominator", limited in many ways, with some controls (e.g. dialogs) reinvented just for the sake of it. You can patch your code with WinAPI calls, but that quickly turns into spaghetti.
For one, tools like Qt, OGRE, OSG, OpenGL etc are cross-platform. So you won't be stuck with using your program only on Windows.
If by windows API you meant VC++ with WM_PAINT etc, then it's worth learning it only for the sake of knowledge about how Windows works. The parts about dirty rectangles etc will intrigue you.
"I started C++ programming not long before.." - so I would advise to start with well-documented library such as QT. You'll have much to learn in C++ itself and to learn WinAPI at the same time will be twice (or more) difficult.
The answer in general depends on the requirements, and if you want to learn "GUI programming in C++" I'd say it means QT (or some other library/framework). I do not know any rich GUI projects now which are written on pure WinAPI (what for?). (If smb knows, please put a link here.)
But you can ask yourself another question - you want to learn C++ or GUI programming? :)

What is a simple, testable, cross platform C++ GUI? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am looking to build a very simple GUI for a C++ application. Fancyness, design and advanced features don't matter. What is important however, is that I can write automated tests against it, programmatically checking content of fields and clicking buttons. It also needs to run at least on Linux and Windows, preferably also Mac. Any suggestions?
Edit:Open Source tools are highly preferred.
Sorry I am a bit late in answering.
Well there are many options in GUI programming. However, since you say you want something simple without flairs and eye-candy, the choice narrows down a little. Here are my suggestions:
QT
Pretty awesome. Don't want to sound like a Nokia (or Trolltech) evangelist, but this framework has it all. Mature API, Good design, Platform independence, Flexibility you name it! However, simplicity? Well... that's not a strong point, in fact, QT is the exact opposite. It tends to be more on the extremely heavy and well-armed side, definitely not simple.
GTK+
Again, pretty cool. Supports less platforms than QT, but has a pretty mature API, works on all the platforms you mentioned, the design is pretty awesome too. Flexibility? Well the new GTK+ 3 is a lot flexible but GTK+ 2 (the current latest supported version for Windows) lacks a bit in this respect. It's simpler than QT however, less eye-candy etc. But it relies on a ton of third-party libraries, which is a bit of a disadvantage for some platforms.
For a comparison between the above two, see one of my previous answers.
FLTK
Frankly, IMHO this is the toolkit that fits your needs the best. It's simple, platform-independent, very easy to deploy and cross-compile and pretty mature (though it's community is not quite as active as GTK+ and QT). It's OpenGL based, and looks pretty much similar on all platforms (I don't know if this is a pro or con in this case ). It's got a pretty lenient license, you can statically link the entire library, no dependencies except OpenGL.
Runs on all platforms supported by OpenGL.
I am looking to build a very simple GUI for a C++ application. Fancyness, design and advanced features don't matter. What is important however, is that I can write automated tests against it, programmatically checking content of fields and clicking buttons. It also needs to run at least on Linux and Windows, preferably also Mac.
Overall, from the requirements you mentioned, I think FLTK is ideal for you. Though you should also take a look at the other two if you aren't satisfied.
Update:
Testing Frameworks:
Unfortunately, I haven't seen any good testing framework for FLTK though. For QT, there is the QTestLib. For GTK there is dogtail.
Suggest that you use Qt as mentioned above. It is mature and there are new features getting added. To test apps written in Qt, you have the following options
QtTestLib
Squish
And some more ideas on QtCentre
Update: Since there is support for Python and Qt in pyqt creating a test-suite using something like pyunit will be a good option
I am not aware of the level of support for other libraries, but good contendors are - wxwindows and GTk
QT http://qt.nokia.com/products/qt-sdk/
Have you looked into Qt library? http://www.qt.io/
You can try fltk it is cross-platform and lightweight. The other choice is qt

Making GUIs in C++ [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C++ library for making GUIs
I'm sort of new to C++, and I have made a couple simple programs, but the only way to run them is in the XCode compiler. I am wondering if there are any APIs or programs that can help me make a GUI for a C++ program and include any info if possible about that library. Thanks.
In general choosing a GUI library depends on:
The environment you are working on.
Whether you want your app to have a native look or not.
The IDE you are using.
Your expectations in terms of portability.
Which license you are ready to distribute your app into (GPL? LGPL? etc.).
So it's really hard to tell without knowing all these parameters.
Anyway, to name a few:
GTK+ / gtkmm
Qt
wxWidgets
FLTK
Fox toolkit
MFC (if you are using Visual Studio and want your app to run on Windows only).
I have used Qt in the past and it does the job pretty well and it's very well documented.
Also, from what I remember wxWidgets allows you to build GUIs that will have a native look on each platform.
[Edit]
My assumption about wxWidgets is confirmed by the following statement on their website:
Unlike other cross-platform toolkits, wxWidgets gives its applications
a truly native look and feel because it uses the platform's native API
rather than emulating the GUI.
This is a very broad question, but perhaps one of the most popular choices among many is Qt. It is powerful and importantly, cross platform.
Keep in mind it is a different ballgame if you mean GUI in terms of, say, a game interface - in this case you might need to look for something more specific, or even program your own - it's hard to tell from your question.
Is it so hard to ask uncle google and aunt wikipedia?
BTW take a look at JUCE. It's not as popular as metioned by others but it certainly deserves attention.
Since you're on Xcode, you have AppKit, the Mac OS X GUI library, available.
It will require using Objective-C or Objective-C++ but is very well integrated into that environment.

Lightweight C++ Gui Library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to create GUI applications with C++ on Windows. I have downloaded Qt, and it works well, but it has so much stuff in it and so many header files that I really don't use. It is a nice framework, but it has more than just GUI.
Are there any lighter GUI libraries out there for Windows C++ that is "just GUI"?
FLTK, if you are serious about lightweight.
http://www.fltk.org/
edit:
Blurb from the website:
FLTK is designed to be small and modular enough to be statically linked, but works fine as a shared library. FLTK also includes an excellent UI builder called FLUID that can be used to create applications in minutes.
I'll add that its mature and stable, too.
Even if wxWidgets is named here already:
wxWidgets!
Its a great and valuable Framwork (API, Class Library, whatever you may call it).
BUT: You can divide the functionality of this library into many small parts (base, core, gui, internet, xml) and use them, when necessary.
If you really want to make GOOD GUI applications, you have to use a GOOD API. wxWidgets is absolutly free (QT is not), only needs a small overhead in binary form, linked as dll or o-file is it about 2Megs, but has to offer all that you ever need to program great applications...
And wxWidgets is much more lighter than QT... and even better... :)
Try it...
JUCE is fairly light weight, it can be as simple as one .cpp & one .h file. (Look at amalgamated JUCE) It doesn't look like a standard windows app however. On the other hand, it is cross platform.
CEGUI is a powerful GUI library but I am not sure (since you did not clarify) what you mean by lightweight. It contains a lot of headers, too, but they are all related to the GUI or the rendering of it. On my computer, the current Release built in default VS2010 Release mode takes about 3 MB in total for the dlls. There are of course assets that take space too, but clearly these may vary depending on your needs. It uses XML and image files in the assets, the images take the most space. It requires a bunch of dlls depending on your requirements (png, jpeg, xml parsing dlls) but they are all quite small in Release. So unless you are irrationally pedantic about having too many DLLs in use, this should be no issue.
It is written in C++ (0.7-1.0 will be based on C99 standard, 2.0+ will be in C++11 standard) and supports dynamic and static linking. Dynamic linking is the supported type on Windows. Static linking on Windows is not recommended for CEGUI.
Here a short summary of features:
Modern (uses STL, XML for its asset files, and internally supports C99 standard for maximum compatibility, after the 1.0 Release it will be using C++11 in the development branch). It also has support for unicode characters and all sort of languages (as can be seen in the samples).
Offers the following widgets out-of-the-box: text fields (scrollable), editboxes, multiline editboxes, spinners, checkboxes, buttons, radio-buttons, tabbed windows, progress bars, scrollable panes, sliders, dropdown-menus (comboboxes), menu bars, layout containers (vertical/horizontal) and more
Published under the Open Source MIT license, one of the licenses offering you the most freedom, you will only need to distribute the license file with the application and that's it
Layouts can easily be created and edited using a WYSIWYG editor written in Python. It is called CEED and is also freely available. It has gone through a lot of testing and is suitable to be used for production. A stable Release has been published and new features are in development for the future. An imageset editor is also available in the same application.
As stated, this is free for commercial use. The only obligation you have is to distribute the license file.
CEGUI is fit for cross-platform use. It officially supports Windows, Linux, Mac OS. It has also been used on iOS and Android. Android is supported in the development branch.
It was originally designed as a GUI library for games but it is also perfect for usage in scientific applications, rendering applications, visualisation. Desktop applications can be done as well. A simple Windows-like skin is available in the default assets.
It has been around for over 10 years, has an active community and is a robust, feature-rich and extensible library.
wxWidgets
IUP is the smallest one i know, both in terms of learning curve, DLL size and features
Try eGui (see here or here) or WTL.
try GTK with Glade3.
Microsoft Foundation Class Library (MFC)
Considering you are looking for a WINDOWS ONLY SOLUTION, (and that wxWidgets has been voted up on this thread) you may want to trade off some lightweight-ness and checkout MFC.
As far as Windows is concerned, MFC and wxWidgets seem to compete neck & neck, but overall, the former is lighter than the latter.
Some PROS:-
MSVC MFC RAD support. Visual Studio arguably provides the best "RAD
tool & GUI lib" combo. The only other "dynamic duo" that comes close
is that of QtCreator & QT. wxSmith doesn't fully support all
wxWidgets components, but it keeps improving. Very Very Rich set of
commercial GUI components.
Free (but proprietary).
Very nice when it comes to databound controls.
Some CONS:-
The day you decide to port to other platforms, you will wish you had gone with a cross platform lib.
Proprietary nature of MFC means you will have to navigate licencing very very carefully. But AFAIK, MFC is free to redistribute in binary form.Here's a nice article touching on the "oil and water" that is "MFC and FLOSS applications". Apparently, they just might mix.
Anyways, appart from MFC, I think the FOX-Toolkit also deserves a mention, but just like FLTK, the major downside is lack of decent IDEs and RAD tools as compared to, say, QT or wxWidgets

Do you use Qt and why do you use it? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Pros. and cons? how long do you use it? What about jambi?
I have been using Qt for several years now for commercial development and have been very happy with it.
One of the nice things with Qt is that it provides a large set of libraries as well as the GUI stuff (eg XML parsing, threads, networking), all in a consistent style and all multi-platform. This means we rarely need to use other libraries, though we do use boost for some things.
Another very important factor for us was internationalization. In a previous, MFC based application we had to maintain 2 localized versions, for the two languages we support. In our Qt based app we just have the one version.
The Qt translation system, using linguist is easy to use and makes supporting multiple languages easy (of course you still have to translate the strings which is a lot of work!)
The GUI layout system where the widgets resize themselves according to a layout makes everything much easier. In different languages the length of the strings are different. With fixed size widgets (like MFC) each dialog needs to be adjusted for each language, otherwise parts of labels get cut off. With Qt they resize themselves. Of course, there are cases when it does not work exactly right but it still makes everything much easier.
QString does everything in Unicode and handles the conversions from different codecs very easily.
One thing that has been very valuable is the access to the source, although e this is certainly not unique to Qt. On several occasions the ability to check the Qt source has explained some strange behaviour or given a clue how to achieve something.
We have found a few bugs in Qt, some of which have been fixed after reporting to Trolltech. In other cases they have suggested a work around. These have all been fairly obscure and not had a major impact on our development.
One of the main downsides to Qt would be the lack of 3rd party libraries for use in commercial applications. However, Qt is fairly complete so for us it has not been a big problem, though that will depend on which type of application you are developing.
I have not used Jambi either.
I've used Qt on a couple of projects I did in c++ on several platforms over a period of seven years. I think it works pretty well and definitely was quicker for me to develop a decent GUI app on the Mac than plodding through a language I didn't know (Objective-C) at the time.
I think the signal/slot mechanism is a bit funky but isn't horrible. Once you're use it for a bit, it's not a show stopper. The connection stuff is easy to bungle up (or at least it was) and it's always good to check the return on those because your app will go merrily on its way and not tell you that it didn't work.
I've never used jambi.
Here are some of my Pros and Cons with Qt:
Pros:
Cross-platform
I know this one is always used, but after going back and forth between Windows and Linux with Qt, it's amazing how little I have to do to get up and running. I think this is helped by the fact I only use Vim with Qt Designer.
QMake
This is one of my favorite aspects of Qt. After doing work in wxWidgets, FLTK, etc., I get so tired of messing around with different build systems and I don't want to manually create my makefiles. I currently use CMake on anything other than Qt right now, but I think I'm slowly moving even Qt over to CMake. However it's just so easy to get going with QMake.
QTestLib
I looked at a couple other C++ unit testing frameworks and when I created my tests using QTestLib, it felt very similar to NUnit(C#) and within minutes I had several passing tests. I also noticed that it would be very easy to create my own continuous integration environment.
Closest to Java and .Net in productivity
The biggest thing I hear/read people say about C++ is, "I can be more productive with Java or .Net". From personal experience I can get a prototype of an application running in Qt using Vim and Qt Designer, before Eclipse or Visual Studio even load. I also get a very similar set of libraries in Qt that I have in .Net or Java and if it's not there I can leverage the existing C++ code out there.
Cons:
Price
This is the biggest factor I can think of right now. However, the cost is worth every cent, um if I knew how many cents I had to save up without making a call to a sales rep. I purchased a license back in the day when they had their small business discount and it was worth it then, I would've paid three times as much and I think that's the current price.
Develop anywhere with commercial license
I would love to be able to develop on any platform, but build and sell for another platform. For example, develop on Linux, then build and deploy on Windows if you just have the Windows commercial license. From what I know, you can only develop and build a commercial application on the platform you have a license for.
Vendor lock-in
Well sort of, this is more of a personal con. I don't like being tied to a specific vendor because I get side tracked by the company direction and product direction. TrollTech was purchased by Nokia, is this good or bad I don't know, but a company that size can do evil things.
I think I'm done for now :). Oh, I haven't used Jambi but I'm really interested in doing a couple prototype projects to find out how easy it is to use a plugin developed in C++ with Jambi. Especially using Jambi as a web interface with C++ plugins.
To be honest I haven't read much on it, so it may be impossible or very easy.
I used Qt in a previous job. I'd only had the absolute briefest of contact with Qt several years prior to that, so I was pretty much a Qt newb.
When I started I was told to choose my language and environment, but cross-platform support was desirable. I tried Qt and Java, and even gave C# a go just for the heck of it. I gave myself two days to evaluate each option.
Maybe I was slightly biased with my history as a C++ developer, but after spending time on each option Qt was the only one that showed any hints at being useful without a long learning curve.
The documentation provided with Qt and the example applications made it very easy for an experienced developer but Qt beginner to get up and running very quickly. I had UI prototype/mockups of the end application done by the end of my trial period. With Java/Eclipse, Java/SunStudio and C#/VS.net I had trouble getting anything nontrivial happening in that time.
Signals/slots took some getting used to, but it wasn't too bad, and I wrote some simple wrappers to assert when connections failed to stop silly typos from stopping the app. from working.
The other thing I liked is that Qt had almost everything I needed. You name it - storage, networking, GUI, threading, containers - Qt has a class to deal with it. Which IMHO is important because mixing libraries can sometimes cause problems.
Having the source code to Qt was a big plus, one for just plain interest's sake, but also it allowed me to compile Qt using the compiler and settings of my choosing, including a debug version for use during development.
I also found Trolltech's support to be fairly good. I raised a couple of bugs on Qt, one of which was fixed and released whilst I was still working on the project (only a 6 month job).
The only negative I can recall was the difficulty in debugging Qt objects (using VS) - there is a Qt plugin for VS that can examine Qt objects but I was using the free version of VS and plugins don't work for it. But that wasn't Qt's fault.
I haven't used jambi so can't comment.
On C++ your only other alternatives are MFC and wxWidgets.
QT / wxWidgets is largely a personal preference. I do think QT is a clean design with good documentation.
QT costs about one month of developer salary if you aren't using it for GPL.
I have been using Qt for over two years now.
Things I like on Qt are:
Easy GUI programming (compared to
MFC), Qt Designer
Nice container classes
Nice graphics scene framework
Excellent documentation with useful examples
Translation support
Good technical support
I can highly recommend the Qt Developer Days. If you have a chance to take part, then do it! Lots of nice and very interesting talks there.
Qt is a very nice library, but it has an expensive per-seat developer license, so it's not always useful for all projects.
Don't use it, however...
Pro:
QT has an optional 3 phase layout, where as WX only allows for 2 currently (I believe they plan to do 3 phase, just have not worked it in yet).
One of the bigger problems with using layouts is static text and wrapping. WX asks how big is your min width/height and portions out the screen, QT has option to say how wide do you want, how high do you need to be if your X wide. This allows you to express the flow of a page much better.