I need a function to return a List of all toolbars in the mainwindow. There used to be a toolBars() method in Qt3 that is gone now and I could'nt find an alternative. My current workaround is pretty ugly and I would like to know if there is a better way or a qt function that does this.
Thanx in advance
current workaround
QList<QToolBar*> MainWindow::toolBars()
{
QList<QToolBar*> tbs;
tb = dynamic_cast<QToolBar*>(o);
if (tb)
tbs << tb;
}
return tbs;
}
QList<QToolBar*> MainWindow::toolBars()
{
QList<QToolBar*> tbs;
QToolBar *tb;
foreach(QObject* o, children()) {
tb = dynamic_cast<QToolBar*>(o);
if (tb)
tbs << tb;
}
return tbs;
}
To copy to clipboard, switch view to plain text mode
Bookmarks