Results 1 to 5 of 5

Thread: qt4 & xp - QTextEdit length

  1. #1
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default qt4 & xp - QTextEdit length

    Hello,

    QTextEdit used to have a length() member that is gone. I cannot find any hint in the documentation about what to do in QT4.1.1.
    What is the way to get the length of a QTextEdit widget ?

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: qt4 & xp - QTextEdit length

    Maiby txtEdit->toPlainText()->lenght() can help?
    Or you mean max lenght that can be writed in text edit?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qt4 & xp - QTextEdit length

    Qt Code:
    1. s= qMessage->toPlainText();
    2. int NbCharRestants = NbCharSMSMax - s->length();
    3. s.setNum(NbCharRestants,10);
    4. s = TxtCharSMSMax + " " + s;
    5. model->setData(model->index(row, 0, QModelIndex()), s );
    To copy to clipboard, switch view to plain text mode 

    does not fix the problem, compile error on line 3 :
    152 C:\Qt\test\sms\menu.cpp base operand of `->' has non-pointer type `QString'

  4. #4
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qt4 & xp - QTextEdit length

    I mean the length of the QTtext String afetr user input.

  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: qt4 & xp - QTextEdit length

    Quote Originally Posted by incapacitant
    QString s;
    ...
    int NbCharRestants = NbCharSMSMax - s->length();
    Try:
    Qt Code:
    1. int NbCharRestants = NbCharSMSMax - s.length();
    To copy to clipboard, switch view to plain text mode 

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

    incapacitant (6th March 2006)

Similar Threads

  1. QTextEdit - how to limit maximum length?
    By Henrikas[MI] in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2010, 20:38
  2. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  3. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  4. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  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.