×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Post How to set Individual color for every parse Value???

    Hi All,
    I am developing an application in which i am declaring an array and get the parse value for those. In which i have to set different colors for every individual values,

    Here is the lines of code:

    for(int i=0 ; i<name.count(); i++)
    {
    QString Name = name[i];
    QString Tips = tips[i];
    QString City = city[i];
    QString Time = time[i];

    strList << Name + "\n" + City + "\n" + Tips + "\n" + Time;
    }
    ui->listWidgetmyprofile->addItems( strList );


    I want to set individual colors for name,city,tips and time. Please come up with an answer!!!!
    Is there any coding or properties that is to be set for that??

    Thanks in advance and Regards,
    Naufal.A
    Last edited by naufalahad; 2011-11-25 at 05:34. Reason: Grammatical mistake

  2. #2
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to set Individual color for every parse Value???

    Hi all,
    Please anyone help me in setting color for every value in the array!!!
    Answers will be very much appreciated!

    Thanks in advance and Regards,
    Naufal.A

  3. #3
    Nokia Developer Expert
    Join Date
    Feb 2008
    Posts
    183

    Re: How to set Individual color for every parse Value???

    QString by itself is not a visual representation of the text. Either put the strings to QLabels and concatenate those, or use html as part of strings and then display it as html.

  4. #4
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to set Individual color for every parse Value???

    Quote Originally Posted by Fuzzbender View Post
    QString by itself is not a visual representation of the text. Either put the strings to QLabels and concatenate those, or use html as part of strings and then display it as html.
    Hi,
    Can i get some sample code or how to convert qstring to qlabel and use them???
    Then I am declaring a qstring with array of values,how can i convert them to html?? can you show me some examples for it!!!

    Thanks in advace and Regards,
    Naufal.A

  5. #5
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How to set Individual color for every parse Value???

    Set indivicual background for all words.

    The below is the sample code, the logic is the multiple of integer value.

    Code:
    for (int i=0; i<name.count();i++) {
      ui->listWidgetmyprofile->item(logic)->setForeground(Qt::green);
    }
    regards,
    rahul

  6. #6
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to set Individual color for every parse Value???

    Quote Originally Posted by rahulvala View Post
    Set indivicual background for all words.
    The below is the sample code, the logic is the multiple of integer value.
    Code:
    for (int i=0; i<name.count();i++) {
      ui->listWidgetmyprofile->item(logic)->setForeground(Qt::green);
    }
    Hi Rahulvala,
    You had stated that logic is number of multiple values of integer,but i am getting the "name" as parse value and stored in array.
    I don't know exactly about the value that comes,how much times?what can i try instead of "logic" ,so what might be the solution???

    Thanks in advance and Regards,
    Naufal.A

  7. #7
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to set Individual color for every parse Value???

    Hi Rahulvala,
    I tried this below line of code but,my application gets crashed with the following error.

    The interfere stopped because it received the signal from the operating system.
    SIGNAL MEANING: segmentation fault.

    This is the following code:

    for(int i=0 ; i<placename.count(); i++)
    {
    QString name = username[i];
    QString place = placename[i];
    QString profileaddress = address[i];
    QString Time = time[i];

    strList << name + "\n" + place + "\n" + profileaddress+ "\n" + Time;

    ui->listWidgetactivity->item(i)->setForeground(Qt::green);
    }

    Thanks in advance and Regards,
    Naufal.A

  8. #8
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How to set Individual color for every parse Value???

    Segmentation fault means that your CODE tried to access memory but it wasn't allowed to do so.

    Change the code,

    If you want different color for Username, placename, address, and time, use ui line four time with different color.

  9. #9
    Regular Contributor
    Join Date
    Nov 2011
    Location
    Coimbatore
    Posts
    87

    Re: How to set Individual color for every parse Value???

    Quote Originally Posted by rahulvala View Post
    Segmentation fault means that your CODE tried to access memory but it wasn't allowed to do so.
    Change the code,
    If you want different color for Username, placename, address, and time, use ui line four time with different color.
    Hi Rahul,
    You had said that set different color for Username, placename, address, and time.But my doubt is all these 4 values form a item in this and i have said that "item(i)" will wholly set the color or not, i am confused here??
    Can you re-change the code and get me a solution for it!!!!

    Thanks in advance and Regards,
    Naufal.A

  10. #10
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How to set Individual color for every parse Value???

    Anyway if it will throw Segmentation error, then it is not going to be solved.

    What about this :


Similar Threads

  1. Individual selling applications
    By xsacha in forum [Closed] Publishing to Nokia Store
    Replies: 1
    Last Post: 2010-05-11, 17:16
  2. Tax-ID for individual developer?
    By sh2sg in forum [Closed] Publishing to Nokia Store
    Replies: 11
    Last Post: 2010-02-01, 01:10
  3. Notification about individual purchases
    By intellsys in forum [Closed] Publishing to Nokia Store
    Replies: 4
    Last Post: 2009-06-18, 21:43
  4. How to publish a game in ovi as an individual
    By rishabh2319 in forum Mobile Java Games
    Replies: 3
    Last Post: 2009-04-01, 20:46
  5. OTA files, S40, S60, S80, same or individual?
    By addeeriksson in forum Smart Messaging
    Replies: 1
    Last Post: 2006-04-12, 06:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •