Click to See Complete Forum and Search --> : simple qt


Gaccm
08-19-2002, 01:08 AM
can someone give me a strating script for Qt. Something that is basicly: Type in a number (form for user to type in number), if number = 42 then print "you are very spiffy."

I went through the walkthrough on doc.trolltech.com but i'm still not able to do this simple thing.

Gaccm
08-20-2002, 12:31 AM
your telling me no one knows how to have simple user input in qt??

truls
08-20-2002, 04:59 AM
No, I'm telling you it's summer and people are busy. I'll answer this when I get some spare time and access to my *nix.

With only access to the API I can tell you a simple solution though. You'll have to write the code yourself if you can't wait until wednesday/thursday:

Create an application with a single button.
Connect the buttons clicked() method to a slot.
In the implementation of your slot call the QInputDialog::getInteger() method and check the result. If it is 42 (or whatever non-Adams number you want) output the result. If you want the result as a dialog use the QMessageBox.

Energon
08-20-2002, 06:28 PM
QInputDialog... the easy way to get input. Looks like crap, but easy...

Gaccm
08-20-2002, 06:43 PM
w00t w00t. thamks guys, i was able to program the little prog myself. Now I just need to figour out how to have a form inside the page (not a popup).

truls
08-21-2002, 03:35 AM
I recommend looking into designer, the Qt GUI designer program. The tutorials are excellent, and making GUI applications is way easier using this program. It's also known as kde-designer for some weird reason.

Gaccm
08-21-2002, 08:22 PM
heh, i checked it out, I would rather learn how to code the ui myself is the thing. But, hopefully i can use this and then learn from it's output.

Energon
08-21-2002, 09:08 PM
The only real use I've ever found for the designer is doing just that, designing the interface, seeing what it takes as far as button clicks to get what you want (ie, click the horizontal layout button to get an effect) and recreating that in the code.