PDA

View Full Version : QTableView queries



prashant
2nd November 2009, 12:28
I am using a QTableView and QStandardItemModel to display 3 dimensional floating point arrays.
Three things I would want to know:

1. How to disable a cell or make it only readable?
2. Disable column selection when clicking the headerLabel of particular column?
3. There are 3 columns for X,Y & Z values. How to set their width so they can take equal horizontal space of tableView width?

wysota
3rd November 2009, 09:13
1. How to disable a cell
Don't return the Qt::ItemIsEnabled flag for it.

or make it only readable?
Don't return the Qt::ItemIsEditable flag for it.


2. Disable column selection when clicking the headerLabel of particular column?
Probably by reimplementing proper mouse events on QHeaderView.


3. There are 3 columns for X,Y & Z values. How to set their width so they can take equal horizontal space of tableView width?

See QHeaderView::setResizeMode.