Results 1 to 2 of 2

Thread: With QString create a QString&

  1. #1
    Join Date
    May 2006
    Posts
    57
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Unhappy With QString create a QString&

    Hi..

    In the next code used the validate function:

    Qt Code:
    1. if( HX->validator()->validate(HX->text(), p) == QValidator::Acceptable)
    2. {
    3. ...
    4. }
    To copy to clipboard, switch view to plain text mode 

    When I compile this code mark this error:

    error: no matching function for call to `QValidator::validate(QString, int&) const'
    note: candidates are: virtual QValidator::State QValidator::validate(QString&, int&) const

    Then I need give a QString&, but I don't have a clue...

    Please help

    I Use Qt4.1

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: With QString create a QString&

    Use:
    Qt Code:
    1. QString str = HX->text();
    2. if( HX->validator()->validate(str, p) == QValidator::Acceptable)
    3. {
    4. ...
    5. }
    To copy to clipboard, switch view to plain text mode 
    And see also QLineEdit::acceptableInput

  3. The following user says thank you to Lykurg for this useful post:

    avis_phoenix (27th April 2010)

Similar Threads

  1. Replies: 4
    Last Post: 1st February 2010, 14:21
  2. qstring::contains
    By the goat boy in forum Qt Programming
    Replies: 2
    Last Post: 14th August 2008, 07:42
  3. QString help
    By mabeeh in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2008, 21:50
  4. Replies: 4
    Last Post: 31st January 2008, 20:44
  5. how to copy part of QString to anothe QString
    By nass in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2007, 19:05

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.