Results 1 to 5 of 5

Thread: QTextEdit simple question

  1. #1

    Default QTextEdit simple question

    Hi I'm new in QTDesigner, so my question is very simple.

    I created a TextEdit box, where I'll write simple text, then I want to save it into a file.

    the file stuff is done, I open a file and I can add data, but my problem is that I dont know how to get the text from the TextEdit box.

    how can I get the string from the box?
    or how can I put it into mi file ?
    Is there something like: myFile<<textEditorBox.getString() ?

    I guess this is very simple, but my F1 Help file is missing and tried looking into the forum but I could't find something usefull.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit simple question


  3. #3

    Default Re: QTextEdit simple question

    thanks for your response
    I soleved my problem
    bassically I needed this:

    myfile << cajaTexto->text();

    where "cajaText" is my textEdit..

    very simple...

    thanks

  4. #4
    Join Date
    Oct 2007
    Location
    Warminster, England
    Posts
    31
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit simple question

    This works fine for Qt3, but doesn't for Qt4.2.3
    I looked through the Trolltech Qt4 examples for QTextEdit, but found no examples where the edited information was saved to a file.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit simple question

    Quote Originally Posted by Carlton View Post
    This works fine for Qt3, but doesn't for Qt4.2.3
    In Qt 4 you have to use QTextEdit::toPlainText() or QTextEdit::toHtml().

    Quote Originally Posted by Carlton View Post
    I looked through the Trolltech Qt4 examples for QTextEdit, but found no examples where the edited information was saved to a file.
    See the demos/textedit.

  6. The following user says thank you to jacek for this useful post:

    Carlton (11th October 2007)

Similar Threads

  1. a simple noob question
    By wrproject in forum Newbie
    Replies: 1
    Last Post: 1st July 2008, 23:25
  2. Simple question about QTextEdit
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 6th March 2008, 17:52
  3. a question about visualizing cursor in read-only QTextEdit
    By kennyxing in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2006, 19:52
  4. simple question on Class-Members
    By mickey in forum General Programming
    Replies: 7
    Last Post: 4th February 2006, 22:37
  5. QTextEdit Qt4: simple question
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2006, 12:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.