mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-29 16:22:53 +00:00
ifcviewer: de-Qt ViewportWindow public API (QString → std::string)
Take QString out of ViewportWindow's outward-facing surface so it can
eventually move into a Qt-free ViewportCore:
void queueLoadSidecar(const QString&) → (const std::string&)
uint32_t loadSidecar(const QString&) → (const std::string&)
QString cameraString() const → std::string …
void captureNextFrameToPng(const QString&, bool)
→ (const std::string&, bool)
void setHudText(const QString&) → (const std::string&)
Internal members also moved off QString:
std::deque<QString> pending_sidecars_ → std::deque<std::string>
QString pending_screenshot_path_ → std::string
Implementation strategy: convert at the boundary where ViewportWindow
still leans on Qt internals — `loadSidecar` bridges to QString once
for QFile/QDir/QFileInfo path handling; the screenshot save path
constructs a QString locally for QImage::save; the OverlayRenderer's
HUD setter still takes QString so setHudText converts before calling
through. Each of those bridges goes away when ViewportCore lands and
OverlayRenderer / SceneLoader / SidecarBuilder get their own de-Qt
sweeps. cameraString now produces its CSV via snprintf — no QString
ever instantiated.
Bonsai-side updates (compile-only):
ifcviewer-minimal/main.cpp — queueLoadSidecar / captureNextFrameToPng
callers add .toStdString() on the QString
parser result
modules/viewport/View.cpp — setHudText callers add .toStdString() to
their `QString::arg(...)` formatter chains;
two `QString()` empty sentinels become
`std::string()`
Measurement.cpp — same pattern, two setHudText sites
ifcviewer/LengthMeasurement.cpp — same, three sites
The cameraString string-streaming fix-up in ViewportWindow.cpp drops
the temporary .toUtf8().constData() bridge from #82 — Log::Stream's
std::string overload now handles it directly.
Builds: desktop / bonsai / web all green. Tests 100/100. Closes #80.
This commit is contained in:
@@ -75,7 +75,7 @@ int main(int argc, char* argv[]) {
|
||||
// Queue sidecars; they're loaded after wgpu init completes in
|
||||
// exposeEvent. Ordering matches the command line.
|
||||
for (const QString& path : parser.positionalArguments()) {
|
||||
viewport->queueLoadSidecar(path);
|
||||
viewport->queueLoadSidecar(path.toStdString());
|
||||
}
|
||||
|
||||
if (parser.isSet("camera")) {
|
||||
@@ -97,7 +97,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
if (parser.isSet("screenshot")) {
|
||||
viewport->captureNextFrameToPng(parser.value("screenshot"),
|
||||
viewport->captureNextFrameToPng(parser.value("screenshot").toStdString(),
|
||||
/*quit_after=*/true);
|
||||
}
|
||||
if (parser.isSet("benchmark")) {
|
||||
|
||||
Reference in New Issue
Block a user