QTable: Option to set auto width in column definition
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently you need to override the body cell to set auto-width
, which is cumbersome if you’re working with dynamically created columns.
Describe the solution you’d like
Like you can set so many other properties for a column, it would be nice if you can set auto-width
as well.
Describe alternatives you’ve considered Adding a general slot override for specific columns, having to add content manually as well.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
PySide - PyQt : How to make set QTableWidget column width ...
The way I do it is setting the "general" resize-mode to "ResizeToContent" and than for one (or more) columns to "Stretch"! Here is...
Read more >How to set the QTableWidget's columns width to fit the widget
I'm using a QTableWidget, but I'm looking for a way to dynamically resize the columns to fit the widget base width.
Read more >How to set fixed column widths in Q-Table - Quasar forum
I'm trying to set fixed column widths in the column definition for a Q-Table. For example: 1st column = 20px 2nd column =...
Read more >Setting permanent minimum height and width of all cells in ...
QtWidgets import QApplication, QTableView def autosize_all_columns_widths(layer_name: str) -> None: """ Autosizes widths of all columns in ...
Read more >Constructing a Table — Astropy v5.2
In this case the column names are not defined by the input data, so they must either be set using the names keyword...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I vote for re-opening this.
auto-width
is already available on the low level componentsQTh
andQTd
, and the solution withq-table--col-auto-width
is both inelegant and (most importantly) undocumented.Adding
auto-width
to the column definition object solves both, and thus provides an elegant documented solution to a common problem.Just add a
q-table--col-auto-width
class toclasses
andheaderClasses
props in the column definition.