Hello. Is it possible to create a GUI in QT with C? Or is it C++ only? Thanks.
Hello. Is it possible to create a GUI in QT with C? Or is it C++ only? Thanks.
I'm 95% sure it's C++ only.
Of course, it is theoretically possible to make a shim-layer for C to C++ translation, but it's more complicated than the other way around, and it's probably not meaningful in this case.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
The Qt library is so enormous that any shim is either going to be very application-specific, or take years to write. Or you might spend a year writing the tool which would automatically create the shim. I've seen tons of adapter layers to allow accessing C++ libraries from C, but not something as huge as Qt.
If you're using C, I'd stick with something like GTK.
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
Thanks for the information. I've not really looked up on how to make C GUI's, are there are tools out there to make simple GUI's, like QT? It wouldn't have to be cross platform, as long as it could create GUI's on Windows thats fine, but it would be great if it was cross platform, or at least Windows and Linux anyway.
Cheers.
other than GTK there's IUP which looks nice and can be used in Lua too but there's no real tutorial about it, just the reference. GTK's got books on it instead and lots of tuts. It doesn't look very good in Windows tho, it's mainly for Linux.
Gtk also has a programming and user forum. There seem to be a decent percentage of windows people there. It is also used on macs.
I have never seen it on microsoft but I just googled "gtk+ microsoft screenshots" and there is stuff to look at, if you want to judge for yourself. It probably won't "blend in" unless you make it.
Linux GUI's are 95% gtk, and all of the "desktop environments" are based on it, so it integrates well there. There are bindings for a whole bunch of languages including perl, python, and (!) php, but was originally C.
Window has it's own native GUI API, doesn't it?
Last edited by MK27; 03-17-2009 at 01:53 PM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Ok thanks for the information guys, I appreciate it.
I actually don't use a DE at all because I like fvwm and virtual viewports on a giant desk with minimal clutter.
I thought KDE was gtk because I use their Terminal, which appears to be gtk+ (it uses the gtk theme, anyway).
But now I notice Terminal is not from KDE, because they call it a Konsole. It must be from XFCE (the one with the giant rat).
So lets say 75%! What does KDE use, Qt or it's own deal?
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
KDE uses Qt exclusively as far as I know.
In fact, I'm pretty sure that KDE came about before GTK+; KDE was using the Qt library which was then a shareware application. A few people didn't like this (for freedom reasons) and so started Gnome. Then eventually Qt became open source and so Gnome lost the moral high ground.
I probably have it wrong; look online if you want the real story.
[edit] Personally, I'd probably say that at least 50% of Linux applications are Qt-based, as a rough guess. This is partially based on my assumption (possibly invalid) that C++ programs tend to use Qt instead of GTK+ and that C++ programs are a little more common than C ones these days.
(FWIW, I'm biased. I prefer KDE these days. Sorry, zacs7.
Gnome messed up my shortcuts taskbar one too many times, and I was using Konsole and KDevelop anyway, so I decided to switch to KDE.) [/edit]
Last edited by dwks; 03-17-2009 at 02:57 PM.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
I still think it is beyond ridiculous that the window managers available for both KDE and GNOME ignore this if you put in xorg.conf:
Which to my mind, the virtual viewport is worth way,way more than any of the gimmicky candy and clutterbars.Code:SubSection "Display" Virtual 2560 1600
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
If you are using C then I'd recommend GTK+. You can use Glade3 to graphically design your GUI, which should do the job for simple GUIs, plus you can switch languages but keep your designs if you find C getting too tedious. Personally I prefer using pygtk as GUI programming is pretty dull and the processing generally isent very intensive. I'd rather get as much done as fast as possible... Maybe port the code to C when I have a prototype that I want to improve.Thanks for the information. I've not really looked up on how to make C GUI's, are there are tools out there to make simple GUI's, like QT? It wouldn't have to be cross platform, as long as it could create GUI's on Windows thats fine, but it would be great if it was cross platform, or at least Windows and Linux anyway.
Cheers.
Last edited by mike_g; 03-17-2009 at 03:44 PM.
Dumb indeed. I haven't bothered trying to find a way around (if there is one) because l prefer a blank desk except for a nice fat fvwm2 pager, and mouse button menus. Since the introduction of stuff like dbus and changes in "theme management", you have to do a bunch of hacks and tweaks to make gtk work there like it does in GNOME, et al. Sad.
I've always thought the intent of the whole linux DE industry was to create an interface more appealing and comfortable for people coming from microsoft or mac. But I've never seen a real UNIX box either.
I have gone back to using GNOME sometimes lately because I am supposed to be writing software for it, and it's nice and everything, but I still keep thinking, wow, it's sad the DE industry didn't get more creative (I mean in terms of functionality and different approaches, not just a "spinnning 3D cube" clone of the windows desktop). The "box" that GNOME, KDE, XFCE, etc. all seem to work within is way smaller than the potential box provided by X.
Last edited by MK27; 03-17-2009 at 03:53 PM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge