* BUG: The Menu.Checked property now returns the correct value for
  non-radio menu items.


git-svn-id: svn://localhost/gambas/trunk@6604 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-11-02 17:37:40 +00:00
parent 26d4540cde
commit d567669ae1
2 changed files with 18 additions and 1 deletions

View File

@ -340,6 +340,7 @@ BEGIN_METHOD(Menu_new, GB_OBJECT parent; GB_BOOLEAN hidden)
action = new MyAction(menu->menu);
action->setSeparator(true);
QObject::connect(action, SIGNAL(toggled(bool)), &CMenu::manager, SLOT(slotToggled(bool)));
QObject::connect(action, SIGNAL(destroyed()), &CMenu::manager, SLOT(slotDestroyed()));
menu->menu->addAction(action);
@ -499,7 +500,9 @@ BEGIN_PROPERTY(Menu_Checked)
else
{
if (READ_PROPERTY)
GB.ReturnBoolean(ACTION->isChecked());
{
GB.ReturnBoolean(THIS->checked);
}
else
{
THIS->checked = VPROP(GB_BOOLEAN);
@ -997,6 +1000,19 @@ void CMenu::unrefChildren(QWidget *w)
}
}*/
void CMenu::slotToggled(bool checked)
{
CMENU *_object = dict[(QAction *)sender()];
if (!_object)
return;
if (!THIS->radio)
return;
THIS->checked = checked;
}
void CMenu::slotDestroyed(void)
{
CMENU *_object = dict[(QAction *)sender()];

View File

@ -109,6 +109,7 @@ public:
public slots:
void slotTriggered(QAction *);
void slotToggled(bool);
void slotDestroyed();
void slotShown();
void slotHidden();