Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text values are truncated to 32767 bytes if edited directly in the table widget #1281

mgrojo opened this issue Dec 30, 2017 · 3 comments


Copy link

@mgrojo mgrojo commented Dec 30, 2017

Details for the issue

Text values are truncated to 32767 bytes if edited directly in the table widget.

Useful extra information

Steps to reproduce:

  1. Import a text file in the dock editor of more that 32767 bytes and click Apply.
  2. Click inside the cell in the table widget. Wait the time to avoid a double click Make a second click to edit the value.
  3. The value already appears truncated and selected. The only way to avoid the truncation once in this phase is to press ESC. Otherwise, the truncated value is updated in the database.

I'm opening this issue because:

  • DB4S is crashing
  • DB4S has a bug
  • DB4S needs a feature
  • DB4S has another problem

I'm using DB4S on:

  • Windows: ( version: ___ )
  • Linux: ( distro: Ubuntu 16.04)
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using DB4S version:

  • 3.10.1
  • 3.10.0
  • 3.9.1
  • Other: _3.10.99 (Dec 28 2017)

I have also:

@mgrojo mgrojo added the bug label Dec 30, 2017
Copy link
Member Author

@mgrojo mgrojo commented Dec 30, 2017

I suppose this is a limit in the Qt widget, but haven't found any reference.

MKleusberg added a commit that referenced this issue Dec 31, 2017
For table cells with text larger than 32768 characters, the data gets
truncated. If the user doesn't notice this somehow and hits the Escape
key the truncated data is written back to the database resulting in a
possible data loss.

This problem is fixed by this commit in two ways:
1) The maximum length of the editor widgets is increased to the maximum
value making this problem much more unlikely.
2) If the user is still hitting this value, i.e. the text is truncated
anyway, the widget is put into read only mode and no data is written
back to the database.

See issue #1281.
Copy link

@MKleusberg MKleusberg commented Dec 31, 2017

Nice catch 👍 That's definitely a problem!

The limit is in the QLineEdit class which is used as an editor inside the table view:

I have just pushed a commit which increases the size limit (unfortunately there doesn't seem to be a way to disable it entirely) and which doesn't allow writing data back into the database if the increased limit is still passed. Does that work for you? 😄

Copy link
Member Author

@mgrojo mgrojo commented Dec 31, 2017

Perfect! This is working for me. I don't think it's an issue not being able to remove the maximum if the truncation problem is avoided. These long texts are better edited in the cell editor. In fact, I discovered this while playing around with SVG files for the XML mode editor. At first I didn't know what I've done to break the images 😄 In this way I also found that the double-click did only transfer the focus to the Text editor, and not to any other selected editor. I've fixed that in the xml branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants