ifcviewer: replace qInfo/qWarning with a Qt-free logger seam

Add Log.h (in IfcViewerCore) — a tiny stream-style logger that backs
fprintf(stderr,...), with overloads for the common primitives + char
strings. Mimics qInfo()/qWarning()'s syntax surface enough that
mass-replacing qInfo()→Log::info() and qWarning()→Log::warn() keeps
existing call sites parsing unchanged; .noquote() / .nospace() exist
as compat no-ops so chained qInfo().noquote()<<x<<y patterns survive.

QString streaming is a transitional concern — the QString → std::string
sweep (#80) hasn't landed yet, so ViewportWindow and friends still
construct QStrings for log payloads. LogQt.h (in IfcViewer, not Core)
adds the QString / QStringView operator<< overloads so those streaming
sites work without source changes during the in-flight Qt removal.
When #80 retires QString, LogQt.h drops out.

ViewportWindow.cpp: 132 qInfo/qWarning callsites converted. The two
printf-style qInfo("fmt %s", ...) callsites get fprintf with explicit
[info]/[warn] prefixes to keep the output discoverable.

Also de-Qt'd:
  AreaMeasurement.cpp  — 1 qInfo("fmt", …) → fprintf
  SceneLoader.cpp      — 4 qDebug + 1 qWarning printf-style → fprintf
  GeometryStreamer.cpp — 2 qDebug printf-style → fprintf
  ifcviewer-minimal/main.cpp — 2 qWarning << → Log::warn

Drops <QDebug> from each. Closes #82.

Builds: desktop / bonsai / web all green. Tests 100/100 pass.
This commit is contained in:
Dion Moult
2026-06-05 08:58:45 +10:00
parent 77cf535b45
commit 6dd3558db9
8 changed files with 348 additions and 161 deletions
+5 -4
View File
@@ -22,7 +22,7 @@
#include "OverlayRenderer.h"
#include "ViewportWindow.h"
#include <QDebug>
#include <cstdio>
#include <QString>
#include <algorithm>
@@ -280,9 +280,10 @@ void AreaMeasurement::onPick(ViewportWindow& vp,
rebuildHighlightAndLabels(vp);
qInfo("[wgpu area] %s%.6f m^2 (total: %.6f m^2, %zu tris)",
delta >= 0.0 ? "+" : "", delta,
total_area_m2_, selected_.size());
std::fprintf(stderr,
"[info] [wgpu area] %s%.6f m^2 (total: %.6f m^2, %zu tris)\n",
delta >= 0.0 ? "+" : "", delta,
total_area_m2_, selected_.size());
}
void AreaMeasurement::rebuildHighlightAndLabels(ViewportWindow& vp) {