Results 1 to 4 of 4

Thread: Multiple QGraphicsEffects and subclassing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiple QGraphicsEffects and subclassing

    What about using QWidget::setMask() on the button to give it a shape instead of funky effect and setting the shadow using a setGraphicsEffect()?

  2. #2
    Join Date
    Feb 2010
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Multiple QGraphicsEffects and subclassing

    Thanks.

    The problem with setMask is the edges aren't anti-aliased and I couldn't work out how to do this otherwise it would seem like the best solution.

    I'm currently using a QPainterPath for the masking graphics effect, which masks the inner button and anti-aliases the edges.

    Can you use a QPainterPath with setmask?

  3. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiple QGraphicsEffects and subclassing

    You can use painter path (indirectly) with set mask:
    Qt Code:
    1. QWidget::setMask( QPainterPath::toFillPolygon().toPolygon() );
    To copy to clipboard, switch view to plain text mode 

    But this will result in the same issue - edges will not be antialiased.

    As far as I know only way to have aliased edges is to draw them using QPainter.
    If you don't want to do that, maybe you could combine both effects into one shadow_and_shape effect?

Similar Threads

  1. using one signal to update multiple multiple controls
    By henryjoye in forum Qt Programming
    Replies: 7
    Last Post: 13th December 2011, 14:19
  2. Replies: 2
    Last Post: 19th October 2011, 09:30
  3. Replies: 1
    Last Post: 17th May 2011, 16:12
  4. Replies: 0
    Last Post: 21st December 2006, 11:48
  5. Subclassing
    By joseph in forum Newbie
    Replies: 1
    Last Post: 25th February 2006, 14:06

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.