QTable: Option to set auto width in column definition

See original GitHub issue

Is 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:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
beruiccommented, Feb 17, 2022

I vote for re-opening this.

auto-width is already available on the low level components QTh and QTd, and the solution with q-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.

2reactions
pdanpdancommented, Dec 15, 2020

Just add a q-table--col-auto-width class to classes and headerClasses props in the column definition.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found