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

Qt-interest Archive, February 2007
Documentation request: QGraphicsItem::setVisible() affects children


Message 1 in thread

It would be nice if the Qt documentation said that the 
QGraphicsItem::setVisible() also sets the item's children's visibility 
as well. I had to splunk in the code to figure that one out. Would have 
been nice to know it by reading in assistant instead.

Thanks!

--Dave

--
 [ signature omitted ] 

Message 2 in thread

On 08.02.07 14:36:22, Dave Smith wrote:
> It would be nice if the Qt documentation said that the 
> QGraphicsItem::setVisible() also sets the item's children's visibility as well. 
> I had to splunk in the code to figure that one out. Would have been nice to 
> know it by reading in assistant instead.

Apart from the fact that this is the wrong place for such requests, I
would personally be really surprised if it worked the other way around.

Last but not least this is actually already documented in the
documentation for QGraphicsItem, see the detailed description.

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

Andreas Pakulat wrote:
> Apart from the fact that this is the wrong place for such requests,
What is the right place? How about some useful info in addition to the 
ad hominem?

> I would personally be really surprised if it worked the other way around.
>   

What do you  mean by "if it worked the other way around"?

> Last but not least this is actually already documented in the
> documentation for QGraphicsItem, see the detailed description.

Just a simple request to add it to the setVisible() funtion. That's all. 
I see that it's there buried between paragraphs. It would be nice if it 
were provided in a more just-in-time fashion. I would have thought this 
would be the kind of info that would be valuable for the Trolls to make 
their docs even better.

--Dave

--
 [ signature omitted ] 

Message 4 in thread

On 08.02.07 15:58:36, Dave Smith wrote:
> Andreas Pakulat wrote:
> >Apart from the fact that this is the wrong place for such requests,
> What is the right place? How about some useful info in addition to the ad 
> hominem?

Uhm, the right way for feature requests and bugreports is described on
the TT webpage under the Development section. Apart from that its
mentioned in threads on this list nearly once a week.

> >I would personally be really surprised if it worked the other way around.
> >  
> 
> What do you  mean by "if it worked the other way around"?

I mean if item->setVisible(false) would only make that item invisible
and not its child items, that would be confusing for me. The way it is
currently is consistent with how QWidgets work.

> >Last but not least this is actually already documented in the
> >documentation for QGraphicsItem, see the detailed description.
> 
> Just a simple request to add it to the setVisible() funtion. That's all. I see 
> that it's there buried between paragraphs.

Well, anybody starting to use QGraphicsItem should read all those
paragraphs ;)

> It would be nice if it were provided in a more just-in-time fashion. I
> would have thought this would be the kind of info that would be
> valuable for the Trolls to make their docs even better.

Yes, it probably is valuable, but you need to tell the Trolls, not us.
Although a few trolls read the list, its better to use the right
channels for such things.

BTW, I do agree that a note on the setVisisble function would be a nice
extra.

Andreas

-- 
 [ signature omitted ] 

Message 5 in thread

Andreas Pakulat wrote:
> I mean if item->setVisible(false) would only make that item invisible
> and not its child items, that would be confusing for me. The way it is
> currently is consistent with how QWidgets work.
>   

Not exactly. Consider this case:

  parent->setVisible( true );
  child1->setVisible( false );
  child2->setVisible( true );
  ...
  parent->setVisible( false );
  ...
  parent->setVisible( true );

Now what happens on screen at this point?

Should "child1" now become visible magically? I think "child1" should 
remain invisible and "child2" should remain visible. If the parent is 
not visible, then none of the children should be visible either. When 
the parent is made visible, then the children's visibility should be 
*restored* to what it was previously. Just my preference...

That is not how QGraphicsItem behaves. It naively sets visibility on all 
children to match the parent. It fails to consider that some of the 
children may have been explicitly hidden or shown previously, and that 
their state ought to be restored.

It's a bit painful to work around this, when I have a set of 
parent/child items whose visibility I have set very carefully. When I 
bring the parent back to visibility, all the visibility states of the 
children are discarded. Bummer.

Just a thought.

--Dave

--
 [ signature omitted ] 

Message 6 in thread

On 08.02.07 16:58:17, Dave Smith wrote:
> Andreas Pakulat wrote:
> >I mean if item->setVisible(false) would only make that item invisible
> >and not its child items, that would be confusing for me. The way it is
> >currently is consistent with how QWidgets work.
> >  
> 
> Not exactly. Consider this case:
> 
>  parent->setVisible( true );
>  child1->setVisible( false );
>  child2->setVisible( true );
>  ...
>  parent->setVisible( false );
>  ...
>  parent->setVisible( true );
> 
> Now what happens on screen at this point?
> 
> Should "child1" now become visible magically? I think "child1" should remain 
> invisible and "child2" should remain visible. If the parent is not visible, 
> then none of the children should be visible either. When the parent is made 
> visible, then the children's visibility should be *restored* to what it was 
> previously. Just my preference...
> 
> That is not how QGraphicsItem behaves. It naively sets visibility on all 
> children to match the parent. It fails to consider that some of the children 
> may have been explicitly hidden or shown previously, and that their state ought 
> to be restored.
> 
> It's a bit painful to work around this, when I have a set of parent/child items 
> whose visibility I have set very carefully. When I bring the parent back to 
> visibility, all the visibility states of the children are discarded. Bummer.
> 
> Just a thought.

Uhm, actually I think this would qualify as a bug, IMHO. Send this to
qt-bugs trolltech com.

I didn't really think of that usecase and actually the way QWidgets
behave is exactly as you want it to have, they remeber their visibility
state. See attached test app.

Andreas

-- 
 [ signature omitted ] 

Attachment: testvisib.tar.gz
Description: application/tar-gz


Message 7 in thread

Andreas Pakulat wrote:

> Although a few trolls read the list, its better to use the right
> channels for such things.

Yes, we might fix things that are reported on a mailing list, but we don't
guarantee it. ;-)

David

--
 [ signature omitted ]