View Issue Details

IDProjectCategoryView StatusLast Update
0017136ScribusInternalpublic2024-02-12 21:10
Reporterale Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
Product Version1.7.0.svn 
Fixed in Version1.7.0.svn 
Summary0017136: multiLine should start with a capital M and probably does not need the operator !=
Descriptionhttps://gitlab.com/scribus/scribus/-/blob/master/scribus/scribusstructs.h?ref_type=heads#L179

class multiLine : public QList<SingleLine> {
public:
    QString shortcut;
    bool operator!=(const multiLine& other) const
    {
        return !(this->operator ==(other));
    }
};

should probably simply be:

struct MultiLine : public QList<SingleLine> {
    QString shortcut;
};

since QList already has != (https://doc.qt.io/qt-6/qlist.html#operator-not-eq) and there is no specific logic implemented.
TagsNo tags attached.
PatchNo

Activities

jghali

2024-01-20 23:25

administrator   ~0050921

Given the only difference between a class and a struct is the default accessibility, there is no advantage in changing multiLine to a struct. However I agree that the renaming to MultiLine is long overdue, so I did it in r26001 (1.6.x) and r26002 (trunk).

ale

2024-01-21 08:02

manager   ~0050922

well, i would not have reported any of the three issues alone... but seeing the three together, made me report all of them.

and the lowercase m was indeed the most disturbing to me.
thanks for fixing that.

later, i thought that since it extends a QList, it's also ok if it's a class...
i guess that the real fix here would be to make it a struct (with no inheritance) that has a QList field.
i'm not that sure that Qt recommends the extensions of its data structures to add a "shortcut" field...
but it's probably too late to do that.

remains the operator !=.
i just did a short test (with a std::vector...) and it seems to be just as useless as it looks.
i would be glad, if it could be removed or a comment added with the reasons why it's being kept.

jghali

2024-01-22 22:20

administrator   ~0050930

The operator != was added (by me) in commit r9403 which had following message: "fix 0005654 : copy of a frame with line style trigger crash". Honestly I don't remember why it was added. Maybe a build issue at that time...

jghali

2024-01-23 19:21

administrator   ~0050931

I removed that operator!= from MultiLine, but only in trunk, and left a comment.

ale

2024-01-24 12:41

manager   ~0050932

ok, thanks

Issue History

Date Modified Username Field Change
2024-01-20 20:21 ale New Issue
2024-01-20 20:28 jghali Category General => Internal
2024-01-20 23:21 jghali Summary multiLine: should be a struct, start with a capital M and probably does not need the operator != => multiLine should start with a capital M and probably does not need the operator !=
2024-01-20 23:25 jghali Note Added: 0050921
2024-01-21 08:02 ale Note Added: 0050922
2024-01-22 22:20 jghali Note Added: 0050930
2024-01-23 19:21 jghali Note Added: 0050931
2024-01-23 19:21 jghali Assigned To => jghali
2024-01-23 19:21 jghali Status new => resolved
2024-01-23 19:21 jghali Resolution open => fixed
2024-01-23 19:21 jghali Fixed in Version => 1.7.0.svn
2024-01-24 12:41 ale Note Added: 0050932
2024-02-12 21:10 cbradney Status resolved => closed