Re: Multiple setAttribute()
If all of them have the same parent, you can use QObject::findChildren then loop through the list and call setAttribute() on each child.
Re: Multiple setAttribute()
You could consider creating a QProxyStyle subclass and implement polish(QWidget*) such that it applies that attribute to all QLineEdit instances it gets
Cheers,
_
Re: Multiple setAttribute()
Subclass QLineEdit, put a setAttribute() call in the constructor, and use that class instead of QLineEdit when you create your widgets. You can catch line edits created in item views using QItemEditorFactory. If you don't create them with the wrong properties then you don't need to try to retrospectively fix them.
Re: Multiple setAttribute()
I'd go for Kevin's solution. It seems universal. What Chris suggests requires intervention for each and every line edit created and there is no control over those that come from some external code. polish() on the other hand will catch those too.
Re: Multiple setAttribute()
Thank you all for the suggestion, I'll try to go with polish() then.
Re: Multiple setAttribute()
There are some caveats in the QProxyStyle docs if you intend doing something similar for other types of control or are using a non-Qt supplied style.
Re: Multiple setAttribute()
Thanks for the heads-up, I think I'll use only QLineEdit for now...