I have a Qlineedit that I want the user to input hex freely without restriction. I've tried to use setInputMask but you have to know the size before hand in order to set it up. So I was wondering if there is a way to do what I want.

Another thing is after the user inputs hex values, how can I grab them and put them into my char array to do checksum and send it to the serial port?

So basically an example of what I want is this:

char array with 0x01, 0x10, 0x20, 0x00, 0x01, 0x00 in the front, then the user inputs some random hex like 1234 in the Qlineedit. And then when a button is pushed, the hex in the Qlineedit will be added to the char array, and then something will calculate the checksum and add it to the char array also. Then I can also add the end byte at the end of the array. The final char array should have these:
Qt Code:
  1. {0x01, 0x10, 0x20, 0x00, 0x01, 0x00, 0x12, 0x34, 0x78, 0x04}
To copy to clipboard, switch view to plain text mode 
(0x12 and 0x34 from Qlineedit, 0x78 is the checksum and 0x04 is the end byte)

Thank you!