Results 1 to 4 of 4

Thread: Selective highlighting of Items

  1. #1
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Selective highlighting of Items

    Hi...

    I have a canvas on which i have created many items..
    i have stored all the items in a QList, (QList <Q3CanvasItem*>).. Now i run a function where in on value specified in a file, it extracts those items and sets a pen of different color for them and then show() it... But in the output the color is not changed.. When i tried to debug and check whether is it selecting the correct items or not then yes it was returning me the right value and was moving thru the correct items... I was also updating the canvas on all chages...
    I couldnt understand why is this happening..

    Then i tried a different approach... i tried to extract the points of the items whose color would be changed.. and tried to create a new similar item on top of the existing item with the same coordinate set but different color.. but then in this it does not create lines at all points.. it makes for some points and for some it doesn't... i again tried to debug it and the result was positive but not seen on output..
    There was also a strange problem with it... when i rerun the application, this time it highlights different items from the value set.. It picks each value but changes color of random items from that set... i couldnt understand why is it so happening....

    Please help me with it...

    Thanking you,

    with regards,
    Kapil
    All you have to decide is what to do with the time that is given to you

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

    Default Re: Selective highlighting of Items

    Quote Originally Posted by Kapil
    i have stored all the items in a QList, (QList <Q3CanvasItem*>)..
    Are you aware of QCanvas::allItems()?

    Now i run a function where in on value specified in a file, it extracts those items and sets a pen of different color for them and then show() it... But in the output the color is not changed..
    Can we see the code?


    When i tried to debug and check whether is it selecting the correct items or not then yes it was returning me the right value and was moving thru the correct items... I was also updating the canvas on all chages...
    I couldnt understand why is this happening..
    Did you mark those items as changed?
    Qt Code:
    1. QCanvasItem *item;
    2. QCanvas *canvas;
    3. //...
    4. canvas->setChanged(item->boundingRect());
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Selective highlighting of Items

    Quote Originally Posted by wysota
    Are you aware of QCanvas::allItems()?
    yaa.. but i had to maintain a list of different item types.. so i made a list for each set of items... allItems would have returned me all the items but i needed seperate list for each type..

    Quote Originally Posted by wysota
    Can we see the code?
    Qt Code:
    1. Q3Canvas *m_pCanvas;
    2. Q3CanvasLine *pLine;
    3. QList <Q3CanvasItem*> m_globalOutYLine;
    4.  
    5. //m_globalOutYLine is filled with a canvas lines...
    6. //lineVal is the value of the line which has to be coloured from a value set
    7.  
    8. pLine = (Q3CanvasLine*)m_globalOutYLine[lineVal];
    9. pLine->setPen(QPen(color));
    10. pLine->show();
    11.  
    12. m_pCanvas->update();
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by wysota
    Did you mark those items as changed?
    Qt Code:
    1. QCanvasItem *item;
    2. QCanvas *canvas;
    3. //...
    4. canvas->setChanged(item->boundingRect());
    To copy to clipboard, switch view to plain text mode 
    No i didnt do so... would try to do so and see what happens..

    Thank you,

    with regards,
    Kapil
    All you have to decide is what to do with the time that is given to you

  4. #4
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Selective highlighting of Items

    canvas->setChanged(item->boundingRect());
    setChanged function also not helping out...
    i am not able to get what can be the reason for it....

    thanking you,
    Kapil
    All you have to decide is what to do with the time that is given to you

Similar Threads

  1. Automatically add items to a QComboBox (Qt4)
    By darkadept in forum Qt Programming
    Replies: 2
    Last Post: 19th May 2006, 16:32
  2. Iterate and get Checked QTable items??
    By darpan in forum Newbie
    Replies: 2
    Last Post: 10th May 2006, 19:27
  3. [Qt4]: Adding centered items in QListWidget
    By Jojo in forum Qt Programming
    Replies: 4
    Last Post: 16th March 2006, 21:04
  4. Missing items in loadFile
    By dragon in forum Newbie
    Replies: 6
    Last Post: 3rd February 2006, 18:14
  5. Getting all items of a QListWidget
    By Codepoet in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2006, 23: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.