[Interest] type casting 5 levels down no error but not proper

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Apr 24 18:00:02 CEST 2012


From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of R. Reucher
Sent: Tuesday, April 24, 2012 5:27 AM
To: interest at qt-project.org
Subject: Re: [Interest] type casting 5 levels down no error but not proper

 

On Tuesday 24 April 2012 14:18:49 Rainer Wiesenfarth wrote:

> 3. re-think your design and maybe even your architecture, as a (very)

> low level widget in the hierarchy should not make assumptions like this

> about its parents. How would your piece of code be ever reusable?

I think this item (3) is the relevant point: reconsider your design :).

 

HTH, René

 

For just about every project I have, which has a mainwindow, Ill have slots in the main window

slotMessage( const QString & ) and slotStatus( const QString & ) (messages go to the log, status to the status bar)

 

Just about every child window will have a sigMessage and sigStatus, which gets connected to the parent windows sigMessage and sigStatus

 

Sometimes you have to skip a "phony" parent but if I have a custom child widget that needs to send message or status, it works a lot cleaner...

 

Scott

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120424/847bf1e3/attachment.html>


More information about the Interest mailing list