PDA

View Full Version : QT 4 qlabel how to work them



michellembrodeur
26th March 2011, 18:24
Ok last time I programmed was with Delphi 3 visual pascal.

I do know some C, C++

now I am using QT 4.72 QT GUI widget. Since I cannot get a GUI working in designer.

Still new, very knew.

here is the problem.

I added a qlabel called it "LStr" means Stregth.

Now I made a button call Roll AGain. and made a goto on it for the click.

I want to change the LStr test to say "18" or what ever I roll for it.

I tried LStr.SetText("18");
and
LStr->SetText("18");

but the program does not know what LStr is. ]

Should the editor (QT) know what your labels are and there names.

It was easy in Delphi but bit more confusion here.

Once I see how this is done, should be easier for me to get into the swing of things.

I hope

Thanks for all the help in advanced.

Tried to find a book but no lock here in small town of Cornwall, Ontario.

Zlatomir
26th March 2011, 18:41
You can show some code, and i didn't understood if you used the designer or not, so if you created LStr in Designer, then in C++ code you will access it through ui, something like: ui.LStr->setText(...) (in case ui is an object) or ui->LStr->setText(...) (in case ui is a pointer)

michellembrodeur
26th March 2011, 21:28
the ui-> worked

Sorry I tried to use a QT console application but had to use a QT GUI widget because I could get get a frame/panel gui interface to setup in QT console application.

like I said just learning and can not find any good tutorials on basic programing in this environment.

Zlatomir
26th March 2011, 21:34
The official tutorials look good, take a look here (http://doc.qt.nokia.com/4.7/tutorials.html)

Also this (http://doc.qt.nokia.com/4.7/qt-basic-concepts.html) page deserves be bookmarked, since it contains articles on some Qt topics, like signals and slots, model view, etc.

Also the Qt documentation website (http://doc.qt.nokia.com/) is very good.