Results 1 to 6 of 6

Thread: Saving QTextEdit

  1. #1
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Saving QTextEdit

    Hi everybody,

    I found a little strange thing on the Rich Text example (qtdemo)
    I tried to save a simple text with line spaces and greek symbols in HTML format, but the output doesn't contains any line spaces (see attachment), however if I save using plainText or PDF it works perfectly.
    Thank you for any kind of help.
    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2009
    Location
    Ukraine, Kiev
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Saving QTextEdit

    Are your Windows correct work with symbols of greek alphabet? Are your internet browser correctly open *.htm file which you just saved?
    I have the same problem, but with *.odt files. OpenOffice open files which i created in QTextEdit.

    P.S. Sorry for my English

  3. #3
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Saving QTextEdit

    Hi,
    I tried with Firefox and Internet Explorer, and Office Word and Openoffice Word, but the problem persists. However on internet explorer I can visualize greek symbols.
    This is very strange!

  4. #4
    Join Date
    Mar 2009
    Location
    Ukraine, Kiev
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Saving QTextEdit

    I don't know exactly(I'm newbie in Qt) but maybe problem is here, in source code, 'load section':

    bool TextEdit::load(const QString &f)
    {
    if (!QFile::exists(f))
    return false;
    QFile file(f);
    if (!file.open(QFile::ReadOnly))
    return false;

    QByteArray data = file.readAll();
    QTextCodec *codec = Qt::codecForHtml(data);
    QString str = codec->toUnicode(data);
    if (Qt::mightBeRichText(str)) {
    textEdit->setHtml(str);
    } else {
    str = QString::fromLocal8Bit(data);
    textEdit->setPlainText(str);
    }

    setCurrentFileName(f);
    return true;
    }
    Maybe methods "toUnicode" or "setHtml" change code page or change symbols?

  5. #5
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Saving QTextEdit

    Yes you are wright I think, but when I save using PDF or plain text it works fine.
    I tried to create a small gui with QTextEdit and save it, but I got the same results.

  6. #6
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Saving QTextEdit

    Hi everybody,

    So would like to know if someone can explain me exactly why we got this problem?

    Thank you very much,
    Cheers,
    Louis

Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  2. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  4. Saving images from QTextEdit
    By borges in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2007, 10:38
  5. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06: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.