PDA

View Full Version : How To Access To Child's Of A Tab



hotjava
14th December 2008, 13:06
Hi!
How i can access to a child widget of a tab???
for example
I have 3 tab. in all tabs i have placed a Button named New
i need to access to New Button from Code.
i have tried this code but...!


for(int i=0; i < this->tabwidget->count(); i++)
{
this->tabwidget->widget(i)->btnNew->setEnabled(false);
}

Please Help Me!
Thanx.

spirit
14th December 2008, 13:21
you nee to cast QWdiget to your own widget and then you will get access to needed methods, i.e.


...
for (int i = 0; i < tabwidget->count(); ++i) {
MyWidget *mw = qobject_cast<MyWidget *>(tabwidget->widget(i));
if (mw)
mw->btnNew->setEnabled(false);
}
...