MCPcopy Create free account
hub / github.com/KDE/kdevelop / setupActions

Method setupActions

kdevplatform/debugger/variable/variablewidget.cpp:205–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void VariableTree::setupActions()
206{
207 // TODO decorate this properly to make nice menu title
208 m_contextMenuTitle = new QAction(this);
209 m_contextMenuTitle->setEnabled(false);
210
211 // make Format menu action group
212 m_formatMenu = new QMenu(i18n("&Format"), this);
213 auto *ag= new QActionGroup(m_formatMenu);
214
215 QAction* act;
216
217 act = new QAction(i18n("&Natural"), ag);
218 act->setData(Variable::Natural);
219 act->setShortcut(Qt::Key_N);
220 m_formatMenu->addAction(act);
221
222 act = new QAction(i18n("&Binary"), ag);
223 act->setData(Variable::Binary);
224 act->setShortcut(Qt::Key_B);
225 m_formatMenu->addAction(act);
226
227 act = new QAction(i18n("&Octal"), ag);
228 act->setData(Variable::Octal);
229 act->setShortcut(Qt::Key_O);
230 m_formatMenu->addAction(act);
231
232 act = new QAction(i18n("&Decimal"), ag);
233 act->setData(Variable::Decimal);
234 act->setShortcut(Qt::Key_D);
235 m_formatMenu->addAction(act);
236
237 act = new QAction(i18n("&Hexadecimal"), ag);
238 act->setData(Variable::Hexadecimal);
239 act->setShortcut(Qt::Key_H);
240 m_formatMenu->addAction(act);
241
242 const auto formatMenuActions = m_formatMenu->actions();
243 for (QAction* act : formatMenuActions) {
244 act->setCheckable(true);
245 act->setShortcutContext(Qt::WidgetWithChildrenShortcut);
246 const int id = act->data().toInt();
247 connect(act, &QAction::triggered, this, [this, id](){ changeVariableFormat(id); });
248 addAction(act);
249 }
250
251 m_watchDelete = new QAction(
252 QIcon::fromTheme(QStringLiteral("edit-delete")), i18n( "Remove Watch Variable" ), this);
253
254 m_watchDelete->setShortcut(Qt::Key_Delete);
255 m_watchDelete->setShortcutContext(Qt::WidgetWithChildrenShortcut);
256 addAction(m_watchDelete);
257 connect(m_watchDelete, &QAction::triggered, this, &VariableTree::watchDelete);
258
259 m_copyVariableValue = new QAction(i18n("&Copy Value"), this);
260 m_copyVariableValue->setShortcutContext(Qt::WidgetWithChildrenShortcut);
261 m_copyVariableValue->setShortcut(QKeySequence::Copy);
262 connect(m_copyVariableValue, &QAction::triggered, this, &VariableTree::copyVariableValue);

Callers

nothing calls this directly

Calls 6

toIntMethod · 0.80
setEnabledMethod · 0.45
setDataMethod · 0.45
addActionMethod · 0.45
actionsMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected