PDA

View Full Version : Question about: correct Signaling from QTabWidget to its Tabs?



Astronomy
19th February 2010, 18:28
Hello,
I'm using two Tabs in a Mainwindow. I do load a Workspace from the Mainwindow, and want some Comboboxes in Tab2 get filled in with the Data i load from a file.. (all done in mainw...)

The Problem: m_ui.ComboBox from Tab1 and Tab2 are private. What is the best approach here?

Making an Object CTab2 *Tab2 = new CTab2; inside int main(){...} and make the m_ui from Tab1+2 public? (through this is very ugly..) Or can i use a signal? but the signals i've tried are also not visible from outside mainw, Tab1 or Tab2 :confused:
(i use signals from the designer and they do not correspond to other m_ui's ??)

Thanks in advance,
Astronomy



class Tab1; // other Mainwindow - widgets from the Qt Designer...
class Tab2;

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

CMainWindow *mainw = new CMainWindow;
#if (QT_VERSION < 0x040000)
a.setMainWidget(&mainw);
#endif

QTabWidget *Tab = new QTabWidget(mainw);
Tab->addTab(new Tab1, "Tab1");
Tab->addTab(new Tab2, "Tab2");
mainw->setCentralWidget(Tab);
mainw->show();

return a.exec();
}