Results 1 to 6 of 6

Thread: How to render an item of graphicscene with two different colors at two scenewiewers?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default How to render an item of graphicscene with two different colors at two scenewiewers?

    And, how could I make the next :

    I have a Line. I add it to the items of the scene.
    I have two sceneviewers, the first one are going to render the line in red , the second in green.
    But I only have a line with one Qpen property.....

    Is there any solution to this ?
    Thanks.

    mmm
    I think that the way is to have a custom item class with Paint overloaded ?
    But it would exist any faster-direct way ?
    Last edited by tonnot; 2nd September 2011 at 09:25.

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

    Default Re: How to render an item of graphicscene with two different colors at two scenewiewe

    Yes, there is alas a dirty one. Have a look at the last argument of QGraphicsItem::paint().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    tonnot (2nd September 2011)

  4. #3
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default Re: How to render an item of graphicscene with two different colors at two scenewiewe

    Why 'dirty one.' ??

    So, the initial approach can be create graphicsitems with their paint overloaded. But in this case I have to rewrite by hand the paint mechanism.

    So, after I have to look at the diagramscene example, I have this question:
    How can (can it ?) I create a QGraphicsItem and inside it say: you are a QGraphicsLineItem ? My idea is avoid to rewrite the paint neede code.
    Is it possible ?

    Also... I dont remember if exists something to do 'paint yourself everithing you have to paint' inside a paint??

    Thanks.

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

    Default Re: How to render an item of graphicscene with two different colors at two scenewiewe

    Quote Originally Posted by tonnot View Post
    Why 'dirty one.' ??
    Because the pointer can be null.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default Re: How to render an item of graphicscene with two different colors at two scenewiewe

    And.... about the other questions ?
    How can (can it ?) I create a QGraphicsItem and inside it say: you are a QGraphicsLineItem ? My idea is avoid to rewrite the paint neede code.
    Is it possible ?

    Also... I dont remember if exists something to do 'paint yourself everithing you have to paint' inside a paint??
    Thank you for your time-.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: How to render an item of graphicscene with two different colors at two scenewiewe

    If I wanted to answer the other questions, I would have. If you're lazy enough not to do anything by yourself then I'm lazy enough to pick which questions I want to answer and which not. This is a "Qt Programming" forum where you ask advanced questions and not a "Help me, I don't know how to program" forum. I have answered your advanced question. I'm fed up with spoon feeding you with knowledge. Consider this a kick in your butt that tries to force you to learn and understand programming before you start doing any advanced stuff. Try to solve your problems with means you understand and those that you come up with on your own.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. The following user says thank you to wysota for this useful post:

    tonnot (3rd September 2011)

Similar Threads

  1. QTableView - selected item colors
    By sherbs in forum Newbie
    Replies: 4
    Last Post: 10th August 2010, 14:03
  2. combobox and item colors
    By zorro68 in forum Qt Programming
    Replies: 16
    Last Post: 23rd September 2007, 12:54
  3. row colors
    By nategoofs in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2007, 19:16
  4. Qwt 5 - render TeX text
    By ak in forum Qwt
    Replies: 2
    Last Post: 1st May 2007, 09:08
  5. Volume Render
    By showhand in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2006, 10:04

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
  •  
Qt is a trademark of The Qt Company.