← All bug reports

FS#2603Support for hatch pattern files with EOL = /r or CR or Carriage Return

Type
Suggestion
Status
Closed
Resolution
Won't implement
Category
QCAD (main)
Severity
Low
Priority
Low
Reported version
n/a
Operating system
All
Reported
2024-09-19 by CVH
Closed
2024-09-19 by andrew

Andrew,

Related topic with example file.

Basically it is that Qt doesn't break the text stream on only /r.

Perhaps there is a way around this reading it byte-wise replacing /r and /r/n by /n

Ifso, I am interested in a code example to custom handle *.pat files ... See: How to ...

Regards,
CVH

Comments (2)

andrew 2024-09-19

Windows uses \r\n

Unices / MacOS use \n

Qt supports both.

As far as I know \r was only used on very old ("classic") MacOS systems up to about 2001. Since neither Qt nor QCAD ever ran on such a system, it's not feasible to support this obsolete file format. File converters are available online and offline.

CVH 2024-09-19

It is not to run on such systems ... It is to read pattern files with that format.
At least the user should be warned that there is something not quite right.

At least I can catch it now and warn about a bad text data format:

    file = new QFile(fileName);
    flags = new QIODevice.OpenMode(QIODevice.ReadOnly);
    if (file.open(flags)) {
        var content = file.readAll();
        var pos1 = content.indexOf("\r");
        var pos2 = content.indexOf("\n");
        if (pos1>0 && pos1+1 !== pos2) { 
            debugger;    // Warn user that EOL = CR
        }
    }
    file.close();