On 16 April 2014 22:40, Mojmír Svoboda <mojmir.svob...@bistudio.com> wrote: > Hello, > > how to extend a qtableview with a custom button bar? so that the button > bar is above the qtableview. > > i tried something like this, but it does not feel right: > struct MyTableView : QTableView > and in the constructor do > 1) layout = new QVBoxLayout > 2) setLayout(layout) > 3) mybuttonbar = new ... > 4) layout->insertWidget(0, mybuttonbar) > > but it behaves in weird ways (endless loop in some parent detection, > stealing keypresses from qtableview)... so i am not sure that is the way > to do it. > > Another possibility is to create completely different class and using > composition instead of inheritance. This works well, but for some reason > i wanted the IS-A relationship above (i do not remember why now).
If you can't think of (or remember) a good reason for a IS-A relationship, then you should stick to a HAS-A relationship. > How would you do that, please? I would use composition instead of inheritance. :) Regards, Sze-Howe _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest