PDA

View Full Version : Example code doesn't match help provided



norman1312
31st October 2011, 16:47
As a complete beginner to Qt, I have Qt Creator installed. The main screen gives a very simple example of how to create and then extend a simple application. The only problem I have is that when I follow the instructions I get a 'Hello World' application that bears no relationship to the example being explained, and the remaining instructions are just meaningless.
I would like to see the code that generates squares with Qt in it, but the example doesn't do that.
I have a background in C, I have been learning C++ for a while. I have Visual Studio 2010 C++ Express that does some of what I want, but the full .NET application seems unduly complex (and I couldn't afford a license, in any case). This is why I am looking into Qt, and it would help to have some help that actually matches the code that is generated.
Can someone please point me in the correct direction?
(I am only interested in desktop applications at this time)

stampede
31st October 2011, 19:19
Can someone please point me in the correct direction?
It will be difficult, because, personally, I think your post is too general and quite confusing. I guess this could be a good starting point : http://qt.nokia.com/learning/online/training
Be more specific, then it'll be easier to help.

norobro
31st October 2011, 20:35
In addition to stampede's link, you might try this:

Start Qt Creator.
Select "Getting Started"
Next to "Explore Qt C++ examples:", click on the "Choose an Example" combo box.

You should get a popup menu with the list of example projects. I don't know which example "generates squares with Qt in it". Maybe Animation Framework -> Animated Tiles? Although you should probably start with something simpler like Widgets -> Digital Clock.

HTH
Norm

ChrisW67
31st October 2011, 21:22
A veritable smorgasbord of tutorials and examples are trivially located in the documentation that comes with Qt. Typically there are many built demo programs accessible by running qtdemo, most of which link to a relevant part of the documentation that comes with Qt. You should also take the advice of the How to Learn Qt pages in the documentation. All of this documentation is also installed with Qt: just run assistant or access it (in slightly different arrangement) through Qt Creator (press Ctrl-6).

BTW: I think the reference to "generates squares with Qt in it" is to this: Icons Example

SixDegrees
31st October 2011, 21:23
You do realize that several of the example programs that ship with Qt are implemented across several files, not just one, right? It would be helpful if you bothered mentioning exactly which example it is you're talking about, what your expectations for it were and how they differ from the source code you're looking at.

norman1312
1st November 2011, 08:33
Firstly, thanks to ChrisW67 for a sensible response.
Let's get something straight. I am not stupid. I have been in this game for a very long time. In fact, I have lost count of the languages, operating systems, hardware (and applications) that I have learnt over the years.
I suppose I am going to have to do it in pictures for stampede, norobro and Six Degrees.
When I open Qt Creator I get screen qt1.jpg.
When I click on Building and Running an Example Application I get qt2.jpg
When I click on Show Examples and Demos, I only get three additional entries qt3.jpg
When I click on Create a Qt Quick Application I get qt4.jpg and qt5.jpg
When I follow the instructions shown I get the code in qt6.jpg and a window qt7.jpg comes up which does NOT match the information given in the right hand pane!
That's what I'm complaining about!
(Look like I need a second post to get 6 and 7 in)

ChrisW67
1st November 2011, 23:11
Unfortunately (annoyingly IMHO) every version of Qt Creator has changed the arrangement of the Welcome screen. Each Qt release of late has added more QML examples. My version doesn't quite match yours and I cannot find the example you are after. They should all be accessible by searching in Assistant (or the Qt Creator Help page) and most visible in qtdemo.

If the instructions in the Getting Started material are broken in the current Qt Creator/Qt then you should report it as a bug (https://bugreports.qt.nokia.com/secure/Dashboard.jspa).