Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, April 2007
Paint parent after child.


Message 1 in thread

Hey there,

I'm painting my own custom widget items in a custom parent widget.

The updating event are processed fine, it's always painting the parent and then its child.
But, is there any way to paint the parent or some part of it at the end of the process?

Thanks.

Ben.

Message 2 in thread

Ben,

I doubt there's a way to paint the parent after the child, since the widgets
are conceptually stacked in layers, with the children on top of the parents.
In Qt 4, you can make part of the child transparent so that the parent would
show through the child. Would this accomplish what you want?

Tom

On 4/21/07, bunjee <bunjeee@xxxxxxx> wrote:
>
>  Hey there,
>
> I'm painting my own custom widget items in a custom parent widget.
>
> The updating event are processed fine, it's always painting the parent and
> then its child.
> But, is there any way to paint the parent or some part of it at the end of
> the process?
>
> Thanks.
>
> Ben.
>

Message 3 in thread

Hey there,

Making the child widget transparent wouldn't solve my issue.

I have a Custom list frame with a "shadow" linear gradient effect on the borders and I want my items to be displayed UNDER that shadow.
Any way to force painting of the child inside the parent's paint event instead of following the classical "stacked" approach ?

Thanks for the answer.

Ben.
  ----- Original Message ----- 
  From: Tom Panning 
  To: Qt Interest List 
  Sent: Monday, April 23, 2007 3:41 PM
  Subject: Re: Paint parent after child.


  Ben,

  I doubt there's a way to paint the parent after the child, since the widgets are conceptually stacked in layers, with the children on top of the parents. In Qt 4, you can make part of the child transparent so that the parent would show through the child. Would this accomplish what you want?

  Tom


  On 4/21/07, bunjee <bunjeee@xxxxxxx> wrote:
    Hey there,

    I'm painting my own custom widget items in a custom parent widget.

    The updating event are processed fine, it's always painting the parent and then its child.
    But, is there any way to paint the parent or some part of it at the end of the process?

    Thanks.

    Ben.


Message 4 in thread

Ben,

Okay, I think I understand what you're trying to do. I don't know exactly
how to do this, but hopefully I can get you pointed in the correct
direction. What I would do is create the "shadows" in separate widgets that
are actually on top of all of the other widgets. Specifically, I would have
a class that looked like

class ShadowedBorderWidget : public QWidget {

private:
  QWidget* content;
  QVector<QWidget*> borderWidgets;
};

In the constructor, I would raise() the borderWidgets above the content
widget and manually position them (i.e., without using any layouts), and I
would use the same method to make the content widget fill the entire area of
the ShadowedBorderWidget. Then I would use the content widget as the parent
of everything that I wanted to appear under the shadows.

Note: I have not done this, although I have used some of these techniques to
manually position widgets on top of other widgets, so I can't guarantee that
this will work exactly as I described, but this is how I would start.

Hopefully that helps you,
Tom

On 4/23/07, bunjee <bunjeee@xxxxxxx> wrote:
>
>  Hey there,
>
> Making the child widget transparent wouldn't solve my issue.
>
> I have a Custom list frame with a "shadow" linear gradient effect on the
> borders and I want my items to be displayed UNDER that shadow.
> Any way to force painting of the child inside the parent's paint event
> instead of following the classical "stacked" approach ?
>
> Thanks for the answer.
>
> Ben.
>
> ----- Original Message -----
> *From:* Tom Panning <lurchvt@xxxxxxxxx>
> *To:* Qt Interest List <qt-interest@xxxxxxxxxxxxx>
> *Sent:* Monday, April 23, 2007 3:41 PM
> *Subject:* Re: Paint parent after child.
>
> Ben,
>
> I doubt there's a way to paint the parent after the child, since the
> widgets are conceptually stacked in layers, with the children on top of the
> parents. In Qt 4, you can make part of the child transparent so that the
> parent would show through the child. Would this accomplish what you want?
>
> Tom
>
> On 4/21/07, bunjee <bunjeee@xxxxxxx> wrote:
> >
> >  Hey there,
> >
> > I'm painting my own custom widget items in a custom parent widget.
> >
> > The updating event are processed fine, it's always painting the parent
> > and then its child.
> > But, is there any way to paint the parent or some part of it at the end
> > of the process?
> >
> > Thanks.
> >
> > Ben.
> >
>
>

