[Qt-interest] Change layout in subclass of standard widget ?

Stephen Collyer scollyer at netspinner.co.uk
Tue May 26 11:52:37 CEST 2009


2009/5/26 Tony Rietwyk <tony.rietwyk at rightsoft.com.au>

>  Stephen wrote:
>
>
>
> How does one go about changing the layout of a derived standard
> widget in this case ? I'm doing something wrong, but can't see how
> to fix it.
>
>
>
> The internal layout of the standard widgets is private to them, so other
> than the public API, you can only modifiy the original source code to modify
> the private layout - which is not desirable.
>

This doesn't seem entirely correct to me. All classes derived from QWidget
support setLayout() so it would seem possible, at least in principle,
to change the layout of a standard widget. The QWidget docs give an
example of this being done:

http://doc.qtsoftware.com/4.5/qwidget.html#setLayout

I suspect I'm merely doing it incorrectly.


>
> In this case, I suggest a separate widget that contains the table view and
> buttons, and that connects to the button clicks and does the appropriate
> actions on the table.  The separate widget can also listen for the view
> selection signals, and only enable the buttons accordingly.
>
>

I could do that, but it's a totally different design and much less elegant
than merely deriving from the view widget. I'd be very surprised if it isn't
possible to usefully derive from the standard widgets as I wish.

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090526/740135c2/attachment.html 


More information about the Qt-interest-old mailing list