[Kommander-devel] Mainwindow proxy - again

Eric Laffoon eric at kdewebdev.org
Wed Mar 26 22:12:40 EDT 2008


On Wednesday 26 March 2008 4:03:07 pm Eric Laffoon wrote:
> 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!

Actions work perfectly. However the string used to get them is not for the 
faint of heart. Consequently I'm not finding an easy solution to get access 
to the statusBar. I'm hoping toolbars are easier. Menus are a plus. Any help?

-- 
Eric Laffoon
Project Lead - kdewebdev module


More information about the Kommander-devel mailing list