Important: Please read the Qt Code of Conduct -

Overriding methods through custom widgets

  • i have made a custom tab widget plugin the addtab function i have successfully overridden but in the designer when we insert a page i guess the insertTab function is called . i have tried to override it but with no success . it always calls the normal insertion. is there some other method to be overridden. how do i change the way a page is inserted in the tab . please help.

  • You can only override methods that are virtual in the base class*. Other methods you simply cannot reimplement with your own version. That's basic C++.

    *Well, you could pull some Qt introspection tricks if you wanted to, but that has to be done by the base class as well, and thus gets you no further.

  • you could reimplement

    @void QTabWidget::tabInserted(int index) [virtual protected]@

    QTabWidget uses a QStackWidget for pages (QWidget), and addTab/removeTab just insert and remove from stack, so I think there is no really need to specialize them

Log in to reply