[Qt-interest] Add "external" graphical elements to a derived widget?

Sean Harmer sean.harmer at maps-technology.com
Sun Mar 21 11:38:05 CET 2010


K. Frank wrote:
> André -
> 
> Thanks.
> 
> On Sat, Mar 20, 2010 at 9:30 AM, André Somers <andre at familiesomers.nl> wrote:
>> Hi,
>> I don't think there is an easy way to do what you want.
> 
> Yes, I don't see any way either.
> 
>> I would go for your approach 2, deriving from QWidget or QFrame and
>> putting the (modified) QTableWidget inside of it.
>> ...
> 
> I have two follow-up questions:
> 
> First, could you give me a little guidance on the difference between QWidget
> and QFrame, and whether I might prefer one over the other?
> 
> Second -- and this is not a big deal -- when I derive my custom widget from
> QWidget, then to use it in Qt designer, I drop a QWidget on my form, and
> then promote it to my custom widget.  A minor inconvenience with this is
> that the place-holder QWidget behaves a little differently in Qt designer
> that does QTableWidget or my custom widget.  It looks different, and it
> sizes itself differently in layouts, and such.  Is there any (easy) way to get
> my place-holder widget (in my test case, a QWidget) to mimic in Qt designer
> more closely QTableWidget (or my custom widget)?

A simple work-around for the sizing of promoted widgets issue in 
designer is to manually alter the size policy for the widget.

Sean



More information about the Qt-interest-old mailing list