Skip to content

Instantly share code, notes, and snippets.

View t-book's full-sized avatar
💭
reading

Toni t-book

💭
reading
View GitHub Profile
@t-book
t-book / qfieldCloud improvements.md
Last active April 10, 2026 09:00
qfieldCloud improvements.md

1. Mutable default argument in permission_check

https://docs.quantifiedcode.com/python-anti-patterns/correctness/mutable_default_value_as_argument.html

File: docker-app/qfieldcloud/core/permission_check.py, line 9

The check_args parameter uses a mutable list [] as its default value. While it doesn't seem to be mutated in the current code, this is a common Python footgun — if anyone ever adds an in-place modification down the line, the shared list would cause hard-to-trace bugs across decorated views.

Current code:

/*
================================================================================
MATERIALISIERTE VIEW: Grabstellen mit intelligenter Punktplatzierung
================================================================================
ZWECK:
Diese materialisierte View erstellt für jede Grabstelle (Polygon) einen
optimalen Textplatzierungspunkt samt Rotation für die Kartendarstellung.
HAUPTPROBLEM:
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.qfield
import org.qgis
import Theme
Item {
id: plugin
SECTION("ReadFileContent")
{
// Create a temporary file with known content
QTemporaryFile tempFile;
REQUIRE(tempFile.open());
const QString testContent = "This is test content for file reading";
tempFile.write(testContent.toUtf8());
tempFile.flush();
// ===> In fileutils.h
/**
* Reads the entire content of a file and returns it as a byte array.
* @param filePath The path to the file to be read
* @return The file content as a QByteArray
*/
Q_INVOKABLE static QByteArray readFileContent(const QString &filePath);
/**
* Writes content to a file.
@t-book
t-book / Link
Created December 14, 2024 15:10
  1. Quellverzeichnis und Zielverzeichnis auswählen

    • Vor Beginn der Verarbeitung prüfen, ob Quelldaten vorhanden sind. Falls der in-Ordner leer ist, wird das Programm gestoppt und eine Fehlermeldung ausgegeben.
  2. Messdateien von Quellverzeichnis kombinieren

    • Mehrere Messdateien in einer Datei zusammenführen => out.dat
  3. out.dat Bereinigung

    3a. `Geotags standardisieren