Any PyQt developers here?

Michael Torrie torriem at gmail.com
Sat Oct 29 11:03:28 EDT 2022


On 10/28/22 21:31, DFS wrote:
> I found one person that said they did it but their syntax didn't work. 
> But it doesn't throw an error either.
> 
> model.setData(model.index(tblRow, col), font, Qt.FontRole)

I wouldn't expect that to work but it's understandable why it didn't
throw an error.  setData() is used to edit the contents of the model at
the provided index. Remember a model can store anything. All this does
is replace whatever was at that index with a Font object instance.  I'm
puzzled why you keep trying to mess with the model when it's the view
that does the actual font setting.  Remember that a single model can be
used with more than one view at the same time, each view implementing
its own style. Thus a model has no information like fonts in it, nor
should it, other than perhaps HTML text markup that the view will render.

Did you consult the folk on the PyQt mailing list? Or even the main Qt
lists?  This isn't language-specific stuff you're asking about.


More information about the Python-list mailing list