Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

What 2D GUI Foundation Do You Use?

Soulskill posted more than 3 years ago | from the maybe-it's-maybelline dept.

GUI 331

Zmee writes "I am looking to build a 2D application for personal use and I will need to use a canvas to paint custom objects. I am trying to determine what foundation to use and have not located a good side-by-side comparison of the various flavors. For reference, I need the final application to work in Windows; Linux is preferred, but not required. I have looked at WPF, Qt, OpenGL, Tcl/Tk, Java's AWT, and others. I have little preference as to the language itself, but each of the tutorials appear to require significant time investment. As such, I am looking to see what the community uses and what seems to work for people prior to making that investment."

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered


HTML and Javascript? (4, Informative)

Anonymous Coward | more than 3 years ago | (#34362282)

HTML and Javascript?

The answer (1, Funny)

Anonymous Coward | more than 3 years ago | (#34362284)

Microsoft Foundation Classes

Re:The answer (0)

Anonymous Coward | more than 3 years ago | (#34362514)

Don't you mean, "Microsoft's F-ed-up Classes"?

Re:The answer (5, Funny)

Anonymous Coward | more than 3 years ago | (#34362706)

I'll create a GUI interface using Visual Basic, see if I can track 2D canvas objects.

Anonymous Coward (2, Informative)

Anonymous Coward | more than 3 years ago | (#34362286)

Have you checked out vpython? not many people have heard of it and I find it quite usable.

Obvious choice is OpenGL (2, Informative)

Anonymous Coward | more than 3 years ago | (#34362288)

OpenGL is portable across all platforms, hardware accelerated, and lightweight. Win, win, win.

Qt would be my next choice but it's not lightweight at all. You can always wrap your OpenGL app with Qt for extra "GUI stuff" if needed. OpenGL works with practically everything.

Re:Obvious choice is OpenGL (5, Informative)

TD-Linux (1295697) | more than 3 years ago | (#34362436)

OpenGL? "Lightweight"? Sure, I suppose because it's all implemented in the system, you don't have to redistribute much, but have you actually ever written anything remotely complicated in raw OpenGL? For anything resembling a GUI, the poster is going to spend months of writing low-level code that's been done a thousand times already.

Qt is heavy, but it's heavy for a reason - it includes a very nice set of tried-and-true widgets, with all the nice features and weird corner cases thought of already. It's also fairly speedy, and even more so if you use QGraphicsView, which can be optionally accelerated via OpenGL for even more speed.

Qt also has nice support for custom widgets. You can subclass any widget, or QWidget, and make anything you want. You can even integrate your custom widgets with Qt Designer, either by promoting a placeholder widget, or writing a Designer plugin so your widget is WYSIWYG.

OpenGL is so low level that everything I talked in the last two paragraphs is completely beyond its scope. Even font rendering is rather arduous, and good luck with nicely word-wrapped, formatted text.

Re:Obvious choice is OpenGL (1)

whiteboy86 (1930018) | more than 3 years ago | (#34362816)

He probably meant GLUI that is distributed along with most OpenGL packages. You get your usual TextEdit, SpinBox, ListBox etc. directly in OpenGL, the interface is clean and dumbed down enough, plus you get the benefit of close to the GL-API implementation.

Re:Obvious choice is OpenGL (2, Informative)

coaxial (28297) | more than 3 years ago | (#34362818)

OpenGL? "Lightweight"? Sure, I suppose because it's all implemented in the system, you don't have to redistribute much, but have you actually ever written anything remotely complicated in raw OpenGL? For anything resembling a GUI, the poster is going to spend months of writing low-level code that's been done a thousand times already.

Wha? GLUT [wikipedia.org] and GLUI [wikipedia.org] don't exist? Sure they're ugly as hell, but that's a different story.

I second this, OpenGL and QT are both great. (5, Interesting)

joetainment (891917) | more than 3 years ago | (#34362452)

I second the parent post. However, in my opinion, OpenGL only is pretty tough to use. It takes a lot of knowledge. (GLUT can help to get you started.)

Where OpenGL would require you to program too much functionality from scratch, I personally recommend QT, using OpenGL only where you need it. QT is easy to learn, easy to code for, provides *tons* of functionality, and it performs great. In fact it performs well enough for very heavy 3D animation software to rely on it. (Maya has now been rewritten to use QT, and it is a big improvement.) You can paint your own custom anything, and even easily integrate 3D into your project. I really can't say enough good things about QT. It is now available under the LGPL, so you can use it for open source or closed sourced projects.

As mentioned above by the parent, QT isn't lightweight, but it isn't a pig either. You can use as much or as little of the toolkit as you like, and it can run very fast and have very low overhead. It is light enough that Nokia is using it as their primary development framework for mobile apps with their upcoming Meego based phones. From my personal experience QT flies.

Also, I've had great results with PyQt and with PySide. PySide is the new, "official" binding for QT on Python. They have examples in their demo folder of custom canvas based applications, and they work great and are easy to follow. You can have your own similar program, written from scratch in Python, up and running in 10 minutes.

It should also be noted that because QT works so well cross-platform, it has a huge advantage over toolkits that are tied to a single operating system. (Particularly those from MS.) In my own work, I won't even consider using something that doesn't run on Windows, Mac, Linux, and potentially more operating systems. I use all kinds of devices, and I don't want to be tied down. QT makes cross platform development straightforward, and software like Autodesk Maya is proof that it works even for highly complex projects.

I know I'm starting to sound like a salesman, but my experiences really have been that positive. About the only downside is that there aren't current C# or Java bindings for it. This doesn't matter to me though, because I've got C++ where I need performance and Python where I want ease of use. (With Cython, you can easily have performance and ease of use at the same time.)

I hope that helps.

Re:I second this, OpenGL and QT are both great. (1)

gandhi_2 (1108023) | more than 3 years ago | (#34362708)

Thanks to you for the tip on pyside. I was looking around at this stuff and didn't know where to start.

This really IS pretty cool.

Re:Obvious choice is OpenGL (1)

euroq (1818100) | more than 3 years ago | (#34362508)

No, it is not the obvious choice.

First of all, OpenGL is a 3D framework. He is looking for a canvas to paint custom objects, and OpenGL is very hard to do 2D operations. He doesn't seem to need 3D operations at all. When you say "lightweight", what you mean is it does not have very much functionality. It barely has any canvas functions such as draw line, oval, etc. Finally, OpenGL is not nearly as easy/quick to learn as the other frameworks he mentions.

In short, OpenGL is a horrible choice for the original poster.

Re:Obvious choice is OpenGL (0)

Anonymous Coward | more than 3 years ago | (#34362592)

and OpenGL is very hard to do 2D operations.

Are you sure you've used opengl before? Because 2d operations are retardedly easy, even if you don't use glut.

Re:Obvious choice is OpenGL (0)

Anonymous Coward | more than 3 years ago | (#34362610)

It's really easy to do 2D in OpenGL. z = 0 That's all you have to do. Or just use only 2 vertexes.

Re:Obvious choice is OpenGL (2, Insightful)

TD-Linux (1295697) | more than 3 years ago | (#34362656)

Now draw a circle.
Now draw a bezier curve.
Now draw a circular gradient.
Now draw a button with the text "OK" on it.

If all you want to do is draw some textured quads, it's not terrible. However, textured quads can only get you so far, and what the original poster really wants is unknown.

Re:Obvious choice is OpenGL (1)

hairyfeet (841228) | more than 3 years ago | (#34362776)

Which is the problem with these "Ask Slashdot" sections...they just never give you enough info. There should be more of a Q&A with these things, so we can get more detail like what EXACTLY is this thing gonna do? After all a 2D network monitor is gonna have different requirements than a DB frontend. Is it gonna be networked, or a local app? How fast is it gonna update the GUI?

Without some serious detail these things remind me of my youngest asking for a game "Well what game do you want?" 'It has a girl, and battles...ohh and magic' Yeah, thanks a lot, really helpful.

How many FPS are you looking for? (3, Informative)

CosmeticLobotamy (155360) | more than 3 years ago | (#34362306)

GDI+ is good enough for low frame rates and trivial to use if you have any C# experience. If these are static controls that need to be painted and then updated on user input, it's more than sufficient.

.NET Windows Forms (4, Informative)

peterindistantland (1487953) | more than 3 years ago | (#34362318)

Nothing is easier for amateurs, even though I'm no Microsoft fan.

Seconded. (1)

Mr2001 (90979) | more than 3 years ago | (#34362606)

Seconded. Windows Forms is easy to learn, powerful enough to use for most GUI work, and if you stick to the classes that work in Mono, it's cross-platform with little if any changes required.

properly abstract your UI and it won't matter (1)

gblues (90260) | more than 3 years ago | (#34362332)

Design your application to modularize the OS-dependent code away from the OS-independent code. When it comes time to port (if it ever happens) you should only have to worry about the OS-dependent stuff with minimal modification to the core of the application.

Re:properly abstract your UI and it won't matter (0)

Anonymous Coward | more than 3 years ago | (#34362366)

Nicely abstracted UIs make programmers happy. Awesome user experiences make customers happy. In the end, customers matter. Programmers don't.

Re:properly abstract your UI and it won't matter (1)

euroq (1818100) | more than 3 years ago | (#34362622)

You have a great point, you really do. But the original poster mentioned that it was for personal use, so the programmer IS the customer.

Re:properly abstract your UI and it won't matter (1)

mabinogi (74033) | more than 3 years ago | (#34362666)

Good luck getting to that end without a programmer though.

Re:properly abstract your UI and it won't matter (1)

abdulla (523920) | more than 3 years ago | (#34362426)

The real problem with that is some of the platform dependencies won't be clearly visible until you've ported the code to other platforms. You may have designed something that works very well with one platform, but is insupportable on another. I believe there is something akin to "the rule of 3", where you only know if something is truly portable if you have successfully ported it to at least 3 different platforms.

Re:properly abstract your UI and it won't matter (2, Insightful)

TD-Linux (1295697) | more than 3 years ago | (#34362520)

While this can be a great thing, if you do this for the sake of separation, you'll do it wrong.
When separating your OS-dependent code, many people make a nice wrapper library for the various toolkits. This is a great way to reinvent the wheel yet again.
However, if you program is oriented around the GUI (a file manager, IRC client, etc), there is no good reason to separate GUI... you'll just end up with a poorly documented GUI abstraction layer. You'd be better off using any other portable GUI toolkit.

Adobe Flex? (0)

Anonymous Coward | more than 3 years ago | (#34362336)

If you aren't a Flash-hater:

The IDE isn't free...but the SDK (including all the GUI widgets) is, under MPL. While the traditional usage is browser-based (iFoos excluded), Flex can also produce Windows/Mac/Linux executables that run top of on their AIR run-time (similar to .NET or Java's) :


A quick tour of what's possible: http://www.adobe.com/devnet-apps/flex/tourdeflex/web/

More information (5, Insightful)

Dan East (318230) | more than 3 years ago | (#34362338)

You haven't provided nearly enough information. Are you talking GUI interfaces, or rendering? If rendering, is it raster or vector? If vector, then what primitives do you need? Full SVG? Is this real-time, and if so, how many polygons / pixels do you need to push and at what minimum framerate?

As a totally shoot-from-the-hip, off-the-wall recommendation, I'd say OpenGL for portability, including support on iPhone / iPad / iPod touch. Note that you'll want to stick to the OpenGL ES subset in that case.

Re:More information (0)

Anonymous Coward | more than 3 years ago | (#34362516)

Read the subject line....They say GUI

flash (0)

martas (1439879) | more than 3 years ago | (#34362344)

Don't have much experience with GUI, but if you need to draw stuff, I found Flash+ActionScript to be pretty easy to jump into, w/o much tutorialling (though this was 7-8 years ago, no idea what's going on with it now; don't even know if there's a free version for non-commercial users of flash).

AWT or OpenGL (5, Informative)

Philotomy (1635267) | more than 3 years ago | (#34362352)

I'd use Java AWT or OpenGL. They're both cross-platform, and what you learn will can be easily leveraged elsewhere, since they're widely adopted technologies. (No matter what you pick, you're going to have some learning curve.)

Re:AWT or OpenGL (0)

Anonymous Coward | more than 3 years ago | (#34362728)

I would suggest Qt over those two, for the same reasons. Java runs piss poor performance for any client app I've ever made or used, OpenGL isn't a gui framework. However, the only popular platforms Qt doesn't run on is IPhone and IPad, it does run on Apple PCs though.

I had same question a while ago and went with Qt and made custom widgets no problem. The licensing has also changed recently to make it a little more developer friendly, no difference if its just for personal use.

FLTK (4, Interesting)

printman (54032) | more than 3 years ago | (#34362356)

FLTK (www.fltk.org) is still in active development and is my cross-platform toolkit of choice - C++-based, easy to use, and works on Windows, Linux, and Mac OS X with ports for other platforms available.

opengl (1)

junglebeast (1497399) | more than 3 years ago | (#34362376)

I would recommend OpenGL because its flexible, efficient, and cross platform. DirectX is a lot easier to use for 3D graphics but for simple 2D stuff I wouldn't mind using OpenGL and it's worth it for the benefit of being cross platform.

QT is getting much better (1, Informative)

Anonymous Coward | more than 3 years ago | (#34362378)

QT 4+ has been pretty decent. It has bindings for most languages and is really nice to work with.

WPF, Qt, or Python (3, Informative)

PhrostyMcByte (589271) | more than 3 years ago | (#34362388)

Out of everything I've tried (pretty much everything usable from C, C++, and C#), WPF is the best UI framework around. It is extremely flexible and can be very intimidating if you try to learn all the details too quickly, but the basics of it are easy. You should be able to pop out a good design pretty quickly. It's a shame that Mono has no plans to implement it, because everything else feels primitive in comparison.

If you don't mind dirtying your C++ with a less-than-modern design and ugly preprocessor hijinks, Qt can be a pretty solid framework. Works well on many platforms and is full of features. Has a lot of portable non-UI things too, but I haven't used much of it.

Python's UI stuff is simple but has a lot of features. Great for quick, portable apps. Easy integration with C++ if you need it.

I avoid wxWidgets. The last time I tried using it (about a year ago), I ended up very frustrated rooting around their code to find that it makes a bunch of stupid assumptions about things like DPI, default fonts, etc. that fall apart pretty easily.

I also avoid GTK, but mainly just because it always feels "off" on Windows.

Pythons UI stuff? There is no Pythons UI stuff (0)

Anonymous Coward | more than 3 years ago | (#34362434)

Python is a language with bindings to various gui toolkits like Qt/wxWidgets/Gtk2/Tk ... even WPF with IronPython. It doesn't have UI stuff of its own. You know nothing.

Re:Pythons UI stuff? There is no Pythons UI stuff (0)

Anonymous Coward | more than 3 years ago | (#34362548)

It comes with Tkinter bundled, even though it's written in Tk. It's part of the batteries that are included.

Re:WPF, Qt, or Python (4, Interesting)

forkazoo (138186) | more than 3 years ago | (#34362634)

Out of everything I've tried (pretty much everything usable from C, C++, and C#), WPF is the best UI framework around. It is extremely flexible and can be very intimidating if you try to learn all the details too quickly, but the basics of it are easy. You should be able to pop out a good design pretty quickly. It's a shame that Mono has no plans to implement it, because everything else feels primitive in comparison.

If you don't mind dirtying your C++ with a less-than-modern design and ugly preprocessor hijinks, Qt can be a pretty solid framework. Works well on many platforms and is full of features. Has a lot of portable non-UI things too, but I haven't used much of it.

Python's UI stuff is simple but has a lot of features. Great for quick, portable apps. Easy integration with C++ if you need it.

I avoid wxWidgets. The last time I tried using it (about a year ago), I ended up very frustrated rooting around their code to find that it makes a bunch of stupid assumptions about things like DPI, default fonts, etc. that fall apart pretty easily.

I also avoid GTK, but mainly just because it always feels "off" on Windows.

Hmmm... Where do I start. The "Python UI stuff" that you are talking about is probably tk. It's worth noting that you can use tk from many other languages besides python, python wasn't the first language to support tk, and tk isn't the only "UI stuff" that you can use in python. (For example, most of the GUI python stuff I've written has used Qt, which you imply requires working in C++.) For bonus points, you can even try to import Qt, catch an exception if that fails, and use tk to do your UI if Qt is unavailable on the system where you are running. All in one script, extremely portable, and nicer looking than tk whenever possible.

As for Qt in C++, as an application developer, I don't really care if the build system is a bit wonky. When I put on my architect hat, I can certainly say that Qt is a giant monstrosity that is very different from anything I would have created on my own. But, that sort of philosophical issue doesn't really effect anything when you are making an app.

Qt (5, Informative)

goruka (1721094) | more than 3 years ago | (#34362392)

Having used everything on the list and much more (such as wx, GTK, etc), as well as making my own toolkits for embedded devices and products, my personal experience tells me hands down that Qt is the best choice for anything GUI related. It's power, ease of use, tools, documentation and learning curve are unparalleled to this day and age. Any other toolkit or API I've use fails in one or more of such areas.
Qt is the only toolkit that made me feel as if they could know in advance everything i'd ever need (so when i go to the docs it's there, right how as i imagined it should be), yet keeping the bloat down with great modularization. I have used it from C++ as well as from Python [pyside.org] with great success.

Re:Qt (5, Interesting)

Anonymous Coward | more than 3 years ago | (#34362422)

I agree with this. Qt is seriously really awesome.

I've also used everything on the list (Java AWT, Swing, Gtk, C# & .NET Forms, WPF, OpenGL, WxWidgets, MFC, GDI+, etc) and nothing comes even close.

While some of the things on the list are pretty easy to use (arguably as easy as Qt), they lack something major (such is portability or speed for example). For example, I worked at a place where we used to write some apps in C# due to customer request - it turns out that we had to write several components in native C++, then export the interface to C#. That was the only way we could meet the speed requirements! So much for non-native languages...

Since version 4.x, Qt library has been modularized into different components (e.g. GUI, Network, XML, etc) and thus it is not bloated as some people are suggesting. A Qt GUI DLL is nothing bigger than WxWidgets one for example.

The catch is that Qt is a entire framework (something similar to Java Class Library or .NET framework) for building applications. So for example, if you were to use GTK or OpenGL for graphics, you'd have to use another library for threading and another library for network, XML, etc.

Qt has components for all of those things.

Oh, I also found that no other framework comes close to Qt when doing OpenGL. There are certain annoyances when programming with GLUT for example, but if you use Qt as a base for OpenGL, you just override couple of functions such are initGL() etc and you have an OpenGL application up!

It also has excellent tools and amazing documentation! Did I mention that its portable? :)

Re:Qt (3, Interesting)

Twinbee (767046) | more than 3 years ago | (#34362450)

I initially wanted to use Qt for my latest project, but I'm rather concerned at the license which says you can't upgrade to a commercial version of the Qt license if you start the project as the free (beer) LGPL license. It makes no sense because a project may start off small, but then expand later.... and at that point, you can't then use the better (albeit expensive) full license. I moaned about the subject here:

http://www.qtforum.org/article/34891/licensing-issue.html [qtforum.org]

I'm hoping Nokia will adjust their stance on this issue, otherwise .NET/Winforms/WPF looks ever more tempting.

Re:Qt (5, Informative)

simula (1032230) | more than 3 years ago | (#34362604)

What do you want from the commercial license that you aren't getting with the LGPL version?

The LGPL license allows you to close your product and distribute it without opening your source code as long as you link to the Qt dynamic libraries.

If you make changes to Qt itself, you are required to open those changes back up, but as long as you utilize dynamic libraries, you can make your app as closed as you want.

Re:Qt (1)

forkazoo (138186) | more than 3 years ago | (#34362760)

To be fair, I'm not sure how strictly that provision is actually enforced. If you actually show up with a pile of cash and try to sweet talk your salesman, I'm pretty sure he'll do just about anything to take some of your cash. Besides, there are relatively few cases where you would really need something other than LGPL. Under LGPL, you can charge for your software, keep your application source closed, and even make extensive changes to Qt itself. The only thing you would need to do is make changes to Qt available as source. There are certainly some cases where GPL doesn't meet the needs of a particular project, but for a typical application developer, it's more than good enough. (And, while Qt may not work for a specific project, IMHO it's still well worth learning because there are so many projects where it can be a very useful tool.)

Re:Qt (1)

Kjella (173770) | more than 3 years ago | (#34362796)

This was a lot more true when Qt was GPL, but being LGPL you can write and sell closed source applications with it as long as you contribute back any improvements you make to the library. Other people will not be able to give away copies of your software because the GPL only gives them distribution rights to the library, not the whole thing as with the GPL. Very few projects should need the commercial license anymore, and if you do because of some anal platform requirements like iOS or consoles then Qt doesn't support those platforms anyway. If all you want is Win/Mac/Linux then I don't see any reason to not use Qt.

.NET (1)

TexVex (669445) | more than 3 years ago | (#34362394)

I'm personally a fan of .NET, mainly because the toolset goes a long way towards making development easy. Consider: You start the Visual Studio C# IDE, create a new Windows Forms application, then use a simple menu selection to create a new User Control class. You are given a canvas and can immediately begin adding existing controls to it, and if you want to custom-draw the whole thing then you just use the Events tab of the Properties window to create a handler for the Paint event. The paint event handler's args give you access to the control's canvas, and you're off and running. The IDE adds your custom control to the Toolbox, so you can just drag it onto a form to create an instance, and a good portion of it functions in design mode so you can check it out before you ever actually run your project.

It doesn't get any easier, I think.

I've begun learning Mono. I don't know enough about the differences between MONO and .NET, and Visual Studio and MonoDevelop, to speak to how easy or difficult it really is to do Windows/Linux cross-platform development with it. Yet.

Re:.NET (1)

wasabii (693236) | more than 3 years ago | (#34362676)

".Net" isn't a UI platform. You probably mean WinForms. Or maybe WPF. There are other UI frameworks for .Net, I used to do a lot of work in Gtk#, before I switched to WPF.

I've never used WInforms for anything serious though. Gtk# was always better than it, back then.

Qt (5, Informative)

simula (1032230) | more than 3 years ago | (#34362396)

If you are comfortable with C++, I heavily recommend the Qt framework.
  • There is an LGPL ide Qt-Creator [nokia.com] that has an integrated form designer.
  • The code you write is amazingly cross-platform [nokia.com].
  • The framework is amazingly comprehensive [nokia.com] for when your needs expand.
  • There are top notch learning resources, including excellent books. [nokia.com]
  • The Qt framework is LGPL [nokia.com].

I use the Qt framework at home and at work and I have published a couple teeny GPL'd apps:

Regardless of which framework you decide to use, I wish you luck!

Re:Qt (2, Interesting)

TD-Linux (1295697) | more than 3 years ago | (#34362464)

As much as the parent comment looks like an ad, I've used Qt and can say that my experience matches what the parent said.

I use Qt Creator as my IDE and it's great with the Designer integration. It's not quite as full-featured in some respects to Visual Studio or KDevelop (Qt works with VS as well), but the integration with the documentation and preprocessor makes up for it.

And the key is of course the documentation. Qt's documentation is possibly the best example of what a doxygen-based documentation can look like. Every class has a multi-paragraph and in-depth description, and most even have one or two code examples.

Qt has flaws (4, Informative)

valkenar (307241) | more than 3 years ago | (#34362588)

I use QT and love it too, but it has some serious drawbacks, from my perspective. The biggest is that it requires a wonky special compilation system. You either have to use the build system they offer (qmake) or you have to manually run their generator yourself (moc - though if you were a masochist you could learn to write out the files moc makes yourself and avoid using it).

I compare every IDE to Eclipse, because that's the best IDE I've seen for any language. But I've never found that CDT, the C++ plugin for Eclipse, is any good. It fails to work out of the box for me and is a pain to configure (but I haven't tried it in a few years). QT Creator, while usable, is really an immature product. There's no support for refactoring, the UI is unintuitive and awkward (for me, at least) and there's lots of little issues with it. Plus you're committed to MingW, which can be a problem depending on what libraries you want to use. Codeblocks is a pretty good IDE, but it doesn't have a QT plugin, so you're left with the problem of dealing with moc files. Visual Studio has a plugin, but it only works with the paid versions.

All of this can be dealt with (and I do) but it's annoying.

Re:Qt has flaws (3, Informative)

TD-Linux (1295697) | more than 3 years ago | (#34362646)

The "wonky" compilation system isn't bad, and the benefits it provides overcome any ideological "oh my we are corrupting the pure and wonderful C++" feelings that I might have. It's really easy to integrate into CMake, and it doesn't matter with autotools, because everything is hard with autotools.

I also don't know where you got the idea that the VS plugin works only with paid versions. It works fine with the LGPL plugin for me.

Re:Qt has flaws (1)

simula (1032230) | more than 3 years ago | (#34362740)

Qt requires code generation using the MOC utility for classes derived from QObject. Qt uses the code-gen to extend C++ a bit (for introspection) and it's there for legacy reasons (incomplete template support in old C++ compilers). QMake deals with it automatically, but it shouldn't be too hard to create a build-rule for whatever IDE you are used to using.

Qt-Creator is rapidly growing. Here is Qt-Creator's current support for refactoring [nokia.com] and I think refactoring is getting more attention in the next release. On windows Qt-Creator currently supports [wikipedia.org] MinGW and MSVC, along with GDB and Microsoft's CDB for debugging.

The Visual Studio Qt plugin does work with the open source version, but you are required to build it from source [wordpress.com] using the MSVC compiler.

If you are having any other issues with Qt, please feel free to write me.

WPF (2, Interesting)

gadzook33 (740455) | more than 3 years ago | (#34362398)

I have extensive experience using Qt under both linux and windows (5+ years), as well as WinForms. However, for the last year I've been using WPF and I think it's a dream. Granted, there are cons to it and if your bottom line is performance in all situations (e.g. this is a game) then I would avoid it. They talk a big game about high object counts, but it requires extensive virtualization and time and then it still might not work depending on what you're trying to do. That being said, WPF's use of binding is fantastic and if you do a little bit of homework on binding I think you'll be pleasantly surprised. Don't get me wrong, I love Qt (and C++ for that matter!). But for the amount of stuff I need to crank out, it's tough to beat WPF. One last caveat: I wouldn't count on Mono to bring your apps to linux. I've only spent a little time with mono, but unfortunately (in my opinion), the linux community seems to have largely shunned C#, .NET and all that goes with it.

Re:WPF (1)

wasabii (693236) | more than 3 years ago | (#34362680)

I agree. WPF's design is quite unlike any other UI toolkit I'm aware of. I wish there was a version that worked on !Windows.

Re:WPF (2, Interesting)

wasabii (693236) | more than 3 years ago | (#34362736)

The whole 'recursively templated tree' thing is really ingenious. It sets it quite a bit apart from the single tree model of all the other frameworks I'm aware of.

All the things you mentioned are primitive (0)

Anonymous Coward | more than 3 years ago | (#34362406)

even opengl :)
you could build something on top of them, but its a lot of wasted effort

You want to use
http://www.tkzinc.org/ [tkzinc.org]
http://www.wxart2d.org/ [wxart2d.org]
http://www.box2d.org/ [box2d.org]
or the like

Re:All the things you mentioned are primitive (1)

SQLGuru (980662) | more than 3 years ago | (#34362648)

SDL is easy and is supported by a wide variety of languages. Works on both Linux and Windows (per the original post). Seems like a good fit.
http://www.libsdl.org/ [libsdl.org]

A canvas to paint custom objects? (1)

Korbeau (913903) | more than 3 years ago | (#34362414)

I was about to reply some pros&cons and that in the end all frameworks have their limits and how if you try something else than asking for a birthdate in a textbox and outputing the age in another when the user hits a button you'll spend hours and hours tweaking little details (why won't it let me put an icon here! Why won't it align correctly!)

But I re-read you question and you talk about re-writing all the GUI yourself, so I don't really understand why you need a UI toolkit to start with. But you probably have not phrased your needs completely.

Anyway, the obvious answer is to try WPF for Windows if your app is for Windows.

More info needed (3, Insightful)

BitZtream (692029) | more than 3 years ago | (#34362438)

If you want 'easy' with a slightly 'limited' set of options long term, then I would say Windows Forms in a .NET language, use Mono rather than VisualStudio so you have a much easier chance of it working in Linux out of the box, and most likely OSX, FreeBSD and several others in the process. Its not required, but Mono's code completion will point you in the right direction where as VisualStudio is going to point you more towards MSy things. Though VisualStudio is much more enjoyable to use in my opinion. If you've never used either, its not likely to matter for a while I suspect, though on OS X, Mono seems to miss most initial clicks I send to it, could just be me.

That will give you all the basic controls an application gui will need and make it so you can reuse the massive amount of examples out there.

For your custom painted widget its a little different. What kind of painting are you doing?

Is it something that lends itself to OpenGL really well? If its fits well into geometric primatives, then I would go with OpenTK's OpenGL Control. Works pretty good in my experience.

How often does it update the displayed data? Is it a game/animation kind of thing or are we talking about something that renders once after the user changes a setting?

If you need a high FPS on the updates, you're going to want to use OpenGL with textures for displaying the rasterized data. You're learning curve will be a little steep I think if you're starting from no knowledge, but its probably your only solution for something that needs to be fast (I'm just flat out ignoring DirectX, which for Windows would be easier than OGL but would cut you off of Linux and the advantages on Windows aren't that great really)

If you have real slow update rates, then you could just throw a image control on a form and paint the pixels yourself one at a time, or load images from a file/resource.

If this is a project that has a long expected life and will become rather complex and need high performance eventually, then you're probably going to do it wrong the first time no matter WHAT you do now, at least, thats my experience. I never get it right until AT LEAST the 3rd rewrite :/

Re:More info needed (1)

BitZtream (692029) | more than 3 years ago | (#34362496)

I should add to the .NET part of my post that I suggest that as then you'll be able to use basically whatever language you want to use and still have access to all the goodies. I would use C# myself, but you can of course use C++, VB.NET, and tons of other languages on Windows (Not sure if Mono does VB and I'm too lazy to look :)

You can also change languages a lot easier later, say if you find out C# isn't going to cut it for you performance wise you can move to C++ in .NET initially and if that doesn't give you the speed up you need you'll have most of your code closer to being able to run outside the .NET runtime as well.

You can also wrap just about any existing C++ library in a minimal amount of code to get something you can use in .NET. I've got TONs of OLD C code that I use in .NET via simple C++.NET wrappers that I wrote by hand ... but I probably could have scripted (Hell, SWIG probably would do it for me)

All of this is based on the idea that its entirely for personal use. If you want others to help you work on it, well then you're going to want to pick langauges and runtimes that people like to use. You're not likely to see a BUNCH of support from the Linux crowd for .NET runtime environments (CLI/CLR)

He's looking for drawing, not a toolkit! (4, Insightful)

spitzak (4019) | more than 3 years ago | (#34362440)

Stop suggesting various toolkits, that is NOT what he is looking for.

He is looking for a "canvas" widget, meaning he wants drawing API.

It is unfortunate that most drawing apis are tied to particular toolkits, so he may have to choose one, but if you are comparing them you have to compare the 2D drawing primitives.

There is also Cairo and OpenGL, which are not really tied to toolkits. Though you still need to jump through hoops depending on the toolkit to get it so the graphics calls draw where you want. Sigh.

Re:He's looking for drawing, not a toolkit! (1)

M. Baranczak (726671) | more than 3 years ago | (#34362518)

Actually, we have no idea what he's looking for (and I don't think he does either). "Paint custom objects"? That could mean just about anything.

Re:He's looking for drawing, not a toolkit! (1)

tibit (1762298) | more than 3 years ago | (#34362576)

A canvas, to be useful, needs a whole lot of supporting code. If you go the whole nine yards, you end up with an application development toolkit like Qt. Suppose you have some text that needs editing on the canvas. Do you really want to implement text editing GUI yourself? While this may be simple for a fixed width font, things get tricky with kerning and multiple formattings, and you start getting sidetracked a lot when your right-to-left locale customers complain that nothing works.

Qt's QGraphicsView [nokia.com] is the canvas widget you're looking for; your items would derive from
QGraphicsItem [nokia.com]. About the only shortcoming of that subsystem is that there's no built-in support for interaction-independent views of the same scene. You can have multiple views of the same scene, but all they differ with is the viewport transformation. Thus you can't have, for example, different objects selected in different views of (windows into) the same scene, and you can't edit something in one view, stop, edit something else in another view, then come back to the first view -- both selection and focus is per-scene, not per-view like needed in such scenario.

I don't know offhand of any generic 2D canvas system that would come anywhere close to implementing a per-view interaction context -- the latter consisting at least of the selection, focus, and user-interaction elements (such as handles, pop-up menus, whatnot). Qt's canvas is perhaps the most feature-laden canvas of them all anyway, in spite of the above limitation.

Re:He's looking for drawing, not a toolkit! (1)

mysidia (191772) | more than 3 years ago | (#34362658)

If he wants a canvas framework, it sounds like he is looking for the SDL library or other multimedia game engine library, so he can build his custom GUI system.

more info needed (1)

Tumbleweed (3706) | more than 3 years ago | (#34362456)

I am looking to build a 2D application for personal use and I will need to use a canvas to paint custom objects.

Not enough info, really, but I'm wondering if you've considered making this a web app; then it would be compatible with anything with a modern browser.

Java SWT is... okay~ (1)

doublebackslash (702979) | more than 3 years ago | (#34362468)

I've done a lot of programing but not a lot of UI work outside of the browser (where most of my user interaction has been). However, I've found that the JAVA SWT to be "okay" for desktop GUI apps. Sure, it isn't as flexible as opengl or javascript/html(xml)/css, but it gets the job done for your standard inputs and outputs. If you want to do something fancier than the most basic 2d graphics (or minecraft-like 3d) you won't like it and neither will your users.

Mostly what you should ask yourself is "Can a browser do this?" and if the answer is no (sounds like it is) then ask, "Do I need anything fancy?" Those two questions will drive your decision.

Good luck. Dealing with the GUI is an order of magnitude more fiddly than all the algorithms work you will ever encounter. I should know, I'm marrying a graphics designer ;)

OpenGL + FLTK (1)

Mysteray (713473) | more than 3 years ago | (#34362474)

Been using OpenGL and FLTK for a project for a few weeks now. Hope I never have to use anything else.

My recommendations (1)

Gadget_Guy (627405) | more than 3 years ago | (#34362476)

As you have noted, it does take a commitment to learn any system. For personal projects where you answer to no one else, you should use whatever you think will be useful to know in the future. The factors involved are: what will be used for future projects at work, how important is cross platform programming, and what looks good on a resume.

For cross platform work, Qt is the way to go. Or Java I suppose, but I have found myself moving away from that language. Not for any ideological reason, I've just had a few frustrations with it over time. But you can't argue that it can be handy for the resume.

Alternatively, if you are interested in web programming, then it is amazing what you can do using HTML (especially HTML5 with its new canvas tag). If you are after a full screen application, then you can try the kiosk modes in Internet Explorer [kioskea.net] or Firefox [mozilla.org]. IE doesn't support HTML5 yet, so you would either need to limit yourself down to HTML4 can provide (which still isn't bad) or use Firefox.

If you want to learn a language that has a compiler installed by default on the majority of computers in the world, then C# is the way to go. While Visual Studio makes it easy to generate the user interface elements, it is also handy to know how to use the language in straight vanilla code so you can use the command line compiler that comes with the .NET runtime. I have knocked out a few quick hacks on other people's systems just with Notepad and C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe.

Swing + Java2D (4, Informative)

SplashMyBandit (1543257) | more than 3 years ago | (#34362512)

Who suggested Java AWT? What is this, 1998? Someone is behind on their homework :).

Java's Swing + Java2D is *fully hardware accelerated* (ever since Java 1.6.0_u10 some time ago), multi-platform, with good multi-thread support (not for rendering, you don't need that, but for the rest of the program), very customizable, and looks fantastic with the Nimbus look&feel (a standard part of Java). Swing is used a lot on the enterprise desktop (and a few shrink wrapped products too - I know I've purchased some as they were best-of-breed tools). Many of the Java Swing ttools are free and there are a lot of them (eg. Matisse in Netbeans makes creating GUIs a snap). Java2D had extensive contributions from Adobe who happen to know a thing or two about presentation. Plus, drawing in Java2D also allows printing relatively simply.

Re:Swing + Java2D (0)

Anonymous Coward | more than 3 years ago | (#34362770)

speaking of being behind on homework:

Swing is built on top of AWT, and Java2D is AWT.

Re:Swing + Java2D (2, Informative)

Philotomy (1635267) | more than 3 years ago | (#34362780)

Java2D is part of AWT (take a look at the Java2D API and its packages). Ultimately, Swing is built on top of AWT (yes, even the lightweight widgets). The OP was talking about drawing "custom objects" on a canvas, which sounds more like custom painting using Java2D rather than making use of widgets. For a widget-based UI, I think you're right on the money suggesting Swing. For painting custom objects, you're going to be using classes in the java.awt.* package.

Re:Swing + Java2D (0)

Anonymous Coward | more than 3 years ago | (#34362798)

Any look and feel that is not the native look and feel by definition looks terrible. Last I checked, Java still integrated with the system look and feel abysmally.

Quick n dirty. (2, Informative)

noodler (724788) | more than 3 years ago | (#34362526)

I haven't got a clue what kind of app you want to write, but have a look at Processing.org .
It's an abstraction layer built on top of Java (cross platformity, including web browsers).
It has loads of handy stuff for 2D and 3D, including OpenGL.
Talking about OpenGL, you can use it in it's raw form as well.
In fact, you can just write in Java afaik.

I found it very usefull for making custom ui's.

My choice (1)

bbroerman (715822) | more than 3 years ago | (#34362544)

If you want to run on different platforms, my choice would be Java and Eclipse SWT... you have a platform dependent library to send out with your app, but your app code itself is platform independent.

HTML Canvas (0)

Anonymous Coward | more than 3 years ago | (#34362554)

How about HTML Canvas with Javascript? That way it works on any platform so long as you use a modern web browser...

There are also a few nice JavaScript 2D libraries out there (google it).

I gather HTML isn't enough? (1)

holophrastic (221104) | more than 3 years ago | (#34362580)

Having no clue what you're looking to do, a modern web-browser, or next-gen with graphics accelleration, may be sufficient. I wouldn't suggest it for anything too significant, but between SVG, and general web graphics stuff -- something like imagemagick or yoru favourite command-line image processor -- most interfaces are fairly easy, and a very low learning curve. Heck, in IE you can even transform them with a matrix operation. You'd be using javascript for animation and logic.

Easy Choice (3, Informative)

fean (212516) | more than 3 years ago | (#34362608)

Adobe Air -
Easy UI interaction framework, very powerful drawing APIs, runs on windows/linux/mac/android.

http://www.adobe.com/products/air/ [adobe.com]

Latest version lets you call native apps on windows/linux/mac.

Re:Easy Choice (1, Informative)

Anonymous Coward | more than 3 years ago | (#34362792)

Glad someone finally mentioned this. You can write one app and have something that works in every major browser and as a desktop application on every major platform, including Android and iPhone. With Flex, you have a very fast path to application GUI development, and with the integration with the rest of the Creative Suite apps you have arguably the best overall set of design tools. AS3 is a solid OOP language to work with. It lacks some of the features of Java and C# (while having a few they don't), but it's great for writing event-driven applications and for working with XML. Of course, Adobe Air doesn't qualify if you need 2D GPU acceleration (and for 3D DirectX/OpenGL support we have to wait until next year).

Sooner or later... (0)

Anonymous Coward | more than 3 years ago | (#34362626)

HTML, CSS, JavaScript, jQuery, exCanvas, HTML5.

Sooner or later some potential buyer will demand your app to be on the web. It doesn't matter what kind of app it is. For desktop use, put a browser plugin in an empty windows shell and you are done.

For "personal" Apps (4, Informative)

ratboy666 (104074) | more than 3 years ago | (#34362636)

I don't have much time... I write the GUI, and any drawing logic with Tcl/Tk. Easy, portable. Any time critical or extensive logic gets pushed into C or FORTRAN (depending on what it is). Just standard in/standard out. Parse the output with Tcl, and display.

A recent example -- I needed to upgrade some systems for a client (Solaris 6 to 10). We needed to identify the binary parts (non-OS) that needed to move. I wrote a GUI tool (binport) for this. Took 2 days to write, ran on Linux and MacOS X (two of us shared the work). After the job, the tool was essentially discarded.

No time to "debug" really, and I don't typically have time for compile and test cycles. Tcl is an interpreter, with very simple syntax and semantics.

Other examples that have used Tcl/Tk -- the GUI layer for GDB, Redhat Source Navigator, etc.

Yes, it's not "sexy", or even particularly "new", but it works, and works well.

Some thoughts: (1)

goffster (1104287) | more than 3 years ago | (#34362692)

Java/AWT pro: tends to work on all platforms. con: your app generally tends to look bad on every platform.

Java/SWT: pro: tends to work well on all platforms. con: you might have to drink the eclipse kool-aid

Tcl/TK: It is a silly language. You don't want to go there.

OpenGL pro: "gui" portion tends to work on all platforms w/tweaks. con: hard to work with unless you adopt some toolkit.

In practice, however, if you really only care about Windows, write windows native code and allow WINE to take care
of the rest.

Re:Some thoughts: (1)

Philotomy (1635267) | more than 3 years ago | (#34362784)

That "con" of your app generally looking bad on every platform with AWT may not apply if you're drawing custom objects to a canvas, rather than relying on AWT widgets.

What you know, C#, HTML, Java - in that order. (0)

Anonymous Coward | more than 3 years ago | (#34362718)

Windows GUI stuff is best done in C# .Net.

Cross-platform GUI stuff is best done in either DHTML (with an appropriate widget library like jQuery UI) or in some circumstances, Java Swing or SWT.

That said, if this is personal project then you should probably pick whatever GUI toolkit is most popular for the language that you know best.

Re:What you know, C#, HTML, Java - in that order. (1)

javajosh (605786) | more than 3 years ago | (#34362746)

Yes, this sounds reasonable. I'd add Flash/Flex to the DHTML mix, too.

Enlightenment Foundation Libraries (1)

DrJimbo (594231) | more than 3 years ago | (#34362720)

link [enlightenment.org]

The EFL begins with Evas, our canvas library. Because Evas is built on several different selectable engines (Linux FrameBuffer, DirectFB, X11, OpenGL/OpenGL-ES, QTopia, etc) the platform is extremely portable, which translates thru to all of the libraries built on top of it.

Hey, if they were good enough to run a Brazilian fridge [slashdot.org], they should be good enough for you. Seriously though, you should take at look at the EFL. They are flexible, powerful and efficient. There will be a learning curve with whatever libraries you choose to use. You might as well get something wonderful in return for your investment of time and energy. You want the efficiency of OpenGL without the limitations? You got it.

Pen and paper (0)

Anonymous Coward | more than 3 years ago | (#34362754)

Then stick it to your monitor.

Adobe AIR (0)

Anonymous Coward | more than 3 years ago | (#34362772)

I use Adobe AIR. It's got both standard components (buttons, checkboxes, etc), as well as 2d and even 3d APIs for drawing custom components. You can draw stuff programatically or you can use Flash's tools. The exact same code runs on Windows, Linux, and Mac too. I don't know what sort of 2d custom objects you need, but I've really enjoyed working with it.

Documentation, Cross-platform, Stable (1)

drolli (522659) | more than 3 years ago | (#34362822)

Tcl/Tk, Swing, and (for mathematics) the Matlab GUI served me well (even if the latter one is single-threaded and awkward, its a productive and stable environment).

Clutter (0)

Anonymous Coward | more than 3 years ago | (#34362826)

Intel has sponsored development of Clutter [clutter-project.org] for MeeGo. List of features from that site:

        * Scene-graph of layered 2D interface elements manipulated in 3D space via position, grouping, transparency, scaling, clipping and rotation.
        * Animation framework, providing path interpolation, transitions and other custom effects via implicit animations.
        * User Interface definition format, based on JSON, for describing layout and animation.
        * Advanced input event handling, including multiple pointing devices.
        * Custom Pango renderer providing efficient internationalised UTF8 text rendering through OpenGL.
        * Support for high end OpenGL features such as Shaders, FBO, VBO and PBO through a low-level, object oriented abstraction API.
        * Support for media playback with GStreamer, Cairo graphics rendering, GTK+ embedding, Box2D physics engine, etc.
        * Object oriented design via GObject with a familiar GTK+ like API.
        * Runs on Linux, Windows and OSX with native backend window system support for GLX, EGL (both on X11 and framebuffer surfaces), WGL and Cocoa.
        * Support for mobile devices with fixed point internals and portability across Open GL, OpenGL ES 1.1 and OpenGL ES 2.0
        * Developed in C, with language bindings for Perl, Python, C#, C++, Vala and Ruby.

would adobe flash work? (0)

Anonymous Coward | more than 3 years ago | (#34362836)

need the final application to work in Windows, check
runs on linux, check
can be used to build 2d apps, check, lots of games and utilities to attest to this
"will need to use a canvas to paint custom objects", i'm truly not sure, i just play the games, could someone else address this point on whether it includes a internal paint app or if you have to import images from another product?
low initial time investment, again not sure though i know there are some tutorials on newgrounds and such, otoh such tutorials are more focused on games
hope it helps

Just don't use linux (0)

Anonymous Coward | more than 3 years ago | (#34362838)

It has only 0.78% market share, just use Windows development tools like the 90%+ of normal people who get laid instead of fleshlighting to tentacle porn.

OpenGL, Quartz (1)

atrus (73476) | more than 3 years ago | (#34362856)

Most portable? OpenGL. Has the benefit of not requiring huge libraries ala Qt. Consider sticking to OpenGL ES 2.0. Most useful? Quartz/CoreGraphics. Not a portable choice of course, but a good drawing toolkit none the less.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account