PDA

View Full Version : 2 noob questions.. but Nokia's site doesn't open so I can't find the answers there :(



danoc93
27th January 2012, 21:40
I'm working on qt creator... so my question is, as noob as it might sound:

If I have a window, with one text box and a push button, how can I get the text from that box and put it into a string... basically it must be something inside the "on_button_clicked" function...but I don't know what... the nokia site doesn't open for me so I can't search there... :S...

Oh and another question... can I do operations with that string on qt like i'd do on any normal c++ ide? Can I include string.h, cstdlib, etc?? Or do I need to do something special to get to do that...

wysota
27th January 2012, 21:47
the nokia site doesn't open for me so I can't search there...
Too bad you consider us the second line of defense...



If I have a window, with one text box and a push button, how can I get the text from that box and put it into a string... basically it must be something inside the "on_button_clicked" function...but I don't know what... :S...
Look for a method from QTextEdit (or QLineEdit or whatever you are using) API that returns a QString object.


Oh and another question... can I do operations with that string on qt like i'd do on any normal c++ ide? Can I include string.h, cstdlib, etc??
Yes, you can. By the way... wouldn't it be easier to just try and see instead of asking?

ChrisW67
27th January 2012, 22:54
2 noob questions.. but Nokia's site doesn't open so I can't find the answers there :(
The Qt Developer Network online should not be your first choice anyway. Every install of Qt has this minor inconvenience called Qt Assistant: the command is "assistant". In it you will find tomes of great wisdom, including the API documentation and examples-a-plenty.

If you use Qt Creator, then you don't even need to start Assistant itself because the functionality is embedded in the IDE. Just select Help from the left tool bar or type Ctrl-K, a question mark, a space, and then start typing a term to search for in the manual.

A really good place to start would be to search in Assistant for "getting started". To answer you specific questions you might search for QLineEdit or QTextEdit (whichever you are using) and QString (for ways to work with other string representations).