26#if defined (HAVE_CONFIG_H)
47 std::string s (up.get_accelerator ());
54 if (c >=
'A' && c <=
'Z')
56 if (c >=
'a' && c <=
'z')
58 if (c >=
'A' && c <=
'Z')
59 return QKeySequence (keyMod |
static_cast<int> (c));
62 return QKeySequence ();
67 const graphics_object& go)
76 return new Menu (oct_qobj, interp, go,
new QAction (qObj),
84 const graphics_object& go, QAction *action,
Object *xparent)
85 :
Object (oct_qobj, interp, go, action), m_parent (nullptr),
94 action->setCheckable (
true);
95 action->setChecked (up.is_checked ());
98 action->setEnabled (up.is_enable ());
100 action->setVisible (up.is_visible ());
102 if (up.is_separator ())
116 int pos =
static_cast<int> (up.get_position ());
122 m_parent->insertAction (
nullptr, action);
126 for (
auto *a :
m_parent->actions ())
127 if (! a->isSeparator ())
130 up.get_property (
"position").set
131 (
octave_value (
static_cast<double> (count)),
true,
false);
137 QAction *before =
nullptr;
139 for (
auto *a :
m_parent->actions ())
141 if (! a->isSeparator ())
154 m_parent->insertAction (before, action);
159 up.get_property (
"position").set
160 (
octave_value (
static_cast<double> (count+1)),
true,
false);
174 QAction *action = qWidget<QAction> ();
178 case uimenu::properties::ID_TEXT:
182 case uimenu::properties::ID_CHECKED:
183 if (up.is_checked ())
185 action->setCheckable (
true);
186 action->setChecked (up.is_checked ());
190 action->setChecked (
false);
191 action->setCheckable (
false);
195 case uimenu::properties::ID_ENABLE:
196 action->setEnabled (up.is_enable ());
199 case uimenu::properties::ID_ACCELERATOR:
200 if (! action->menu ())
204 case uimenu::properties::ID_SEPARATOR:
205 if (up.is_separator ())
224 case uimenu::properties::ID_VISIBLE:
225 action->setVisible (up.is_visible ());
230 case uimenu::properties::ID_POSITION:
237 int pos =
static_cast<int> (up.get_position ());
238 QAction *before =
nullptr;
244 for (
auto *a :
m_parent->actions ())
246 if (! a->isSeparator ())
261 m_parent->insertAction (before, action);
276 QAction *action = qWidget<QAction> ();
277 QMenu *action_menu = action->menu ();
281 action_menu =
new QMenu (action->parentWidget ());
282 action->setMenu (action_menu);
283 action->setShortcut (QKeySequence ());
293 QAction *action = qWidget<QAction> ();
295 if (action->isCheckable ())
296 action->setChecked (! action->isChecked ());
313 for (
auto *a :
m_parent->actions ())
315 if (! a->isSeparator ())
321 graphics_object go = aObj->
object ();
325 if (go.isa (
"uimenu"))
329 up.get_property (
"position").set
void gh_callback_event(const graphics_handle &h, const std::string &name)
virtual void update(int pId)
static Object * fromQObject(QObject *obj)
virtual QObject * qObject(void)
graphics_object object(void) const
static Object * parentObject(octave::interpreter &interp, const graphics_object &go)
Base class for Octave interfaces that use Qt.
const Qt::KeyboardModifier CTRL
QString fromStdString(const std::string &s)
T::properties & properties(graphics_object obj)
static QKeySequence accelSequence(const uimenu::properties &up)