03-10-2013 08:53 PM
Greetings to all.. I have just joined the community...and I have just received a dev alpha--- I have been able to upload a few crude samples to experiment with onto that device... I can write to a text or label box but i seem to be unable to read from a text box... I have tried using the connect command as shown in the lightening example
bool result = QObject::connect(opacitySlider, SIGNAL(immediateValueChanged(float)),day,SLOT(setO
and although i have a syntax error on this line, it does run nicely...
but i get a polite message that i am using an illegal void in variations of
connect (textfield, SIGNAL(textChanging(const Qstring &)), this, SLOT (onTextChanging(const QString &)));
I would love to just be able to do a strcpy( mystring, textfield.text) ..is such a simple thing possible..????
I am assuming "this" and "&" are signature tokens that pass parameters within the connect???
I would like to avoid qml intra-coding if i can... so if someone can give me a good shove in the right direction, i would be grateful... Is there a reference manual online dealing with these c++ extensions??? cheers, rich
Solved! Go to Solution.
03-10-2013 09:12 PM - edited 03-10-2013 09:20 PM
Hi! Welcome to the forums.
Signals & slots are Qt concept.
To get the text from textfield you can simply call text() method:
QString someString = textfield->text();
textChanging signal is for monitoring textfield changes.
Be careful not to make a typo when connecting signals to slots. In the line above you have Qstring instead of QString.
"&" is C++ reference. It's ignored in SLOT() and can be omitted there.
I suggest reading a Qt tutorial or a book because Cascades are based on Qt.
Also Cascades have excellent C++ API so using QML for creating the UI is optional.
Docs are located here:
The examples are on github:
Qt docs for signals & slots:
A better forum section for this is Cascades one.
03-11-2013 12:32 AM
thank you for the quick response..hmmmm...this and several permutations of it doesn't work, eh...
QString somestring=textField->text(); compiles ok
textField2->setText(somestring); compiles ok but no effect... blanks or leaves unchanged depending on perm
and this line really gets angry at me..
char and QString are not compatible... is there a type casting of some sort here...
Although I have printed and read the cascades doc, s closely, I will need to track down a QT manual.. is there an obvious bug above
03-11-2013 04:52 PM
If you really need get char* from QString then you can do it following way (assuming thisline is of type char* and enough memory is allocated):
QByteArray byteArray = textArea->text().toUtf8(); strcpy(thisline, byteArray.constData());
03-11-2013 05:18 PM - edited 03-11-2013 05:18 PM
Just a note that BlackBerry advise you not to do this to avoid security issues, better to leave the text in the QString or QByteArray.
03-11-2013 11:43 PM
Thank You very much for your kind help. It has been quite a week and learning curve.... I appreciate the very good advice I received from you... Since I am just acclimatizing myself to this environment, I am building from what I know ie C ..... the development environment is different from what I am used to..but the plus of having problems is the need to crawl around the innards of the development framework. I will need to dig thru QT and the nifty code extensions to C that it represents... I have one more problem I am resolving but I think I will give it a go using the resources you have directed me to. I hope I can return the favour at some point. Again, cheers and thanks, rich