Solved QString with consecutive "_" becomes underline ?
-
@koahnig
Hi,
The problem is that I need to use monospace , because I need the characters (digits actually) to appear in the exact space between each digit. When I use other font it will fail to have this feature.
My only problem is that with monospace font, consecutive "/" becomes underline...
Is there maybe another character similar to "" without becoming underline ?Thank you.
Ran -
@ranshalit said in QString with consecutive "_" becomes underline ?:
Is there maybe another character similar
There are many, for example: https://unicode-table.com/en/23BD/ or https://unicode-table.com/en/035F/ depends if your font support them
-
@koahnig said in QString with consecutive "_" becomes underline ?:
That should be a font issue to my understanding. You are actually storing a number of consecutive underlines, but in the font they are too long and they are displayed as one long line. This is what people typically expect.
"Feature, not a bug". See https://en.wikipedia.org/wiki/Underscore. It is meant for underlining for historical reasons and visually separate lines are unexpected. @ranshalit See VRonin's links or find an Open Source monospace font and modify it manually using FontForge (not so difficult in this case, really, if you only shorten the underscore).
-
@Eeli-K said in QString with consecutive "_" becomes underline ?:
@koahnig said in QString with consecutive "_" becomes underline ?:
That should be a font issue to my understanding. You are actually storing a number of consecutive underlines, but in the font they are too long and they are displayed as one long line. This is what people typically expect.
"Feature, not a bug". See https://en.wikipedia.org/wiki/Underscore. It is meant for underlining for historical reasons and visually separate lines are unexpected. @ranshalit See VRonin's links or find an Open Source monospace font and modify it manually using FontForge (not so difficult in this case, really, if you only shorten the underscore).
Yes, of course!
The "too long" is not to interpret as "bug". It was meant for clarity for reader. All those features go back to good DOS and before that. -
@VRonin
Thanks !
That seemed promising , but seems that monospace does not support it :( (it appears but does not behave like monospace ).
The other solution of modifying monospace font seems a bit complex for me now.
Maybe I can add some space between characters in Qlabel ?Thanks,
Ran -
-
@koahnig said in QString with consecutive "_" becomes underline ?:
What are you trying anyhow?
QLabel lbl ("_ _ _ ");
I'm not exactly sure what the original poster is trying to achieve, but another possible character to use is the 'open box' (␣) to indicate a space.
-
@koahnig
yes, that is what I try. -
@mchinand
Thank you., I will try the open box character. I hope it is supported in monospace font. -
@mchinand
the openbox was not supported in font, but I eventually managed to use "_"
with any space as I need as following:
newFont.setStyleHint(QFont::Monospace);
newFont.setLetterSpacing(QFont::AbsoluteSpacing,3);Thanks,
Ran