Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/debugger/variable/variablewidget.cpp
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | 164 | { | |||
---|---|---|---|---|---|
171 | setModel(m_proxy); | 171 | setModel(m_proxy); | ||
172 | setSortingEnabled(true); | 172 | setSortingEnabled(true); | ||
173 | sortByColumn(VariableCollection::NameColumn, Qt::AscendingOrder); | 173 | sortByColumn(VariableCollection::NameColumn, Qt::AscendingOrder); | ||
174 | 174 | | |||
175 | QModelIndex index = controller->variableCollection()->indexForItem( | 175 | QModelIndex index = controller->variableCollection()->indexForItem( | ||
176 | controller->variableCollection()->watches(), 0); | 176 | controller->variableCollection()->watches(), 0); | ||
177 | setExpanded(index, true); | 177 | setExpanded(index, true); | ||
178 | 178 | | |||
179 | m_signalMapper = new QSignalMapper(this); | | |||
180 | setupActions(); | 179 | setupActions(); | ||
181 | } | 180 | } | ||
182 | 181 | | |||
183 | 182 | | |||
184 | VariableCollection* VariableTree::collection() const | 183 | VariableCollection* VariableTree::collection() const | ||
185 | { | 184 | { | ||
186 | Q_ASSERT(qobject_cast<VariableCollection*>(static_cast<QSortFilterProxyModel*>(model())->sourceModel())); | 185 | Q_ASSERT(qobject_cast<VariableCollection*>(static_cast<QSortFilterProxyModel*>(model())->sourceModel())); | ||
187 | return static_cast<VariableCollection*>(model()); | 186 | return static_cast<VariableCollection*>(model()); | ||
Show All 40 Lines | 195 | { | |||
228 | act->setData(Variable::Hexadecimal); | 227 | act->setData(Variable::Hexadecimal); | ||
229 | act->setShortcut(Qt::Key_H); | 228 | act->setShortcut(Qt::Key_H); | ||
230 | m_formatMenu->addAction(act); | 229 | m_formatMenu->addAction(act); | ||
231 | 230 | | |||
232 | foreach(QAction* act, m_formatMenu->actions()) | 231 | foreach(QAction* act, m_formatMenu->actions()) | ||
233 | { | 232 | { | ||
234 | act->setCheckable(true); | 233 | act->setCheckable(true); | ||
235 | act->setShortcutContext(Qt::WidgetWithChildrenShortcut); | 234 | act->setShortcutContext(Qt::WidgetWithChildrenShortcut); | ||
236 | m_signalMapper->setMapping(act, act->data().toInt()); | 235 | const int id = act->data().toInt(); | ||
237 | connect(act, &QAction::triggered, m_signalMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map)); | 236 | connect(act, &QAction::triggered, this, [this, id](){ changeVariableFormat(id); }); | ||
238 | addAction(act); | 237 | addAction(act); | ||
239 | } | 238 | } | ||
240 | connect(m_signalMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, &VariableTree::changeVariableFormat); | | |||
241 | 239 | | |||
242 | m_watchDelete = new QAction( | 240 | m_watchDelete = new QAction( | ||
243 | QIcon::fromTheme(QStringLiteral("edit-delete")), i18n( "Remove Watch Variable" ), this); | 241 | QIcon::fromTheme(QStringLiteral("edit-delete")), i18n( "Remove Watch Variable" ), this); | ||
244 | 242 | | |||
245 | m_watchDelete->setShortcut(Qt::Key_Delete); | 243 | m_watchDelete->setShortcut(Qt::Key_Delete); | ||
246 | m_watchDelete->setShortcutContext(Qt::WidgetWithChildrenShortcut); | 244 | m_watchDelete->setShortcutContext(Qt::WidgetWithChildrenShortcut); | ||
247 | addAction(m_watchDelete); | 245 | addAction(m_watchDelete); | ||
248 | connect(m_watchDelete, &QAction::triggered, this, &VariableTree::watchDelete); | 246 | connect(m_watchDelete, &QAction::triggered, this, &VariableTree::watchDelete); | ||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |