Fold arrows, pointer format, teal custom types, collapsed pointers by default

- Change fold indicators from +/- to arrow icons (▸ collapsed, ▾ expanded)
- Move ▾ dropdown arrow after text on command rows (source▾, struct▾)
- Change pointer display from ptr64<Type> to Type* format
- Color custom/user-defined types teal (#4EC9B0) via lexer GlobalClass
- Keep built-in types blue (#569cd6) via KeywordSet2
- Remove underline from root class name on CommandRow2
- Pointer children start collapsed by default (lazy expansion)
- Demo data updated accordingly
This commit is contained in:
megablox
2026-02-08 11:00:11 -07:00
committed by sysadmin
parent 105ad398b6
commit 6a9641edc5
12 changed files with 610 additions and 393 deletions

View File

@@ -51,12 +51,11 @@ QString arrayTypeName(NodeKind elemKind, int count) {
return elem + QStringLiteral("[") + QString::number(count) + QStringLiteral("]");
}
// Pointer type string: "ptr64<void>" or "ptr64<StructName>"
// Pointer type string: "void*" or "StructName*"
QString pointerTypeName(NodeKind kind, const QString& targetName) {
auto* m = kindMeta(kind);
QString base = m ? QString::fromLatin1(m->typeName) : QStringLiteral("???");
Q_UNUSED(kind);
QString target = targetName.isEmpty() ? QStringLiteral("void") : targetName;
return base + QStringLiteral("<") + target + QStringLiteral(">");
return target + QStringLiteral("*");
}
// ── Value formatting ──
@@ -78,8 +77,20 @@ QString fmtUInt16(uint16_t v) { return hexVal(v); }
QString fmtUInt32(uint32_t v) { return hexVal(v); }
QString fmtUInt64(uint64_t v) { return hexVal(v); }
QString fmtFloat(float v) { return QString::number(v, 'g', 4); } // 4 sig figs keeps it short
QString fmtDouble(double v) { return QString::number(v, 'g', 6); }
QString fmtFloat(float v) {
QString s = QString::number(v, 'g', 4);
if (!s.contains('.') && !s.contains('e') && !s.contains('E'))
s += QStringLiteral(".f");
else
s += QLatin1Char('f');
return s;
}
QString fmtDouble(double v) {
QString s = QString::number(v, 'g', 6);
if (!s.contains('.') && !s.contains('e') && !s.contains('E'))
s += QStringLiteral(".0");
return s;
}
QString fmtBool(uint8_t v) { return v ? QStringLiteral("true") : QStringLiteral("false"); }
QString fmtPointer32(uint32_t v) {
@@ -497,12 +508,15 @@ QByteArray parseValue(NodeKind kind, const QString& text, bool* ok) {
case NodeKind::UInt32: { int b = s.startsWith("0x",Qt::CaseInsensitive)?16:10; qulonglong val = stripHex(s).toULongLong(ok,b); return parseIntChecked<uint32_t>(val, ok); }
case NodeKind::UInt64: { int b = s.startsWith("0x",Qt::CaseInsensitive)?16:10; qulonglong val = stripHex(s).toULongLong(ok,b); return *ok ? toBytes<uint64_t>(val) : QByteArray{}; }
case NodeKind::Float: {
QString n = s; n.replace(',', '.'); // Accept EU decimal separator
QString n = s.trimmed();
if (n.endsWith('f', Qt::CaseInsensitive)) n.chop(1);
n.replace(',', '.');
float val = n.toFloat(ok);
return *ok ? toBytes<float>(val) : QByteArray{};
}
case NodeKind::Double: {
QString n = s; n.replace(',', '.'); // Accept EU decimal separator
QString n = s.trimmed();
n.replace(',', '.');
double val = n.toDouble(ok);
return *ok ? toBytes<double>(val) : QByteArray{};
}