I would like to use a QLineEdit control to edit or decimal (0..255) or hexadecimal (0x00 .. 0xFF) numbers. The user should be able to enter the number in one or the other format, and the decimal number has to be limited to 255.

Can this all be done by using only a QRegExp for the validator ?
Does anyone has an idea how the validator would then look like ?