iPenguin / CrochetCharts

Graphics design software for Crochet pattern designers
http://StitchworksSoftware.com
GNU General Public License v3.0
57 stars 15 forks source link

new icons displaying very small #3

Open Neon22 opened 4 years ago

Neon22 commented 4 years ago

new stitches created in (say) Inkscape 0.92.4 show very small icons when loaded.

Problem is traced to code in stitchset.cpp function StitchSet::data

    if(role == Qt::DisplayRole || role == Qt::EditRole) {
        switch(index.column()) {
            case Stitch::Name:
                return QVariant(s->name());
            case Stitch::Icon: {
                if(role == Qt::DisplayRole) {
                    return QVariant(QSize(s->width(), s->height()));
                } else {
                    return QVariant(s->file());
                }
            }

in originally authored (inkscape 0.48) files the width and height were plain integers (pixels was assumed) and a viewbox was not used. E.g. in sts63.svg

width="38" height="96"

in Inkscape 0.92 etc a viewbox is used and width and height are in units. E.g.

viewBox="0 0 9 10" height="10mm" width="9mm"

So the display needs to use a different size metric so the icons can be seen larger. Perhaps:

Neon22 commented 4 years ago

Was hoping to find a workaround by changing the units saved in the inkscape file to one with larger numbers.

In fact found that icons changed size when using different units but no useful size found. Assuming problem is units are fixed somewhere - probably at 90dpi - and all numbers are assumed to be in those units. Not sure though. Something else might be happening.

Neon22 commented 4 years ago

Only workaround is to:

Note:

Until the code can deal with viewboxes and units in the width and height fields correctly.