Results 1 to 6 of 6

Thread: Make QPainter paint above all widgets

  1. #1
    Join Date
    Jul 2015
    Posts
    20
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Make QPainter paint above all widgets

    How to make QPainter draw above all widgets?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Make QPainter paint above all widgets

    What do you mean by "above"?

  3. #3
    Join Date
    Jul 2015
    Posts
    20
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Make QPainter paint above all widgets

    Treat every widget as a layer. Red rectangles are shapes drawn with QPainter, the rest are widgets. QPainter draws everything on the window's layer, beneath all widgets. How to make widgets not cover my red rectangles?
    window.png

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Make QPainter paint above all widgets

    Maybe: in the paint event handler of your window, first call the base implementation, then draw yourself.

    Cheers,
    _

  5. #5
    Join Date
    Jul 2015
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Make QPainter paint above all widgets

    Hello Grzyboo,

    Did you find the solution to your question ?
    Even I am interested in the same.
    It would be great if you or someone else can help.

    Thanks.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Make QPainter paint above all widgets

    Anda_skoa had a good hint.
    You should also consider if QGraphicsView is a better approach to your particular problem.

Similar Threads

  1. How to paint unicode surrogate pairs using QPainter?
    By BobWu in forum Qt Programming
    Replies: 5
    Last Post: 2nd January 2013, 17:52
  2. QPainter immediate drawing outside paint event
    By sfcheng77 in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2011, 06:39
  3. Replies: 5
    Last Post: 15th February 2011, 01:35
  4. QPainter::begin: Cannot paint on a null pixmap
    By sabeesh in forum Qt Programming
    Replies: 5
    Last Post: 27th July 2010, 18:03
  5. How to paint (QPainter) on a label ?
    By d@nyal in forum Newbie
    Replies: 1
    Last Post: 29th May 2010, 18:39

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.