mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 11:52:25 +00:00
Do not make all menu entries checkable
* src/frontends/qt4/Action.C (Action): do not set entry to checkable by default; invoke update() to set it up. (update): only set checkable property if needed. * src/frontends/qt4/QLPopupMenu.C (populate): in the case of a Command menu item, let Action set itself up. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14811 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
61443d8641
commit
9ee8395133
@ -48,7 +48,7 @@ Action::Action(LyXView & lyxView, string const & text,
|
|||||||
setToolTip(toqstr(tooltip));
|
setToolTip(toqstr(tooltip));
|
||||||
setStatusTip(toqstr(tooltip));
|
setStatusTip(toqstr(tooltip));
|
||||||
connect(this, SIGNAL(triggered()), this, SLOT(action()));
|
connect(this, SIGNAL(triggered()), this, SLOT(action()));
|
||||||
this->setCheckable(true);
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action::Action(LyXView & lyxView, string const & icon, string const & text,
|
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));
|
setToolTip(toqstr(tooltip));
|
||||||
setStatusTip(toqstr(tooltip));
|
setStatusTip(toqstr(tooltip));
|
||||||
connect(this, SIGNAL(triggered()), this, SLOT(action()));
|
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_);
|
FuncStatus const status = lyxView_.getLyXFunc().getStatus(func_);
|
||||||
|
|
||||||
this->setChecked(status.onoff(true));
|
if (status.onoff(true)) {
|
||||||
this->setEnabled(status.enabled());
|
setCheckable(true);
|
||||||
|
setChecked(true);
|
||||||
|
} else if (status.onoff(false)) {
|
||||||
|
setCheckable(true);
|
||||||
|
setChecked(false);
|
||||||
|
} else {
|
||||||
|
setCheckable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
setEnabled(status.enabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,16 +114,13 @@ void QLPopupMenu::populate(QMenu* qMenu, Menu * menu)
|
|||||||
|
|
||||||
} else { // we have a MenuItem::Command
|
} else { // we have a MenuItem::Command
|
||||||
|
|
||||||
FuncStatus status = m->status();
|
|
||||||
lyxerr[Debug::GUI] << "creating Menu Item " << m->label() << endl;
|
lyxerr[Debug::GUI] << "creating Menu Item " << m->label() << endl;
|
||||||
|
|
||||||
string label = getLabel(*m);
|
string label = getLabel(*m);
|
||||||
addBinding(label, *m);
|
addBinding(label, *m);
|
||||||
|
|
||||||
Action * action = new Action(*(owner_->view()), label, m->func());
|
Action * action = new Action(*(owner_->view()),
|
||||||
action->setEnabled(m->status().enabled());
|
label, m->func());
|
||||||
action->setChecked(m->status().onoff(true));
|
|
||||||
// Actually insert the menu item
|
|
||||||
qMenu->addAction(action);
|
qMenu->addAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user