1

Disclaimer: I'm not a Qt programmer, I'm just asking in case someone could solve an issue about DB Browser for SQLite.

So, an EditDialog widget is extending the QDialog class. As described in the issue, in some scenarios this widget is readonly, but it would be great if its text content could still be selectable.

There are two use cases:

  • text selection with the mouse
  • blinking caret, text selection with keyboard Shift + arrows

The current solution fixes only the first case. There is no blinking caret and keyboard selection doesn't work. Could this be improved?

Gras Double
  • 15,901
  • 8
  • 56
  • 54
  • Did you get an opportunity to test the answer I gave? I am a user of sqlitebrower myself, so I would be interested to know if my suggestion was helpful. – ekhumoro Sep 23 '17 at 12:53
  • The developers haven't given news about it yet, but they are aware of this SO post, and the issue is tracked for the next DB4S release. – Gras Double Sep 24 '17 at 02:35
  • I just found this forum thread about this issue: http://www.qtcentre.org/threads/39941-readonly-QTextEdit-with-visible-Cursor. – Gras Double Dec 09 '17 at 20:24

1 Answers1

3

Assuming the textarea is a QTextEdit or QPlainTextEdit, you should be able to fix this by adjusting the text interaction flags. Try something like this:

ui->editorText->setTextInteractionFlags(
    Qt.TextSelectableByMouse | Qt.TextSelectableByKeyboard)
ekhumoro
  • 115,249
  • 20
  • 229
  • 336