diff --git a/src/frontends/qt4/Action.C b/src/frontends/qt4/Action.C index 58b58f2987..adb89916e1 100644 --- a/src/frontends/qt4/Action.C +++ b/src/frontends/qt4/Action.C @@ -48,7 +48,7 @@ Action::Action(LyXView & lyxView, string const & text, setToolTip(toqstr(tooltip)); setStatusTip(toqstr(tooltip)); connect(this, SIGNAL(triggered()), this, SLOT(action())); - this->setCheckable(true); + update(); } Action::Action(LyXView & lyxView, string const & icon, string const & text, @@ -60,7 +60,7 @@ Action::Action(LyXView & lyxView, string const & icon, string const & text, setToolTip(toqstr(tooltip)); setStatusTip(toqstr(tooltip)); connect(this, SIGNAL(triggered()), this, SLOT(action())); - this->setCheckable(true); + update(); } /* @@ -74,8 +74,17 @@ void Action::update() { FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_); - this->setChecked(status.onoff(true)); - this->setEnabled(status.enabled()); + if (status.onoff(true)) { + setCheckable(true); + setChecked(true); + } else if (status.onoff(false)) { + setCheckable(true); + setChecked(false); + } else { + setCheckable(false); + } + + setEnabled(status.enabled()); } diff --git a/src/frontends/qt4/QLPopupMenu.C b/src/frontends/qt4/QLPopupMenu.C index ea90bfbdc7..9d2992d240 100644 --- a/src/frontends/qt4/QLPopupMenu.C +++ b/src/frontends/qt4/QLPopupMenu.C @@ -114,16 +114,13 @@ void QLPopupMenu::populate(QMenu* qMenu, Menu * menu) } else { // we have a MenuItem::Command - FuncStatus status = m->status(); lyxerr[Debug::GUI] << "creating Menu Item " << m->label() << endl; string label = getLabel(*m); addBinding(label, *m); - Action * action = new Action(*(owner_->view()), label, m->func()); - action->setEnabled(m->status().enabled()); - action->setChecked(m->status().onoff(true)); - // Actually insert the menu item + Action * action = new Action(*(owner_->view()), + label, m->func()); qMenu->addAction(action); } }