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.