[Interest] How to make a column of a QTableView read-only?

Sean Harmer sh at theharmers.co.uk
Sun Jul 1 21:11:53 CEST 2012


Hi K. Frank,

On 01/07/2012 19:50, K. Frank wrote:
> Hello List!
>
> I have a QTableView (backed by a QSqlTableModel) and am looking
> for a simple way to make a column read-only.  Poking around in the
> documentation, I don't see anything obviously simple.

Take a look at the function QAbstractItemModel::flags(). You can 
override this in your model such that flags it returns do not include 
Qt::ItemIsEditable for the column you wish to be read-only.

Sean


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Interest mailing list