04-09-2024, 04:29 PM | #16 | |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Quote:
I have to wrap Preview in another widget and then manually track focus in and focus out of Preview because for some reason it is does not detect it has focus (even if you properly set the FocusProxy) and therefore does not get influenced by BeckyEbook's qss at all. So we would have to manually set the border red at the code level on focusIn and manualy remove the border on focusOut. To make matters worse, Qt only supports a single stylesheet at the application level and will not merge or inherit from multiple qss styles at once. So what I really need to hear is from people who have played around with BeckyEbook's qss focus border on all platforms under both light and dark mode to see if it works (aside from Preview) and to see if this is a real change to keep on 100% of the time. So feedback appreciated on showing focus with a solid red line as the default and only behaviour (ie. that can not be turned off). Last edited by KevinH; 04-09-2024 at 04:31 PM. |
|
04-09-2024, 04:42 PM | #17 |
Grand Sorcerer
Posts: 28,045
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I would definitely want to have a way to turn any such feature off (including with Preview).
I also worry that the widget that Preview would get wrapped in might cause issues with future Qt incarnations. We had a border coded around one of the widgets (which I'm thinking was Code View) that caused all kinds of problems with Windows dark mode until it was finally removed. But as long as there's a functioning "turn off all visible focus decorations" preference checkbox, I'm not opposed. |
Advert | |
|
04-09-2024, 07:22 PM | #18 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Okay, I think I have a way to make it all work.
I have temporarily hard coded it to use an environment variable: QString focus_highlight = Utility::GetEnvironmentVar("SIGIL_HIGHLIGHT_FOCUS_ WIDGET"); export SIGIL_HIGHLIGHT_FOCUS_WIDGET=1 will turn it on in Settings unset SIGIL_HIGHLIGHT_FOCUS_WIDGET will turn it off. Note: these are checked only once at startup. If people like it then we can fart around with the horrible Preferences code and remove the need to use an Environment variable. All just pushed to master now. Last edited by KevinH; 04-09-2024 at 07:49 PM. |
04-09-2024, 09:29 PM | #19 |
null operator (he/him)
Posts: 21,009
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@KevinH - I had an interrupt, and hadn't posted this.
FTR: On Windows 10, BeckyEbook's border tweak doesn't appear in CodeView or Preview windows, in both Dark and Light modes, it appears everywhere else… I think. My "IMO it should be a built-in preference in all Qt apps…" was meant to be read as "In an ideal world it should be a built-in preference in all Qt apps…". So, I suggest - do nothing. FWIW: I don't have a problem with using EnvVars I stumbled into a Windows Ease of Access setting that I didn't know about - Text cursor indicator. It's useful sometimes. It isn't being handled as it should be in Codeview. Because I can see the same behaviour in the calibre editor codeview window, there's no doubt it's a Qt issue. I've attached some relevant screen shots. There's no problem with single line text boxes, but things go awry in multiline text boxes line. The indicators appear, but they're detached from the cursor, I'd rather they didn't appear at all… as is the case in Notepad++. Kevin, Perhaps you could nudge Qt, maybe it's already been reported. I have reasonably convenient way to turn the indicators off/on. BR Last edited by BetterRed; 04-09-2024 at 09:39 PM. |
04-09-2024, 11:23 PM | #20 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
@BetterRed
I just pushed a fix for Preview to show the red outline but it requires a clean new checkout and build of Sigil, setting that environment variable and removing BeckyEbooks code from your qt_styles.qss file. FYI, CodeView has no border to highlight as that caused issues with Dark mode on Windows. Luckily CodeView always shows the current line highlighted when it has focus. So it is easy to see focus. And you control the CodeView highlight colour palette in Sigil Preferences. As for your Windows only Ease of Access issue, I have no idea about it, and as I do not even own a Windows box, I can not recreate it. So I can not create a simple example standalone bug reproducer program required for bug reports. And I have no way to test it. So I won't be the one to file a bug report with Qt. Perhaps you can convince Kovid to. |
Advert | |
|
04-09-2024, 11:34 PM | #21 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
@BetterRed
I googled Qt and "Windows Ease of Access" and they said to double check that the font size set by Windows Ease of Access" exactly matches the font size used in the text editor (ie. CodeView font size that you control in Sigil Preferences). Otherwise the cursor location becomes out of sync in multiple lines situations. There are also ways to set a cursor shape for most Qt apps. Perhaps styling a larger cursor in qss might help. |
04-10-2024, 12:43 AM | #22 | ||
null operator (he/him)
Posts: 21,009
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
I assumed this Text cursor indicator feature was fairly new, it's been in Windows for almost 4 years (earlier in preview releases) - why wasn't I told
Quote:
Quote:
If anyone knows of a qss tweak I can use to 'enhance' the text cursor, maybe they can give me clue - width and color maybe. BR Last edited by BetterRed; 04-10-2024 at 01:12 AM. |
||
04-10-2024, 01:27 PM | #23 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Okay just pushed a fix for adding the red solid focus highlight box to CodeView that depends on a Sigil setting / environment var right now.
Now both CodeView and Prview act like the other focus highlight widgets. |
04-10-2024, 01:53 PM | #24 |
Grand Sorcerer
Posts: 28,045
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'll volunteer to fart around with getting the Preferences code in order (if this is something everyone wants keep).
I'm assuming the default will be off, like the environment variable, correct? |
04-10-2024, 02:02 PM | #25 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Yes please. And yes default off. I have already updated the SettingsStore with the calls to get the current value and update it.
|
04-10-2024, 06:02 PM | #26 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
@BetterRed
I have looked into somehow highlighting the blinking text insertion point (caret) in a cross platform manner. It does not appear doable without just growing the font size. Recent versions of qt can use qss caret-color property to set it to some other color but I can't see a way to change its height or thickness as those are tied to the font being used. A very thin blinking red line can be as hard to see as a very thin blinking black line. It might be possible with setting QStyle controls but I could not find it in the Qt docs. That just leaves system level Accessibility controls. On Windows it is "Ease Of Access" but as you pointed out that is broken. On macOS, you can change cursor size but not caret size as it is tied to the font size. There is a tool on macOS to show a zoomed in hover of the text near the caret but it is awkward to use. So unless there is some qt codebase that draws insertion point caret's someplace, I do not think that is possible. That leaves either zooming the screen (using lower dpi settings on display) or setting a larger font size. So no luck with any of that. Last edited by KevinH; 04-10-2024 at 06:04 PM. |
04-10-2024, 07:34 PM | #27 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Kept looking and there is a setCursorWidth() routine in QPlainTextEdit which is what CodeView is made from.
If we can change both the caret-color and double the width, that should help. I will give that a try tomorrow. |
04-10-2024, 07:47 PM | #28 |
null operator (he/him)
Posts: 21,009
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@KevinH - Thanks for checking all that.
For me at least, an EnvVar for drawing a coloured border around the control that has focus is sufficient. If you make it a Preference setting someone is bound to ask for a shortcut, an on/off toggle in a menu, and a toolbar button As for the Text cursor issues (to me a caret is a ^), I'm happy to leave it be. I don't understand why so many applications respect the Windows text cursor width setting in single line text boxes - where I think it's least needed, but disregard it in multi-line text text boxes - where I think it's most needed. It's not a Qt specific thing. Back when 'expert systems' were the go, I had something that had width and colour settings for its text cursor - would have been on OS/2 or Apple Lisa. BR Last edited by BetterRed; 04-10-2024 at 07:50 PM. |
04-10-2024, 07:59 PM | #29 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
That Focus Highlight setting will only be checked once at startup. So changing it will require you to restart Sigil. I doubt there will be any need for shortcuts! .
It has to be done that way to allow user qt_styles.css to come after it. |
04-11-2024, 10:39 AM | #30 | |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Quote:
So it appears the blinking insertion point is not controllable at all under Qt6 using setCursorWidth no matter what the docs say. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Icon Redesign for future 1.0 Release of Sigil | shorshe | Sigil | 38 | 06-07-2016 12:29 AM |
Kindle Software Preview Release and calibre 'Fetch News' items | tomsem | Devices | 25 | 07-20-2011 09:02 AM |
Will amazon release another cheaper version of DX in the near future | CalvinL | Amazon Kindle | 6 | 07-31-2010 06:01 PM |
Suggestion For Future Release Of Calibre | clambert | Calibre | 5 | 07-10-2010 02:45 PM |
dotReader alpha release next month with future iLiad support possible | Alexander Turcic | News | 7 | 09-28-2006 01:24 PM |