16#ifndef LUA_DEBUGGER_WATCH_H
17#define LUA_DEBUGGER_WATCH_H
23#include <QStandardItemModel>
26#include <QStyledItemDelegate>
42class QStandardItemModel;
49constexpr int Spec = 0;
50constexpr int Value = 1;
51constexpr int Count = 2;
62 using QStandardItemModel::QStandardItemModel;
65 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
66 const QModelIndex &parent)
override;
93 void startDrag(Qt::DropActions supportedActions)
override;
94 void dragMoveEvent(QDragMoveEvent *event)
override;
95 void dropEvent(QDropEvent *event)
override;
114 using QStyledItemDelegate::QStyledItemDelegate;
116 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
125 using QStyledItemDelegate::QStyledItemDelegate;
127 void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
129 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
141 using CommitFn = std::function<void(QStandardItem *item,
const QString &text)>;
145 QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override;
146 void setEditorData(QWidget *editor,
const QModelIndex &index)
const override;
147 void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index)
const override;
186 void applyEmpty(QStandardItem *item,
const QString &muted,
const QString &watchTipExtra);
189 void applyNoLiveContext(QStandardItem *item,
const QString &muted,
const QString &watchTipExtra);
192 void applyError(QStandardItem *item,
const QString &errStr,
const QString &watchTipExtra);
195 void applySuccess(QStandardItem *item,
const QString &spec,
const char *val,
const char *typ,
bool can_expand,
196 const QString &watchTipExtra,
int stackLevel,
bool changeHighlightAllowed);
199 void applyExpression(QStandardItem *item,
const QString &spec,
const char *val,
const char *typ,
bool can_expand,
200 const QString &watchTipExtra,
int stackLevel,
bool changeHighlightAllowed);
203 QTreeView *tree_ =
nullptr;
204 QStandardItemModel *model_ =
nullptr;
229 void attach(QTreeView *tree, QStandardItemModel *model);
236 void configureColumns()
const;
265 void applyItemState(QStandardItem *item,
bool liveContext,
const QString &muted);
272 void insertNewRow(
const QString &initialSpec = QString(),
bool openEditor =
true);
286 void deleteRows(
const QList<QStandardItem *> &items);
338 void onExpanded(
const QModelIndex &index);
339 void onCollapsed(
const QModelIndex &index);
340 void showContextMenu(
const QPoint &pos);
346 void fillPathChildren(QStandardItem *parent,
const QString &path);
351 void fillExprChildren(QStandardItem *parent,
const QString &rootSpec,
const QString &subpath);
355 void updateHeaderButtonState();
358 QTreeView *tree_ =
nullptr;
359 QStandardItemModel *model_ =
nullptr;
360 QToolButton *removeButton_ =
nullptr;
361 QToolButton *removeAllButton_ =
nullptr;
369 QHash<QString, LuaDbgTreeSectionExpansionState> expansion_;
377 qint32 placeholderEpoch_ = 0;
Definition lua_debugger_watch.h:110
Definition lua_debugger_watch.h:58
Definition lua_debugger_watch.h:134
std::function< void(QStandardItem *item, const QString &text)> CommitFn
Callback invoked from setModelData when the user finishes editing a top-level watch row's expression....
Definition lua_debugger_watch.h:141
Definition lua_debugger_watch.h:121
"Value changed since last pause" highlighter for the Watch and Variables trees.
Definition lua_debugger_utils.h:534
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:165
Owns the dialog's font story end-to-end.
Definition lua_debugger_code_editor.h:300
Watch panel: column layout, expand/collapse tracking + lazy fill, runtime expansion-state map,...
Definition lua_debugger_watch.h:217
void invalidatePlaceholder()
Cancel the deferred placeholder by bumping the epoch. Call from handlePause() so the imminent refresh...
Definition lua_debugger_watch.cpp:1737
void restoreFrom(const QVariantMap &settingsMap)
Replace the watch tree with the contents of Watches in settingsMap. Empty / container-typed entries a...
Definition lua_debugger_watch.cpp:1698
void insertNewRow(const QString &initialSpec=QString(), bool openEditor=true)
Insert a top-level watch row; optionally open the inline editor. An empty initialSpec creates a "pend...
Definition lua_debugger_watch.cpp:1256
void copyValueForItem(QStandardItem *item, const QModelIndex &ix)
Copy the (untruncated when paused) value of item to the clipboard; shared between the row context men...
Definition lua_debugger_watch.cpp:1162
void applyItemState(QStandardItem *item, bool liveContext, const QString &muted)
Apply the per-row presentation for item given the current liveness context. Reads the row state,...
Definition lua_debugger_watch.cpp:1602
void scheduleDeferredPlaceholder()
Schedule a deferred "Watch column shows —" placeholder paint after a step resume.
Definition lua_debugger_watch.cpp:1742
void refillChildren(QStandardItem *item)
Re-query and replace all children of item. Used by the lazy-expand path and by refreshBranch after pa...
Definition lua_debugger_watch.cpp:833
void removeAllTopLevelItems()
Confirm with the user, then remove every top-level row.
Definition lua_debugger_watch.cpp:1124
void refreshDisplay()
Refresh value/type (and expansion affordances) for all watch roots, recursing into already-expanded b...
Definition lua_debugger_watch.cpp:1562
void restoreExpansionState()
Re-expand persisted subpaths after refilling roots from settings.
Definition lua_debugger_watch.cpp:874
void attachHeaderButtons(QToolButton *remove, QToolButton *removeAll)
Bind the section-header strip. Click signals are wired here; enable/disable state tracks the model an...
Definition lua_debugger_watch.cpp:742
QList< QStandardItem * > selectedRootItemsForRemove() const
Top-level watch rows in the current selection (column 0) only; used by the section header Remove cont...
Definition lua_debugger_watch.cpp:1069
QStringList expandedSubpathsForSpec(const QString &rootSpec) const
Look up expanded descendant keys for rootSpec (may be empty).
Definition lua_debugger_watch.cpp:794
void pruneExpansionMap()
Drop expansion-map entries for watch specs no longer in the tree.
Definition lua_debugger_watch.cpp:799
void deleteRows(const QList< QStandardItem * > &items)
Delete the given top-level watch rows from the tree. Children, non-top-level rows and stale pointers ...
Definition lua_debugger_watch.cpp:1092
void commitWatchRootSpec(QStandardItem *item, const QString &text)
Apply the user's edit of a top-level watch row's expression.
Definition lua_debugger_watch.cpp:1316
void serializeTo(QVariantMap &settingsMap)
Snapshot the live watch tree as a flat array of canonical spec strings into settingsMap (at the Watch...
Definition lua_debugger_watch.cpp:1664
void attach(QTreeView *tree, QStandardItemModel *model)
Bind the tree + model and wire all watch-internal signals (typed LuaDbgWatchTreeWidget gestures,...
Definition lua_debugger_watch.cpp:684
void refreshBranch(QStandardItem *item)
Re-evaluate one expanded branch depth-first; preserves the controller-tracked expansion state of nest...
Definition lua_debugger_watch.cpp:1582
void duplicateRootItem(QStandardItem *item)
Duplicate top-level watch row item below itself.
Definition lua_debugger_watch.cpp:1216
Per-row presentation for top-level Watch rows.
Definition lua_debugger_watch.h:170
void applyNoLiveContext(QStandardItem *item, const QString &muted, const QString &watchTipExtra)
Live context unavailable (debugger not paused).
Definition lua_debugger_watch.cpp:417
void applyExpression(QStandardItem *item, const QString &spec, const char *val, const char *typ, bool can_expand, const QString &watchTipExtra, int stackLevel, bool changeHighlightAllowed)
Expression-style watch root with a successful read.
Definition lua_debugger_watch.cpp:551
void applyError(QStandardItem *item, const QString &errStr, const QString &watchTipExtra)
Watch evaluation failed (path not found, expr error, etc.).
Definition lua_debugger_watch.cpp:458
void applySuccess(QStandardItem *item, const QString &spec, const char *val, const char *typ, bool can_expand, const QString &watchTipExtra, int stackLevel, bool changeHighlightAllowed)
Path-style watch root with a successful read.
Definition lua_debugger_watch.cpp:500
void applyEmpty(QStandardItem *item, const QString &muted, const QString &watchTipExtra)
Empty top-level row (no spec yet).
Definition lua_debugger_watch.cpp:394
Column indices for the Watch tree model.
Definition lua_debugger_watch.h:48