Quote Originally Posted by Djony View Post
Hi! I solved that, you are right. But there is a different workaround (btw, I am deleting tabwidget in the same slot, so I can create it). The workaround is to call show() method when the tabwidget is created. It works fine for me. I have different problem now. I have created class which inherits QWidget. Now, this class has those QLineEdits and other elements. When I create several tabs I can't really acces the appropriate tab to fill the right data. This is my code
Qt Code:
  1. //this is how I add tab
  2. platformTab=new Platform(tabTCDescription);
  3. //Platform is my class which inherits QWidget, tabTCDescription is pointer on QTabWidget
  4. tabTCDescription->addTab(platformTab,"somestring");
  5.  
  6. //this is how I try to access appropriate Platform class to fill QLinedit:
  7. tempPlatformTab=(Platform*)tabTCDescription->widget(someinteger);
  8. //checked the someinteger, it is OK
  9. //and this is how I try to fill QLineEdit on my tab
  10. tempPlatformTab->editPlatformType->setText(tempString);
  11. //editPlatformType is QLineEdit
To copy to clipboard, switch view to plain text mode 
The result of code above is that all tabs are filled with same data. What I need to do, to access the appropriate tab?



Hi, How did you solved that? I'm facing the similar problem, getting segmentation fault (using windows Qt-4.7.4) while trying to insert or add same object in different tabs.

code:
static int tabIndex;
PageInsideTab *ptr; // PageInsideTab is inherited from QWidget
ptr = pageList.at(tabIndex); // QList <PageInsideTab *> pageList - I declared 15 pointers and stored into this list
ptr = new PageInsideTab(tabWidget);
qDebug()<<"tabIndex="<<tabIndex;
tabWidget->insertTab(tabIndex, ptr, name); // name is QString
// tabWidget->addTab(ptr, name);
tabIndex++;


when this slot is running first time one tab is inserted, all ok, but in the second run I'm getting seg. fault.
Any solution please?