Results 1 to 6 of 6

Thread: Draw on top of other Widgets

  1. #1
    Join Date
    Apr 2009
    Posts
    6
    Thanks
    2

    Default Draw on top of other Widgets

    Hi,
    i want to draw a line on top of another widget, but it's drawn below.
    Is it possible to draw over an other widget?
    Thanks in advance,

    Jones

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

    Default Re: Draw on top of other Widgets

    See [wiki]Widget Overlay[/wiki].
    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. The following 2 users say thank you to wysota for this useful post:

    aliks-os (31st July 2014), BlackFoXX (12th July 2009)

  4. #3
    Join Date
    Apr 2009
    Posts
    6
    Thanks
    2

    Default Re: Draw on top of other Widgets

    Great. It does exactly, what i want.
    Thanks allot.

  5. #4
    Join Date
    Jun 2009
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draw on top of other Widgets

    i think that i have the same problem!
    two widgets, one inside another one, and i want to draw a line in the widget that is inside the big one.

    QPen pen(Qt::yellow,2,Qt::SolidLine);
    QPainter painter(ui.the_widget_that_is_inside);
    painter.setPen(pen);
    painter.drawLine(200,300,400,150);



    this code it doesn't work! anybody can help me,please?

    thanks in advance!

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

    Default Re: Draw on top of other Widgets

    QPainter painter(ui.the_widget_that_is_inside);
    You cannot paint like that !!
    You will need to subclass ui.the_widget_that_is_inside and do the painting in paintEvent() function.

  7. #6
    Join Date
    Jun 2009
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draw on top of other Widgets

    what do you mean when you say to subclass?

    i have edit inside the main widget a simple class(without .ui) and it doesn't work!

    i think that i didn't understand you!

Similar Threads

  1. Qt3 - Multiple transparent widgets
    By bythesea in forum Qt Programming
    Replies: 4
    Last Post: 11th September 2009, 11:24
  2. Mac OS X Top-Level Transparent Widgets
    By tinsuke in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 16:01
  3. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  4. Replies: 2
    Last Post: 16th May 2008, 14:39
  5. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23

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.