完成主要交互、高性能组件、国际化和A型传感器数据包接收
This commit is contained in:
76
README.md
76
README.md
@@ -257,3 +257,79 @@ m_dotsProg->release();
|
||||
- 想要更柔和的圆边:用 `smoothstep` 做 alpha 边缘 + 开启 blending
|
||||
- 想要真正的 3D 圆柱/球:就不能靠 discard 了,需要真正的几何或法线光照
|
||||
|
||||
## Metrics ????
|
||||
|
||||
Metrics ?????????? payload?`DataFrame.data`??????? `metricsChanged` ???
|
||||
|
||||
- ??????
|
||||
- ????sqrt(mean(v^2))
|
||||
- ????mean(v)
|
||||
- ??????? - ???
|
||||
|
||||
## Live Trend ??
|
||||
|
||||
Live Trend ????? payload ???sum of `DataFrame.data`???????????????? `src/data_backend.cpp` ? `updateMetrics_()` ???? `metricSum`??? `qml/content/RightPanel.qml` ??? `Backend.data.metricSum` ??????
|
||||
|
||||
## Live Trend ??????????
|
||||
|
||||
????????? `QImage` ?????????? DPI?devicePixelRatio??????? DPI ??????????????????????? y ???????????????????????
|
||||
|
||||
?????
|
||||
- ???????? `devicePixelRatio` ???????
|
||||
- ????????????????????
|
||||
- ???????? y ????????????????
|
||||
|
||||
?????????
|
||||
|
||||
```cpp
|
||||
// src/sparkline_plotitem.h
|
||||
private:
|
||||
QSGTexture* getTextTexture(const QString& text, const QFont& font, QSize* outSize = nullptr);
|
||||
```
|
||||
|
||||
```cpp
|
||||
// src/sparkling_plotitem.cpp
|
||||
QSGTexture* SparklinePlotItem::getTextTexture(const QString& text, const QFont& font, QSize* outSize) {
|
||||
const qreal dpr = window() ? window()->devicePixelRatio() : 1.0;
|
||||
const QString key = text + "|" + font.family() + "|" + QString::number(font.pixelSize()) +
|
||||
"|" + QString::number(dpr, 'f', 2);
|
||||
...
|
||||
const QSize pixelSize(qMax(1, qRound(sz.width() * dpr)), qMax(1, qRound(sz.height() * dpr)));
|
||||
QImage img(pixelSize, QImage::Format_ARGB32_Premultiplied);
|
||||
img.setDevicePixelRatio(dpr);
|
||||
...
|
||||
m_textCache[key] = { tex, sz };
|
||||
if (outSize)
|
||||
*outSize = sz;
|
||||
return tex;
|
||||
}
|
||||
|
||||
QSGNode* SparklinePlotItem::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) {
|
||||
const qreal dpr = window()->devicePixelRatio();
|
||||
auto alignToPixel = [dpr](float v) -> float {
|
||||
return (dpr > 0.0) ? (std::round(v * dpr) / dpr) : v;
|
||||
};
|
||||
...
|
||||
float py = alignToPixel(bottom - yn * plotH);
|
||||
...
|
||||
QSize logicalSize;
|
||||
QSGTexture* tex = getTextTexture(label, font, &logicalSize);
|
||||
float ty = alignToPixel(py - logicalSize.height() / 2.0f);
|
||||
tnode->setRect(QRectF(tx, ty, logicalSize.width(), logicalSize.height()));
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Export Logic
|
||||
|
||||
Export is driven by the Save dialog and DataBackend::exportHandler():
|
||||
|
||||
- QML triggers Backend.data.exportHandler(folder, filename, format, method) from qml/content/LeftPanel.qml.
|
||||
- older is a local QUrl (e.g. ile:///C:/...), converted to a local path on the C++ side.
|
||||
- Supported formats: csv, json.
|
||||
- Supported methods: overwrite (default), ppend.
|
||||
- CSV append: appends all current frames to the file.
|
||||
- JSON append: loads existing array (if any), appends all current frames, and rewrites the file.
|
||||
- xlsx and zip are not implemented yet and will log a warning.
|
||||
|
||||
Relevant code: src/data_backend.cpp (exportHandler, uildCsv_, uildJson_), qml/content/SaveAsExportDialog.qml.
|
||||
|
||||
Reference in New Issue
Block a user