Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Overriding methods through custom widgets
Forum Update on Monday, May 27th 2025

Overriding methods through custom widgets

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tanmay2227
    wrote on last edited by
    #1

    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.

    Tanmay Priyadarshi

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        NicuPopescu
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved