You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Text should be also selectable in "read only" mode #1123
I open a database in "read only" mode, then I select a cell. Its content is displayed in the "edit database cell" top right pane. The widget is read only (grayed out), but the text is not selectable, it would be convenient if it were :)
No, the text area shouldn't be greyed out anymore in the new version 😄 You won't be able to edit the contents but you should be able to select and copy it.
The change is indeed a bit tricky but not that complicated. If you're interested I can explain a little 😉 The Edit Database Cell dock can be put into three different states: completely disabled, read only mode, and fully enabled. So all I had to do is make sure that it's put into read only mode if the database is opened in read only mode. However, there are tons of different scenarios where we're changing the state of the dialog. It depends on whether a database is opened or not, the active tab, whether you're browsing a table or a view, ... Because of this we not only have to make sure that the dialog is put into read only mode but also that in stays in read only mode. But all that should be done in the next nightly 😄
I have tried it, at first glance it seems to work, I can select text using the mouse.
(fwiw, the pane looks like the "non read-only mode": on first draw the pane has a white background and the text has a grey background, which disappears after I click in the pane)
One caveat though: there is no blinking caret, so notably I can't select text using keyboard Shift + arrows.
I think we can leave it open and see if we can do something about it. It looks like this is more a Qt issue than a DB4S one but maybe we can work around it somehow. But I haven't tried yet to be honest 😄
@mgrojo Good stuff. @vlakoff If you have a chance to, would you be ok to test this and confirm if it does/doesn't work well for you now?
@vlakoff As a thought, maybe also let ekhumoro on Stack Overflow know too, as they mention they use DB4S as well and were interested in knowing if it worked. 😄
@vlakoff I made a change for setting the same palette as the disabled state. It seems to affect only the selection and not the background, but that could be only in my environment. If you'd like to test it, it will be available in the next nightly build.
I don't think that the non-bllinking caret is an issue. That would make me think that I can write, and that wouldn't be true.
I have just tested it, and it seems to work as expected on Windows 7: the whole pane background is grey.
As a reminder, previously I was seeing it as so:
(fwiw, the pane looks like the "non read-only mode": on first draw the pane has a white background and the text has a grey background, which disappears after I click in the pane)
I think it should be good enough. Text is now selectable, and background is grey, as previously. A handful of code has already been added to achieve this. Going further would be what I call "excess of quality".
Activity
justinclift commentedon Sep 9, 2017
Ohhh yeah. That definitely makes sense.
Thanks for reporting it @vlakoff, that should be pretty easy to fix. 😄
Make text selectable in Edit dock even if db is opened as read only
MKleusberg commentedon Sep 10, 2017
This should work in tomorrow's nightly build. Are you ok to download that and test if it's working as expected, @vlakoff? 😄
vlakoff commentedon Sep 10, 2017
Sure thing. Apparently it wasn't as trivial to fix as I was hoping.
Will the textarea still be grayed out?
MKleusberg commentedon Sep 10, 2017
No, the text area shouldn't be greyed out anymore in the new version 😄 You won't be able to edit the contents but you should be able to select and copy it.
The change is indeed a bit tricky but not that complicated. If you're interested I can explain a little 😉 The Edit Database Cell dock can be put into three different states: completely disabled, read only mode, and fully enabled. So all I had to do is make sure that it's put into read only mode if the database is opened in read only mode. However, there are tons of different scenarios where we're changing the state of the dialog. It depends on whether a database is opened or not, the active tab, whether you're browsing a table or a view, ... Because of this we not only have to make sure that the dialog is put into read only mode but also that in stays in read only mode. But all that should be done in the next nightly 😄
vlakoff commentedon Sep 11, 2017
I have tried it, at first glance it seems to work, I can select text using the mouse.
(fwiw, the pane looks like the "non read-only mode": on first draw the pane has a white background and the text has a grey background, which disappears after I click in the pane)
One caveat though: there is no blinking caret, so notably I can't select text using keyboard Shift + arrows.
Make text selectable in Edit dock even if db is opened as read only
justinclift commentedon Sep 18, 2017
@MKleusberg Should we leave this open and look into the blinking caret thing, or close this?
MKleusberg commentedon Sep 18, 2017
I think we can leave it open and see if we can do something about it. It looks like this is more a Qt issue than a DB4S one but maybe we can work around it somehow. But I haven't tried yet to be honest 😄
vlakoff commentedon Sep 19, 2017
Just in case, I asked about it on Stack Overflow.
justinclift commentedon Sep 19, 2017
@vlakoff Good thinking. 😄
If you're into IRC, asking on the Qt IRC channel is likely to get helpful info too.
Cell editor fixes and improvements
mgrojo commentedon Dec 5, 2017
@vlakoff I've just applied the answer from Stack Overflow and it works as expected. If you want to take a look at the next nightly build: https://nightlies.sqlitebrowser.org/latest
justinclift commentedon Dec 6, 2017
@mgrojo Good stuff. @vlakoff If you have a chance to, would you be ok to test this and confirm if it does/doesn't work well for you now?
@vlakoff As a thought, maybe also let ekhumoro on Stack Overflow know too, as they mention they use DB4S as well and were interested in knowing if it worked. 😄
vlakoff commentedon Dec 6, 2017
It seems to work. Just a minor caveat: the caret doesn't blink 😄
Also, as discussed earlier, any chance the textarea background could be made grey again?
vlakoff commentedon Dec 9, 2017
I just found this forum thread: http://www.qtcentre.org/threads/39941-readonly-QTextEdit-with-visible-Cursor.
So, I guess the current solution is the best we can achieve, isn't it?
Set disabled palette for the cell text editor when read-only
mgrojo commentedon Feb 3, 2018
@vlakoff I made a change for setting the same palette as the disabled state. It seems to affect only the selection and not the background, but that could be only in my environment. If you'd like to test it, it will be available in the next nightly build.
I don't think that the non-bllinking caret is an issue. That would make me think that I can write, and that wouldn't be true.
vlakoff commentedon Feb 4, 2018
I have just tested it, and it seems to work as expected on Windows 7: the whole pane background is grey.
As a reminder, previously I was seeing it as so:
mgrojo commentedon Feb 5, 2018
Great to know. Then, can we close this issue? Or does anybody still think that the caret should blink?
vlakoff commentedon Feb 6, 2018
I think it should be good enough. Text is now selectable, and background is grey, as previously. A handful of code has already been added to achieve this. Going further would be what I call "excess of quality".
mgrojo commentedon Feb 6, 2018
Ok, @vlakoff Thanks for your feedback.
Removed code for changing the default Qt behaviour for read-only+sele…