I wouldn't, each tab class wouldn't care what its index was, it would only care about the data associated with itself, which it would reflect in its own controls itself, and copy any of the changed data via the gui back to the data storage. This way it's completely self-contained, and you don't need any code in the main window for handling the tabs.

However, if you prefer each class to know its index, well, the main window knows the index, so why not provide that to the tab classes? Eg. tab->setIndex(0); tab_2->setIndex(1); and then in your tab class:

Qt Code:
  1. public:
  2. inline setIndex(int index) { myIndex = index; }
To copy to clipboard, switch view to plain text mode