[Qt-interest] Access QItemDelegate editor

Bachrach, Robert L rob.bachrach at tycoelectronics.com
Mon Mar 30 13:21:04 CEST 2009


Israel Brewster wrote: 
> I have a custom QItemDelegate which creates a QLineEdit. I 
> need to, at some point after editing has begun, 
> programatically change the contents. For that, obviously, I 
> need to obtain a pointer to the editor. How can I do this? I 
> tried simply saving the pointer as a member of the delegate 
> when I create the editor, but that gives me a compile error 
> "assignment of data member in read-only structure".

You can try declaring your member variable as "mutable".  This should allow you to changed its value in a const function.



More information about the Qt-interest-old mailing list