PDA

View Full Version : QTextEdit



qoo
22nd July 2009, 10:33
Hi,

I have hobby.cpp, hobby.h, ui.hobby and main.cpp files.

I've made (multiple) QTextEdit fields inside (multiple) QWidgets. Entering/editing/removing text works fine in designer. It also works fine in preview state and even when running app after compilation, but...how to save the edited QTextEdit field(s)? :o

Some simple example would be appreciated :)

Thanks-
qoo

yogeshgokul
22nd July 2009, 10:37
I have ui.hobby and ...
qoo

.hobby is a cool extention :cool::cool:

franz
22nd July 2009, 10:42
how to save the edited QTextEdit field(s)?

Save the text fields or save the contents of the text field?

If it's contents you're looking after, check out QSettings or define your own file format and use that.

Lykurg
22nd July 2009, 11:39
QSettings should be the last option for storing a huge amount of characters (that's normally the case if you use multiple QTextEdit's). But simple take the content of your edits (returned as a QString) open a file and put the content there. For that you need QFile and probably QTextStream. Read the documentation on that. It isn't so hard.

franz
22nd July 2009, 12:32
Hm, indeed. In my mind it was a QLineEdit for some reason.

qoo
28th July 2009, 15:58
Thanks 4 the comments. I was thinking about writing the content to file but wasn't sure if it's the right thing to do...

ui.hobby...hmmm...what can I say :D thus I'm sure u know what I meant ;)

Finally my humblest apologies to Qt Centre gurus for unintentional and too simple minded thread title :eek: :D

-thanks
qoo

qoo
28th July 2009, 18:05
QSettings should be the last option for storing a huge amount of characters (that's normally the case if you use multiple QTextEdit's). But simple take the content of your edits (returned as a QString) open a file and put the content there. For that you need QFile and probably QTextStream. Read the documentation on that. It isn't so hard.

In principal I know how it's done...but I'm a newbie on this and I get confused what files (.h, .cpp .ui and/or signals/slots) I need to edit/add to make this work. I know this is quite easy thing to do - in principal and most of u in practice 2 - :D but since I've never done this I don't have the needed experience to do it from the scratch. That's why I'd need a short - yet complete example how to do it - instead of bits and pieces here and there :confused:

So if any1 knows a ready-made example - plz let me know. Me, I'm swamp in the net and haven't found a single example on this... :eek:

-cheers
qoo