[Kommander-devel] Mainwindow proxy - again

Eric Laffoon eric at kdewebdev.org
Wed Mar 26 19:03:07 EDT 2008


On Wednesday 26 March 2008 3:41:17 pm Eric Laffoon wrote:
> Keven's last suggestion...

bool QtActionProxy::actionIsOn(const QString& action)
{
  QWidget* mainWindow = kapp->mainWidget();
  if (mainWindow == 0) return false; // no main widget
  QAction* childAction = dynamic_cast<QAction*>(mainWindow->child(action.utf8
(), "QAction"));
  if (childAction == 0) return false;

  return childAction->isOn();
}

replacing the first line with
  QWidget* mainWindow = QWidget::topLevelWidget();
works! I realize it the code no longer tests for whether it's a mainwindow now 
but the point is I can now see how to do it. I still find it confusing... so 
I may have more questions, but I can at least see one working function.

Thanks all!

-- 
Eric Laffoon
Project Lead - kdewebdev module


More information about the Kommander-devel mailing list