[PyKDE] Making a column read-only in QTableWidget

Chris Dunscombe cdunscombe at yahoo.com
Fri Sep 8 15:53:36 BST 2006



--- Andreas Pakulat <apaku at gmx.de> wrote:

> On 08.09.06 04:29:21, Chris Dunscombe wrote:
> > I'm porting an app from PyQt3 to PyQt4 but can't find any obvious replacement for
> > QTable.setColumnReadonly() in QTableWidget.
> 
> Use QTableWidgetItem::setFlags and don't include the Qt.IsEditable flag.
> 

Thanks for that, maybe I'm being thick but does this mean I need to make each cell a
QTableWidgetItem? If possible could you provide a simple short example to complete the following:

myTable = QTableWidget(self)
myTable.setColumnCount(2)
# Code to make all of column 0 read only
.......



Thanks

> > Any ideas? (BTW I can't use the SQL module for licensing reasons)
> 
> Why's that? I might be wrong, but afaik the SQL Module from Qt and PyQt
> are under the same license as the rest of it. The headers in the sql
> module say so too (i.e. GPL). Or is this different on windows?
> 

No difference on Windows but I'm using the commercial version which under Qt has a number of
different Editions each with different modules.

> And anyways: What does the sql module have to do with a table widget?
> 
The SQL module does have a "table view" which might be useful in this case.

Thanks very much,

Chris

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the PyQt mailing list