Skip to content

Structured files wlx (JSON, XML, CBOR, INI, TOML, YML)#41

Open
pplupo wants to merge 9 commits into
doublecmd:masterfrom
pplupo:structview
Open

Structured files wlx (JSON, XML, CBOR, INI, TOML, YML)#41
pplupo wants to merge 9 commits into
doublecmd:masterfrom
pplupo:structview

Conversation

@pplupo

@pplupo pplupo commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This viewer superseeds the JSON viewer I had previously implemented. It has support for multiple formats using a standardized interface. More information in the README.md file.

pplupo added 9 commits June 16, 2026 11:04
- Add createEditor/setEditorData/setModelData/updateEditorGeometry to
  WrapAnywhereDelegate so all grid cells edit with QPlainTextEdit,
  preserving newlines correctly
- Let Enter/Return and Up/Down pass through to QPlainTextEdit so they
  work as expected within multi-line text
- Ctrl+Enter commits and closes the editor
- Remove the temporary MultiLineDelegate from StructViewWidget.cpp now
  that the fix lives in the shared delegate
The grid was showing outdated data after reopening a file because
setCurrentIndex() does not always emit currentChanged when the selected
position (0,0) is the same as the previous session. This left
m_currentNode pointing into the destroyed old engine's node tree.

Fix: explicitly null m_currentNode and clear the grid model before
repopulating the tree, then call showNodeData() directly with the new
root node — bypassing the selection signal entirely.
- Enter: commit and close the editor (was Ctrl+Enter)
- Ctrl+Enter: insert a newline (was plain Enter)
Move QPlainTextEdit Enter handling to WrapAnywhereDelegate::eventFilter.
Qt installs the delegate as event filter on the editor widget, so that
is the correct interception point — not EditableGridWidget::eventFilter
which only sees events on m_view (never reached during editing).

Qt's QAbstractItemDelegate::eventFilter deliberately skips the
Enter→commit behavior for QPlainTextEdit, so we must override it here.

- Enter: commit and close
- Ctrl+Enter: insert newline
Instead of calling insertPlainText() from the event filter (which was
silently failing in dbview with AnyKeyPressed + proxy model), simply
do not intercept Ctrl+Enter at all.

QAbstractItemDelegate::eventFilter already skips the commit behavior
for QPlainTextEdit editors, so the event falls through to
QPlainTextEdit::keyPressEvent which inserts a newline naturally.
This approach is robust regardless of edit trigger or model setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant