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
Qt Code:
  1. QList<QToolBar*> MainWindow::toolBars()
  2. {
  3. QList<QToolBar*> tbs;
  4. QToolBar *tb;
  5. foreach(QObject* o, children()) {
  6. tb = dynamic_cast<QToolBar*>(o);
  7. if (tb)
  8. tbs << tb;
  9. }
  10. return tbs;
  11. }
To copy to clipboard, switch view to plain text mode