Results 1 to 3 of 3

Thread: String value

  1. #1
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Red face String value

    Hi,
    I want to pass a string value to a function and the string passed is to be assigned to a label widget available in the form.

    how to declare this function?

    This is the code written for function declaration.
    void Form3::setValue(QString *a)
    {
    txtWelcome->setText(&a)
    }

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: String value

    I think it should be:
    Qt Code:
    1. void Form3::setValue(const QString &a){
    2. txtWelcome->setText(a);
    3. }
    To copy to clipboard, switch view to plain text mode 

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

    Gayathri (17th November 2006)

  4. #3
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: String value

    To add to that,

    The question is more C++ specific than Qt. It would help if you go through some C++ books also.
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. How to search a string in xml file with Qt Dom classes
    By doganay44 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2006, 20:16
  2. inserting string > 127 characters to MS Access
    By jh in forum Qt Programming
    Replies: 0
    Last Post: 12th May 2006, 17:11
  3. converting string to unsigned integer
    By mgurbuz in forum Qt Programming
    Replies: 4
    Last Post: 12th May 2006, 09:46
  4. How to get size (length, width ....) of string or char
    By Krishnacins in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2006, 09:55
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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
  •  
Qt is a trademark of The Qt Company.