Results 1 to 2 of 2

Thread: doubt

  1. #1
    Join Date
    Oct 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post doubt

    hi,
    i am trying to replace the below code in vc++
    Qt Code:
    1. LPCSTR p1,p;
    2. if (*p1 == *p++)
    3. return p1+1;
    To copy to clipboard, switch view to plain text mode 

    what i have done till now is

    Qt Code:
    1. QChar *str1data,strp;
    2. if (str1data == strp++)
    3. {
    4. return str1data+1;
    5. }
    To copy to clipboard, switch view to plain text mode 
    compile error that i am getting :QString::QString(QChar)' : cannot convert parameter 1 from 'QChar *' to 'QChar

    What should be done regarding this? I am poor in programming plz bear with me...
    Last edited by jpn; 8th February 2008 at 09:09. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: doubt

    It has been a long day and I am kind of tired. I hope I am writing this correctly. You were declaring one "pointer to QChar" and one "QChar". If you want both variables to be pointers, you can declare them like this (* before both variable names):

    Qt Code:
    1. QChar *str1data, *strp;
    2. if (str1data == strp++)
    3. {
    4. return str1data+1;
    5. }
    To copy to clipboard, switch view to plain text mode 

    Or, you could create a typedef and use that for both as in this example code.

    Qt Code:
    1. typedef QChar* QCharP;
    2. QCharP str1data, strp;
    3. if (str1data == strp++)
    4. {
    5. return str1data+1;
    6. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 10th January 2008, 13:52
  2. Doubt about includes
    By xEsk in forum Newbie
    Replies: 2
    Last Post: 15th November 2007, 21:20
  3. QGraphicsItem HoverEvent Doubt
    By arjunasd in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 18:40
  4. Doubt ?
    By Cutey in forum Qt Tools
    Replies: 2
    Last Post: 3rd March 2007, 10:45
  5. Basic C++ doubt
    By munna in forum General Programming
    Replies: 8
    Last Post: 30th November 2006, 21:54

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.