Message 5 in thread

IOW, it simply does not make sense to paint the parent after the child. The
child must have the parent's painted pixels to do correct
overlays--transparent/translucent  bits on the child must show/use the
already painted bits from the parent.


On 04-23-2007 8:41 AM, "Tom Panning" wrote:

> Ben,
> 
> I doubt there's a way to paint the parent after the child, since the widgets
> are conceptually stacked in layers, with the children on top of the parents.
> In Qt 4, you can make part of the child transparent so that the parent would
> show through the child. Would this accomplish what you want?
> 
> Tom
> 
> On 4/21/07, bunjee <bunjeee@xxxxxxx> wrote:
>> Hey there,
>>  
>> I'm painting my own custom widget items in a custom parent widget.
>>  
>> The updating event are processed fine, it's always painting the parent and
>> then its child.
>> But, is there any way to paint the parent or some part of it at the end of
>> the process?
>>  
>> Thanks.
>>  
>> Ben.
>> 


Message 6 in thread

Re: Paint parent after child.I have another issue :

I'd like to apply a Clipped rectangle to all the child. here is the code in my parent's paint function :

painter.setClipPath(zePainter.DrawRoundRect(QRect(rect().x() + 2, rect().y() + 2,  rect().width() - 4, rect().height() - 4), 2000 / rect().width(), 2000 / rect().height()));

painter.setClipping(true);

It's based on a Round Rectangle, any way to set clipping not just for the parent but for all the childs ?

Thanks.

Ben.

  ----- Original Message ----- 
  From: Keith Esau 
  To: Qt Interest 
  Sent: Monday, April 23, 2007 6:59 PM
  Subject: Re: Paint parent after child.


  IOW, it simply does not make sense to paint the parent after the child. The child must have the parent's painted pixels to do correct overlays--transparent/translucent  bits on the child must show/use the already painted bits from the parent.


  On 04-23-2007 8:41 AM, "Tom Panning" wrote:


    Ben,

    I doubt there's a way to paint the parent after the child, since the widgets are conceptually stacked in layers, with the children on top of the parents. In Qt 4, you can make part of the child transparent so that the parent would show through the child. Would this accomplish what you want?

    Tom

    On 4/21/07, bunjee <bunjeee@xxxxxxx> wrote:

      Hey there,

      I'm painting my own custom widget items in a custom parent widget.

      The updating event are processed fine, it's always painting the parent and then its child.
      But, is there any way to paint the parent or some part of it at the end of the process?

      Thanks.

      Ben.


Message 7 in thread

Re: Paint parent after child.I have another issue :

I'd like to apply a Clipped rectangle to all the child. here is the code in my parent's paint function :

painter.setClipPath(zePainter.DrawRoundRect(QRect(rect().x() + 2, rect().y() + 2,  rect().width() - 4, rect().height() - 4), 2000 / rect().width(), 2000 / rect().height()));

painter.setClipping(true);

It's based on a Round Rectangle, any way to set clipping not just for the parent but for all the childs ?

Thanks.

Ben.

  ----- Original Message ----- 
  From: Keith Esau 
  To: Qt Interest 
  Sent: Monday, April 23, 2007 6:59 PM
  Subject: Re: Paint parent after child.


  IOW, it simply does not make sense to paint the parent after the child. The child must have the parent's painted pixels to do correct overlays--transparent/translucent  bits on the child must show/use the already painted bits from the parent.


  On 04-23-2007 8:41 AM, "Tom Panning" wrote:


    Ben,

    I doubt there's a way to paint the parent after the child, since the widgets are conceptually stacked in layers, with the children on top of the parents. In Qt 4, you can make part of the child transparent so that the parent would show through the child. Would this accomplish what you want?

    Tom

    On 4/21/07, bunjee <bunjeee@xxxxxxx> wrote:

      Hey there,

      I'm painting my own custom widget items in a custom parent widget.

      The updating event are processed fine, it's always painting the parent and then its child.
      But, is there any way to paint the parent or some part of it at the end of the process?

      Thanks.

      Ben.


Message 8 in thread

Hey there,

I'm painting my own custom widget items in a custom parent widget.

The updating event are processed fine, it's always painting the parent and then its child.
But, is there any way to paint the parent or some part of it at the end of the process?

Thanks.

Ben.