From d567669ae1c9bcfb94222ef049a5ce2980640ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sun, 2 Nov 2014 17:37:40 +0000 Subject: [PATCH] [GB.QT4] * 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 --- gb.qt4/src/CMenu.cpp | 18 +++++++++++++++++- gb.qt4/src/CMenu.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gb.qt4/src/CMenu.cpp b/gb.qt4/src/CMenu.cpp index b0c99695b..a2091fe9e 100644 --- a/gb.qt4/src/CMenu.cpp +++ b/gb.qt4/src/CMenu.cpp @@ -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()]; diff --git a/gb.qt4/src/CMenu.h b/gb.qt4/src/CMenu.h index 18f9fab05..d78c1e735 100644 --- a/gb.qt4/src/CMenu.h +++ b/gb.qt4/src/CMenu.h @@ -109,6 +109,7 @@ public: public slots: void slotTriggered(QAction *); + void slotToggled(bool); void slotDestroyed(); void slotShown(); void slotHidden();