Results 1 to 1 of 1

Thread: Remove shadow of child widgets? Like a sunken frame...

  1. #1
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Remove shadow of child widgets? Like a sunken frame...

    Hi.

    If I include a widget w1 into a layout of a parent widget pw, the widget w1 is getting drawn with a shadow of its frame, or in other words, it is drawn like sunken into the parent widget pw.

    I would like to have the inner widget w1 at the same level as the parent widget pw so that there is no "sunken" effect!

    I tried QFrame and played around, but no matter what frame style I use, the widget looks still the same.

    So how can I do this?

    Thanks

    P.S.

    I do a simple paint(just background filling) with a QPainter in the paintEvent method of the inner widget w1.
    Maybe it has something to do with the painter object to get rid of the sunken border/frame of that widget.

    I draw a rect with the painter method drawRect() that creates the sunken effect. If I use the fillRect() method, the sunken effect is gone.

    So how can I draw the rect with drawRect() without the sunken effect?


    Qt Code:
    1. void InnerPaintWidget::paintEvent( QPaintEvent* pe )
    2. {
    3.  
    4.  
    5. QPainter p(this) ;
    6.  
    7. QBrush br(Qt::green) ;
    8. QPen pen( Qt::red ) ;
    9. pen.setStyle( Qt::DotLine ) ;
    10.  
    11. p.setBrush( br ) ;
    12. p.setPen( pen ) ;
    13. //p.setBackground( br ) ;
    14. //p.fillRect( this->rect(), br ) ; // without sunken effect at the borders
    15.  
    16.  
    17.  
    18. QRect ri = this->rect() ;
    19. p.drawRect( ri ) ; // with sunken effect at the borders
    20.  
    21. QLabel::paintEvent( pe ) ;
    22. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by new_voodoo; 13th December 2010 at 23:56.

Similar Threads

  1. Replies: 5
    Last Post: 18th April 2010, 23:31
  2. How to remove 3D frame and outline in QToolButton?
    By Kevin Hoang in forum Qt Programming
    Replies: 9
    Last Post: 9th March 2010, 14:31
  3. How to conrol frame of widgets in a QStatuBar?
    By high_flyer in forum Qt Programming
    Replies: 12
    Last Post: 30th September 2008, 01:19
  4. Remove a child in QLIstView (Qt3.3.4)
    By suresh in forum Newbie
    Replies: 2
    Last Post: 7th October 2006, 20:45
  5. Replies: 2
    Last Post: 22nd February 2006, 14:58

Tags for this Thread

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.