[Interest] QLineEdit upper case

Bo Thorsen bo at vikingsoft.eu
Fri Aug 8 15:48:01 CEST 2014

Den 08-08-2014 15:41, pmqt71 skrev:
> Hi,
> I need a QLineEdit control that forces user input in uppercase while
> editing, not after loosing the focus.
> I'm trying different ways but each has side effects:
> - using the textEdited signal to make the text upper : bad behaviour if
> editing in the middle;
> - using a validator : dislike this solution because some QLineEdit have
> their validator.
> Is there a simple way?

The validator is the simple way.

For completeness, you could also do a subclass or event filter that 
filters out all keyboard events with lower case letters.

But I would go with the validator.


Viking Software
Qt and C++ developers for hire

More information about the Interest mailing list