mirror of
https://github.com/leozide/leocad.git
synced 2026-10-26 22:10:32 +00:00
Collecting completed geometry called Project::SetActiveModel() afterward, which restored only the tab model. An in-place editing target was left inactive with final-step geometry despite retaining its earlier current step. Snapshot each model's active flag in a scoped guard and restore models individually after collecting geometry. The main model remains the export source, and all exit paths restore the edited models' current-step poses. Also simplify the common AGENTS.md translation guidance to require translatable UI strings without mandating catalog refreshes. Validated the Qt 6 application build and 30 focused export checks covering OBJ, COLLADA, 3DS, and POV-Ray success, cancellation, and write errors, plus completed main-model geometry and nested editing state restoration.
2.0 KiB
2.0 KiB
Code instructions
- Keep the file lists in
leocad.proalphabetically sorted within their existing groups. - Get Qt and std includes through the precompiled header,
lc_global.h. - Prefer std containers, use Qt containers where a Qt API boundary makes them useful.
- Prefer
lcstrcpy()andlcstrcat()fromlc_string.hfor bounded C-string copies and concatenation. Use the array overloads when possible; avoidstrncpy()plus manual null termination. Keep standard functions where no suitablelchelper exists. - Avoid using
autofor ordinary variable types. Template iterators, lambdas, and structured bindings may use it for readability. - Do not nest ternary expressions. Use explicit branches when a choice needs another condition.
- Prefer a private static member function over a file-scope helper when the function belongs to a class and does not use instance state.
- Prefer explicit
lock()andunlock()over an extra scope withQMutexLockerfor short, straight-line critical sections that must end before the following code. KeepQMutexLockerfor early returns, waits, or nontrivial control flow. - Preserve existing blank lines when editing code. Prefer blank lines between declarations and following logic, and between distinct logical steps; do not remove user-added blank lines without a specific reason.
- When adding a parameter to an existing function, update every call site explicitly instead of adding a default argument to preserve old calls.
Commit Messages
- Every nontrivial commit must have a concise subject and a descriptive body.
- Explain the problem or trigger, why the change is needed, and how the resulting behavior addresses it.
- Write for a future maintainer without access to the chat. Do not merely restate the diff or include conversational history.
- Subject-only messages are acceptable for purely mechanical changes.
Dialog help and translations
- Follow
docs/dialog-help.mdwhen adding or changing dialog controls, including help text, label buddies, and Help/F1 behavior. - Keep UI strings translatable.