Results 1 to 2 of 2

Thread: How to display a QChar* object using a QLineEdit object

  1. #1
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Exclamation How to display a QChar* object using a QLineEdit object

    Hi i have filled a QChar* object with some values and i need to display them using QLineEdit object.Is there a way i can do that?.I have tried QLineEdit::setText() but it only takes a const QString object.any way around this will be highly appreciated.
    here is a some code to what am trying to do
    Qt Code:
    1. QChar* geti;
    2.  
    3. QChar* idata = ime->text().data();
    4.  
    5. geti[0] = idata[0];
    6. geti[1] = idata[3];
    7. geti[2] = idata[5];
    8. geti[3] = idata[7];
    9.  
    10. displ->setText(geti);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jul 2010
    Posts
    53
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to display a QChar* object using a QLineEdit object

    Qt Code:
    1. QChar* idata = ime->text().data();
    2. QString str;
    3. while(idata)
    4. {
    5. str.append(*idata);
    6. ++idata;
    7. }
    8. displ->setText(str);
    To copy to clipboard, switch view to plain text mode 

    but better would be

    Qt Code:
    1. displ->setText(ime->text());
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Getting std::string object from QString object ( qt3)
    By joseph in forum Qt Programming
    Replies: 11
    Last Post: 28th March 2013, 20:09
  2. an XML object
    By mickey in forum General Programming
    Replies: 1
    Last Post: 10th July 2010, 22:52
  3. writing object to the file(Object Persistance)
    By jjbabu in forum Qt Programming
    Replies: 2
    Last Post: 11th June 2009, 14:28
  4. Highlidhting a single QChar in QLineEdit.
    By Zenzen in forum Qt Programming
    Replies: 2
    Last Post: 7th January 2009, 21:15
  5. Open a QMainWindow Object in QDialog Object
    By chuengchuenghq in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2008, 06:33

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.