Results 1 to 4 of 4

Thread: QGradient on triangle

  1. #1

    Default QGradient on triangle

    Hello,
    I need fill instances of QGraphicsPolygonItem (really they are triangles of finite element mesh) using QGragient. I'd like to show stress field in the way. I have stresses in each vertex of mesh that is in each vertex of a triangle. Need I use LinearGradient or RadialGradient? Please help me with triangle gradient or give me a useful referance. Thank you.

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

    Default Re: QGradient on triangle

    You need to use three linear gradients.
    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. #3

    Default Re: QGradient on triangle

    I can create three linear gradients along each segment of triangle. Then I will create three brushes using these gradients. But how can I unite three fillings. Need I reimplement QGraphicsItem:aint()? Thank you very much.

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

    Default Re: QGradient on triangle

    Either clip to the shape of triangle and draw a rectangle over it or draw a polygon.
    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.


Similar Threads

  1. drawLine with QGradient is slow
    By D.Dupuis in forum Qt Programming
    Replies: 0
    Last Post: 7th December 2011, 12:35
  2. HistogramItem and Qgradient
    By OverTheOCean in forum Qwt
    Replies: 4
    Last Post: 27th August 2010, 02:59
  3. Problems with painting a Qgradient
    By sacrif in forum Newbie
    Replies: 4
    Last Post: 20th January 2010, 16:27
  4. How to draw fast rectangle/triangle/circle
    By nileshsince1980 in forum Qt Programming
    Replies: 1
    Last Post: 11th November 2008, 11:40
  5. color table with QGradient and QImage
    By desch in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2008, 10:32

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.