Results 1 to 2 of 2

Thread: How to display result

  1. #1
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to display result

    i have just started learning qt4 to make gui for my c++ program. I have made a dialog window in which i am taking a string input from user in lineedit box. i have made a pushbutton called "generate" which when clicked by a user calls a function called hash. Actually my problem is that i want to display hash value of the string in a textedit box, but i am unable to do so. i dont how to display the result in QT. the code which i am using is
    c = hash(phrase, strlen(phrase), 0);
    sprintf(str, "%u", c);
    textEdit->append( "hash: " + str );
    please help me. i am not sure whether textedit box is correct way to display output or i can use something else also.

  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: How to display result

    If you use QCryptographicHash:

    QByteArray plainText("Hello");
    QByteArray hashText = hash(plainText, QCryptographicHash::Md5);
    textEdit->setText(QString(hashText));

    Not tested though

Similar Threads

  1. QSqlQuery return result
    By arpspatel in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2010, 07:55
  2. QColorDialog always return 0 as a result
    By NoRulez in forum Qt Programming
    Replies: 8
    Last Post: 17th October 2009, 12:06
  3. Result of DBUS call
    By conexion2000 in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2009, 08:34
  4. Wrong compiling result by QT!!??
    By greenoaktree in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2008, 13:36
  5. mySql Result Datatype issues!!!
    By bera82 in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2006, 10:26

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.