Skip to content

Add a Resize columns to contents action and a row padding setting - #4250

Open
deepsidhu1313 wants to merge 2 commits into
sqlitebrowser:masterfrom
deepsidhu1313:feature/browse-ux
Open

deepsidhu1313 wants to merge 2 commits into
sqlitebrowser:masterfrom
deepsidhu1313:feature/browse-ux

Conversation

@deepsidhu1313

Copy link
Copy Markdown
Contributor

Two independent commits.

  1. "Resize columns to contents" entry in the column header context menu of Browse Data (refs Add ability to "auto-size" columns in Data Browser #2351). The columns are fitted once when a table is opened and a single column can be fitted by double-clicking a header separator, but there was no way to fit all columns again on demand. The resize-and-cap logic (same 300 px cap) moved from TableBrowser::fetchedData into ExtendedTableWidget::fitColumnsToContents(), which the automatic and the manual resize now share. Hidden columns stay hidden. New test-extended-table-widget (the test did not compile before and failed by assertion against a stub).
  2. New setting "Row padding (px)" (databrowser/row_padding, Preferences > Data Browser > Content) for the row height of the data grids (refs Row height option #419). The default stays 10, so row heights do not change by default. While testing it turned out that Qt does not let a header's default section size go below its minimum section size, which depends on the row header's font, so a small padding or a small data font never made rows smaller; the minimum section size is now set to the data font's line height first. Visible difference: rows can now be dragged shorter than before, down to one line of text.

Refs #2351, #419

The columns of the Browse Data tab are sized to their contents once when a
table is opened, and a single column can be resized by double-clicking its
header separator, but there was no way to fit all columns again after the
data or the window had changed. Add a 'Resize columns to contents' entry to
the column header context menu for that.

The resize-and-cap logic that used to live in TableBrowser::fetchedData is
moved to ExtendedTableWidget::fitColumnsToContents, which is shared by the
automatic and the manual resize and is covered by a new offscreen test.
Hidden columns are left alone and the existing 300 pixel cap is kept.

See sqlitebrowser#2351
The height of the rows in the data browser and in the SQL results is the
height of the data browser font plus a hard-coded 10 pixels, so there was no
way to see more rows on the screen except for making the font smaller. Add
a 'Row padding (px)' option to the Data Browser tab of the preferences. Its
default of 10 keeps the current row height.

Qt does not let the default section size of a header become lower than its
minimum section size, which by default depends on the font of the row
header and not on the font of the data. Set the minimum to the height of a
line of text so that low padding values take effect.

See sqlitebrowser#419

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants