[Qgis-developer] PyQT: how to set a column of QTableView read-only

Andreas Neumann a.neumann at carto.net
Fri Feb 27 08:05:48 EST 2009


Hi,

I am writing a PyQGIS plugin where I am using an editable QTableView. Some
of the columns should be editable, but some should be read-only (e.g. the
primary key column, or an automatically updated area or length column).

I didn't find a convenient way to set a single column read-only. Googling
for this topic led me to some posts from 2006 suggesting that I should
step through individual cells and set flags.

In Qt3 there was a convenient method
QTableView.setColumnReadOnly(colIndex,True) - but in qt4 this method is
gone ;-(

Any suggestions?

Thanks,
Andreas

-- 
Andreas Neumann
http://www.carto.net/neumann/
http://www.svgopen.org/



More information about the Qgis-developer mailing list