Results 1 to 8 of 8

Thread: Count number of Characters

  1. #1
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Count number of Characters

    So, howto count number of characters in QString???

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Count number of Characters

    Without you defining "characters" I guess you mean:
    QString::size()
    or
    QString::length()

  3. #3
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: Count number of Characters

    I need something like

    void SomeClass::someslote(QString value)
    {
    if (count(value)>12)
    {
    cut(value,12);
    }


    }
    So cut is function which cuts string to 12 characters and placing "..." at the end of the string.

    for example
    QString str = "some blah blah blah blah";
    cut(str,12);
    so after this function we will recive "some blah bl..."

    How to do this using qt????Is there any function that can cut strings?

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Count number of Characters

    Quote Originally Posted by TJSonic View Post
    Is there any function that can cut strings?
    Yes. See the documentation.

  5. #5
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: Count number of Characters

    Can you please tell me which?

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Count number of Characters


  7. #7
    Join Date
    Mar 2010
    Posts
    38
    Qt products
    Qt4
    Platforms
    Windows Symbian S60

    Default Re: Count number of Characters

    Ok, can i set fixed size for tab in tabWidget?

  8. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

Similar Threads

  1. Count number of directory nesting
    By franco.amato in forum Newbie
    Replies: 5
    Last Post: 1st October 2010, 21:08
  2. Count the number of rows in a QTableView
    By grub87 in forum Qt Programming
    Replies: 9
    Last Post: 28th June 2009, 16:31
  3. [QGLWidget] Count FPS
    By Macok in forum Qt Programming
    Replies: 0
    Last Post: 13th April 2009, 14:01
  4. Maximum number of characters in width
    By ralphmerridew in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 01:55
  5. count line number in text
    By Alina in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2006, 08:29

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.