True dotted lines

• Mar 14, 2018 - 15:46
Type
Functional
Severity
S4 - Minor
Status
closed
Regression
No
Workaround
No
Project

As per: https://musescore.org/en/node/269157

The "dotted" lines in Musescore are actually miniature rectangles rather than circular in nature, and it would seem most appropriate to actually use dotted lines rather than rectangles. Posting on the messageboard gave responses akin to saying this is a limitation of Qt drawing elements. By posting on their issue tracker, it has been shown that this indeed is implemented already in Qt. There is a PenCapStyle besides PenStyle

enum PenCapStyle { FlatCap, SquareCap, RoundCap }

If in selecting "Dotted" the PenCapStyle were switched to Qt::RoundCap and then when dashed back to Qt::SquareCap or FlatCap (not sure about that), this should fix the problem and should be easy to implement.

If any active programmers are available, this might be something of interest, and hopefully it gets implemented.

Probably the same with 3.0 & 2.2


Comments

In reply to by [DELETED] 5

Hey lasonic, thanks for trying this. Correct, a unit size radius is desired. Too bad that didn't fix it.

Maybe there's some sort of other parameter regarding the size yet still allowing for an increase of size in a uniform manner for the line width.

Looking into the Qpen class, notice that there is an overloaded constructor (i think you'd call it this) that allows for setting qreal not merely by penstyle but with more parameters, especially of interest is "qreal width"

QPen(const QBrush &brush, qreal width, Qt::PenStyle style = Qt::SolidLine, Qt::PenCapStyle cap = Qt::SquareCap, Qt::PenJoinStyle join = Qt::BevelJoin)

Maybe width=1 would set the rounded form to be of unit-length and have no elliptical property to it? Would you be willing to try setting the width to 1 and see if that does it? Now I'm wishing I had a working Qt environment up and running right now. Thanks, and G'day.
~JG

In reply to by worldwideweary

Reported version 2.1 2.2

I can verify that true circular dots are not standardly available, so far as I've understood the options regarding Qt::PenStyle and Qt::Line, even with the use of Qt::RoundCap. The result is as if a rectangle is formed, with the addition of 'rounded-off' corners, as shown by lasonic's post. Width of 0 is a no-go, as it reduces into a non-scalar 1px size. I was hoping a floating point version of width, something like 0.01 would provide a practically invisible rectangle with the addition of the rounding off, but that didn't seem to work either.

As an aside, though they aren't true circles and don't fulfill the original intention regarding what is found in some sheet music, nevertheless the result is aesthetically pleasing and might be considered worthy of implementation for a line's option. Most of the time the 'dotted' standard seems useless and dash is more appropriate. In a sense it is closer to 'dotting' than the standard 'little' dashes currently found in Musescore.

I would think there has to be a way to get this into real circular form, but it might be some other method besides Pen/Line drawing. Maybe there is some means of custom shapes that can be implemented into painting lines? Anyways, if any information is met with, I will post here.

Reported version 2.2  
Regression No
Workaround No

So... @Jojo-Schmitz is right to point the dashes need to be very short when using a RoundCap, and this would produce round dots.
This means that the "DotLine" implementation is faulty on the Qt side: it only produces dots (square dots, more specifically) when used along FlatCaps.

Musescore uses FlatCaps for dotted barlines, and they properly show square dots. All the rest (text lines, slurs) use SquareCaps, which add "caps" to the dashes. It seems that Qt's "DotLine" calculates the dashes to be equal the line thickness, so it produces perfect squares but only with FlatCaps. Any other cap will ad length to them.

They (Qt) should have implemented this the usual way among graphic design software like Inkscape or Adobe Illustrator. But if they "fix" this now, they will break Musescore's Barlines as well as other projects.

Now they can fix this by adding code to query if the painter's QPen is set to flatCaps or not, and adjust their "DotLine" dash length accordingly.
- If RoundCaps or SquareCaps, then the dashes should be of minimal length (nominally zero).
- if FlatCaps, dashes should be = line thickness.

Will they fix it? Maybe it would be easier to get control in MuseScore. It would be very quick to add a dash/gap scheme that truly does 'dots'.

Here is a screenshot from Illustrator to show how these caps work. First, 3 lines with flat, round and square cap, then their versions with very short dashes.

lines and dashes.jpg

Fix version
3.6.0