Donkeys and Elephants and Delegates,oh my!
Check out the most popular
Create a Linux Desktop App In 14 Minutes Using QDevelop and QT4
clivecooper.co.uk — This tutorial is designed for absolute beginners, even if you have programmed in other languages and are new to Linux and C++ then this tutorial will help get you up and running with Qt and C++.
- 915 diggs
- digg it
- schestowitz, on 10/11/2007, -10/+26Another option is to take an /exisiting/ Qt application which is GPL-licensed and then modify the code, probably through reduction (feature/widget stripping). It's the permission to modify and study existing code which makes this approach so productive. And it's perfectly legal and ethical.
- fkr3, on 10/11/2007, -9/+30And a crap way to learn. You don't dive in to a completed application's source to learn how to program, you find tutorials like this that hold your hand and teach you what you're looking at.
- leobaby, on 10/11/2007, -0/+20There's no denying how helpful it is to see the inner workings of a completed program.
- bysin, on 10/11/2007, -2/+18"The word 'this' is a pointer to our application and it just says that the slot we are connecting to is in this application. Like I say I am no expert on C++ or Qt and I do not have all the answers but this explanation of 'this' will suffice until I know better."
This guy is a ***** C++ programmer. - fkr3, on 10/11/2007, -2/+5@ leobaby -
Yeah, once you actually know enough to understand any of it. It might as well be in Chinese (assuming you don't speak Chinese) if you're just starting out or learning the language.
@ bysin -
He also says he doesn't know what the necessary packages to include are lol. - RossTizma, on 10/11/2007, -20/+0Another option is to use Windows and Java and do everything better in less time.
- GMorgan, on 10/11/2007, -0/+5For those who haven't used C++ or Java, this is a pointer/reference to the object from which it is called from within.
//@rosstizma - you can call QT from within Java.// - RossTizma, on 10/11/2007, -12/+1@GMorgan
Or you could use one language, Java, and make it a webapp so it's portable. - daftman, on 10/11/2007, -0/+5Why QDevelop? I use KDevelop. Anybody here know whether QDevelop is better as I would think that KDevelop is much more polished.
And why isn't this in the programming section? - GMorgan, on 10/11/2007, -0/+2QDevelop seems to use the QT Designer RAD GUI editor just like KDevelop. QT4 is basically QT3 plus the added stuff KDE used to pile on top of QT3 in any case so KDevelop can't really be accused of being KDE centric anymore. Since this stuff is built in it makes a sizeable performance increase for KDE.
- GMorgan, on 10/11/2007, -0/+2"Or you could use one language, Java, and make it a webapp so it's portable."
The problem with that is that Swing is a pain to code in. The performance issues are gone and when you set LAF the applications look native now (have a look at Netbeans 6 under GTK LAF in Java 6, looks as native as any GTK app). This doesn't alter the fact that the code is just awkward. It's not enough to be cross platform, it must be easier to code in (the rest of Java isn't bad but Swing). Fortunately I think JavaFX is going to save the platform here. You can mix JavaFX and Java classes at will and it is *much* easier to code GUI's in JavaFX. I think this sort of mixed language development on the JVM will be the future of it. Other environments talk of allowing access to other languages and Java is criticised as being 'All languages are 4 letters long and start and end with J and a' but the work of Java integration with other languages is fantastic and they are ahead of other portable platforms on this front*. Now if only Sun would advertise this fact rather than letting the FUD spread.
Still I'd like a competent Qt LAF for Swing. Until then I'll stick with JavaQt if I use Java with perhaps a Swing port as well if it isn't too much brain *****.
*JavaFX, JRuby, Jython, Groovy and Scala can practically import all Java classes and many can go the other way as well.
- diggapleaze, on 10/11/2007, -1/+28I'm a die hard gnome user and have traditionally worked with GTK. After checking out QT4, I hate to say it, but QT is presently far far superior compared to GTK in almost every way.
I still use a gnome desktop because I prefer it's design philosophy over KDE's (I wholeheartedly believe that "less is more"). But damn, Trolltech and the FOSS contributors to QT have really crafted an amazing cross-platform widget toolkit. It's even a great platform for proprietary applications, just look at Skype, Google Earth, and Photoshop Elements. QT looks great on Windows and the Mac, which unfortunately GTK can't quite do as well (GTK on the Mac requires the user to install X11 from their OS X installation disc, and it doesn't look Aqua-native at all).
Do yourself a favor and check out an app shipped with QT called "qtdemo", or at least watch this Flash demo here http://chaos.troll.no/~marius/qtdemo/ . All I can say is WOW. A lot of people are quite surprised to see what QT is capable of after playing around with qtdemo for a little bit! Apple and Microsoft are innovating the GUI toolkits with Core Animation and WPF, so QT is really looking like the only relevant competitor for the near future.- Mejogid, on 10/11/2007, -0/+7Can you give some examples of that? I've only ever used GTK, and the C bindings in particular are a complete mess. The python setup OTOH's pretty sweet - what advantages does QT offer over that for example (besides a choice in languages)?
- hockey, on 10/11/2007, -2/+4QT4 is an impressive toolkit however. . .
From the looks of it GTK just seems to be easier to code for. I mean if you are going to need all the advanced functionality that QT gives then go for it. However if you just want to write a smaller application then GTK just seems like it would be easier.
GTK IMO doesn't provide all the bells and whistles of QT because it's just a simple widget toolkit.
I mean that "Hello World" tutorial looks like it's much more complicated than the GTK equivalent. - eean, on 10/11/2007, -0/+4mejogid: in my experience you really have to use an API to decide whether its any good or not. Since its all about the details.
And Qt just does a great professional job. - Xanium4332, on 10/11/2007, -4/+6If only QT4 had a decent license, as you have to pay to use it commercially, which rules out using it with my company's software (and before you all start complaining that my software should be open source, if it were, I'd wouldn't be able to pay the bills (it's also sold alongside some hardware, you can't just buy the software)). So until trolltech changes their licensing terms (which would also put them out of business), I'm going to have to use GTK.
- Xanium4332, on 10/11/2007, -1/+3EDIT timed out:
Does anyone have a link to an equivalent (and up-to-date) guide for GTK/Gnome? - icefox2, on 10/11/2007, -0/+3So if you want to use Qt in a commercial non GPL application to presumably sell and make money from, but you are not making enough money to buy a Qt commercial license. Does that mean that your business might go bust soon?
- BrainInAJar, on 10/11/2007, -1/+12Hi,
Qt works on BSD, OSX, windows, Solaris...
you're not creating a "Linux" desktop app, you're creating a Qt app, it's quite portable
This holds true for most unix apps, at most you're creating a POSIX/UNIX app unless you make Linux specific system calls ( and even then most of the time they can be trivially ported, kernel modules being an exception )- M4v3R, on 10/11/2007, -2/+4Visual Studio.NET is free only for Express (the most basic edition, no remote DB support, etc.). The rest cost money as well.
Edit: Whoops, wrong thread, should be below.
- M4v3R, on 10/11/2007, -2/+4Visual Studio.NET is free only for Express (the most basic edition, no remote DB support, etc.). The rest cost money as well.
- 0011digger, on 10/11/2007, -8/+2UI looks more like dotnet for windows
- linkin1, on 10/11/2007, -17/+3except it is $900 cheaper...or free
- ThinkFr33ly, on 10/11/2007, -9/+17.NET is free, buddy. Stop getting all your information from Slashdot.
- fkr3, on 10/11/2007, -11/+6Visual Studio is available for free. The .NET Framework is available for free. SQL Server 2005 is available for free. MSDN is a vast and freely available knowledgebase full of professionally written examples, guides and explanations.
Of course, you have to buy Windows. But since the vast, overwhelming majority of people have Windows, you're the exception if you don't. - Buelldozer, on 10/11/2007, -5/+12If SQL Server 2005 is "free" then why is CDW selling it for $869???
http://www.cdw.com/shop/products/default.aspx?EDC=877965
I think you meant the Desktop Edition is free but there's a lot of different between the DE and full on SQL Server. - fkr3, on 10/11/2007, -4/+5http://www.microsoft.com/sql/editions/express/default.mspx
It's more than adequate for learning SQL Server and for many web/desktop applications. It's also freely redistributable with your applications.
It's not a solution for a heavily trafficked website or for a huge application assloads of people are going to use, but those are probably about 1% of software produced. - sirhomer, on 10/11/2007, -9/+15As usual the Microsoft fanboys come to derail another Linux thread.
- p0tent1al, on 10/11/2007, -4/+9Asp.net is proprietary and usually costs more when you looking to host it, as opposed to PHP.
- fkr3, on 10/11/2007, -8/+2It doesn't cost more to host in general, but it can depending on your requirements. If you require MSSQL it might cost you a few extra dollars a month. If you're on a dedicated it'll cost you about $30 a month for Win2003 Standard which enables you to install MSSQL ranging from free to per-processer licenses.
And if you have a job or you're a business that cost is negligible. If it's a make-or-break issue to raise that amount of money, your job or business is a joke. A couple of dollars a month, unless you have a multi-processor server and require an enterprise database, which most people don't.
Basically if you have a big site it's going to cost more to host. But if you have a big site then it's going to cost a chunk of change to host anyway because $3 accounts don't cut it. - inkubux, on 10/11/2007, -5/+8"Visual Studio is available for free. The .NET Framework is available for free. SQL Server 2005 is available for free." yeah right it's free on thepiratesbay.org
- filipf, on 10/11/2007, -2/+6.NET Framework SDK IS FREE. Microsoft offers several of its "Express" (dumbed-down versions) of Visual Studio for free. There are also free tools from other parties, most notably SharpDevelop from icsharpcode.net. As far as ASP.NET, it's also free. The Mono project provides a plugin for Apache as well. And there is a PHP to .NET compiler that makes all the PHP code run way faster under .NET.
.NET is super cool. What Microsoft needs to do is to open source it. - GMorgan, on 10/11/2007, -0/+2.Net isn't really that much different from Java. In fact the JVM is generally superior to .Net though C# is a nicer language than Java right now. Really we want C#.JVM ;).
Then again Java looks likely to get a few new toys like closures and operator overloading for the next version and there are some Java features that are superior to the C# versions. Particularly the Java enums (which are really just plain old java classes but different at the syntax level) do some interesting things that _can_ be of more use than plain enumerations like those found in C#.
- ahhell, on 10/11/2007, -10/+4All quality apps are created in 14 mins.
- headzoo, on 10/11/2007, -14/+4Geez. Why does everything in Ubuntu look like it's made for 12 year olds? Look at the difference between Qt Designer and Visual Studio, and tell me which one looks more like it's made for serious professionals.
- socokoolaid, on 10/11/2007, -0/+3Thats the Ubuntu/Vista look. Load it up in Slackware, it looks nicer. ;P
- t0ny, on 10/11/2007, -14/+1Ok here is my 1 min howto.
Open up your favorite text editor.
Write
#include
main()
{
printf("Hello world!");
return(0);
}
then save it as hello.c in ~/
then go to the cli and type 'make hello'
done! :P- zephc, on 10/11/2007, -2/+10make: *** No rule to make target `hello'. Stop.
- brianez21, on 10/11/2007, -0/+14Dude, there's no MAKEFILE! I think you mean "gcc hello.c" :D
- M4v3R, on 10/11/2007, -2/+9It still won't work, #include needs a filename:
#include "stdio.h"
But you can also omit this. - nybble41, on 10/11/2007, -1/+3"Dude, there's no MAKEFILE! I think you mean 'gcc hello.c' :D"
Actually, you don't need a makefile for a program that simple. Make has a built-in rule for "%: %.c". It also has built-in rules for "%.o: %.c" and "%: %.o". If you really wanted a makefile (so you could just run "make" or "make all") it could be as simple as
all: hello
hello: hello.c - socokoolaid, on 10/11/2007, -0/+9I think he used the angle brackets on the include file name and digg stripped it.
- zephc, on 10/11/2007, -2/+10make: *** No rule to make target `hello'. Stop.
- YodaJones, on 10/11/2007, -9/+6Hi Clive - Great article! I am going to link to you on our new ubuntunoob.com web site.
- YodaJones, on 10/11/2007, -17/+0Hi Clive - Great article! I am going to link to you on our new ubuntunoob com web site.
- dpdesign, on 10/11/2007, -9/+2I compiled the Qt stuff on my PowerBook G4 once. There's 7 hours of my life I'll never get back.
I'm still amazed at the way a 30-ish MB source download transformed into 3-ish gigs of compiled product.- Xanium4332, on 10/11/2007, -2/+7if it's 3gig then how do you think liveCD's (emphasis on CD) such as kubuntu and knoppix run, get your facts right!
- fkr3, on 10/11/2007, -0/+8I think he looked at how much space was being used .. by everything.
- bart9h, on 10/11/2007, -2/+4@xanium4332: You missed a good opportunity of staying quiet. What is included on liveCDs and all other distros is only the final binaries, but the compilation process creates a lot of object files and other intermediate files, that's why it takes 3GB.
Have you ever compiled the Linux kernel? The compressed source is 30ish MB, it expands to a lot more, and after compiling the tree consumes a huge amount of space (I don't recall, but something around 1GB maybe). Yet, the final product, the kernel image and the modules, are just a few MB in size. - GMorgan, on 10/11/2007, -0/+3make clean, problem solved.
- vikingr, on 10/11/2007, -2/+6Is there some similar Tutorial for creating a simple GNOME/GTK app?
- bmartin, on 10/11/2007, -0/+8Try doing a Google search for: GTK tutorial
- inkubux, on 10/11/2007, -1/+3Just have a look at Glade to accomplish the same kind of things :)
- Xanium4332, on 10/11/2007, -0/+4Most of them are out of date and not very good, as Glade has recently changed. Anyone got a link to an up to date gtk/gnome/glade guide? Preferably easy to follow :P
- Mejogid, on 10/11/2007, -0/+2Search for pygtk tutorials - a very easy back end with some of the best GTK bindings out there. Python's a very usefull language too.
@xanium - Glade 3 functions almost identically to Glade 2, except it obeys the Gnome HIG, has pretty icons, doesn't crash randomly and has sane keyboard shortcuts and the like - copy and paste and delete work, for example. - Xanium4332, on 10/11/2007, -0/+2OK I forgot to add that a C/C++ GTK/Gnome/Glade tutorial I think we're all looking for. A PyGTK won't have the performance for embedded devices, for example.
- adolfojp, on 10/11/2007, -0/+1@vikingr (#6923912)
http://www.monodevelop.com/Stetic_GUI_Designer
Mono and C# and GTK tutorial in a Visual Studio like designer.
- tunesguy, on 10/11/2007, -0/+5A few obvious ones come to mind:
http://www.gtk.org/tutorial/
http://www.gtkmm.org/documentation.shtml (for C++ bindings)
Also, you might want to check out the newly-released book, "Foundations of GTK+ Development (Expert's Voice in Open Source)" by Andrew Krause. - trollick, on 10/11/2007, -7/+314 minutes? 14??? That kind of app should not take longer than 1 minute.
- batmant, on 10/11/2007, -0/+3I'm a Qt developer, it's really a fun toolkit to use. I'm glad to see it's gaining traction.
Better title for this article would be create Linux / OSX / Windows desktop App in 14 minutes! It's cross-platform-ness is great. - slapthemonkey, on 10/11/2007, -0/+1Thanks schestowitz for the info.
- clivecooper, on 10/11/2007, -0/+0Thanks for all the comments everyone.
Yes, I agree, I am not a good C++ programmer, I only started C++ and Qt about 2 months ago, I have a lot to learn.
Perhaps the guys with the negative comments could paste their tutorial on C++/Qt and enlighten us all as to how it is supposed to be done?
The point behind the tutorial was to enable noobies (like me) to get started in C++/Qt and judging by the email replies I have had it would appear that most have found the tutorial useful.
Browsing Digg on your phone just got easier with our enhancements to the