Results 1 to 4 of 4

Thread: Paint over childs

  1. #1
    Join Date
    Apr 2008
    Location
    Russia, Moscow
    Posts
    86
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4

    Question Paint over childs

    I have QMainWindow and reimplement paintEvent. When showing modal dialogs i want shade whole main window, how this do on more sites like http://www.crossplatform.ru/ when clicking on screenshots, but i can't find info how to paint over childs (QWidgets).
    I would not want to override paintEvent of all childs...

    I hear about solution with transparent QWidget (as Layout) and raise()/lower(), but this sounds like as overhead.

    P.S.: First picture - original, Second - shaded (what i want), Third - what i have. (i don't have Photoshop and use invert colors on 2nd picture instead shade).
    Attached Images Attached Images

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint over childs

    You can try a trick -
    Show your widget in the whole screen with semi transparent color. Now to this widget add a child widget , the dialog. You might have to paint the child window yourself and capture the events too for click , etc.
    When shown the effect of background grayed will b applicable.

    Another way is to use graphicsView fraemwork. If you add a dialog to a scene and show the scene in a transparent / semi-transparent view, it will also have the same effect . It will be easier this way as you can add any QWidget

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Paint over childs

    i am not sure this will help but did u try fader widget concept ..
    http://doc.trolltech.com/qq/qq16-fader.html
    "Behind every great fortune lies a crime" - Balzac

  4. #4
    Join Date
    Apr 2008
    Location
    Russia, Moscow
    Posts
    86
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4

    Default Re: Paint over childs

    Quote Originally Posted by wagmare View Post
    i am not sure this will help but did u try fader widget concept ..
    http://doc.trolltech.com/qq/qq16-fader.html
    I wrote in first topic, what this not good solution. What if i want draw something on childs widgets from eventFilter method? I don't think what create Layer-Widget for each childs or subclass paintEvent on all my childs is good.

    How this can be, Qt have many features for painting but can't just draw foreground of main window without repaint childs?

Similar Threads

  1. Drawing standard widgets using a custom paint engine
    By Waywocket in forum Qt Programming
    Replies: 26
    Last Post: 21st October 2010, 21:40
  2. Drawing a widget in QItemDelegate's paint method
    By darkadept in forum Qt Programming
    Replies: 17
    Last Post: 11th August 2009, 06:15
  3. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 21:17
  4. cairo4qt 0.9 - a cairo based paint engine for Qt4
    By dragchan in forum Qt-based Software
    Replies: 0
    Last Post: 18th May 2007, 06:07
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 15:24

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.