[snip]

Actually I meant:

    file = QFile(self.filename)
    if file.open(QIODevice::ReadOnly):
        ba = file.readAll() # ba is a QByteArray filled with raw bytes
        hexbytes = []
        for i in range(ba.count()):
            if QChar(" ") < QChar(ba[i]) < QChar(128):
                hexbytes.append(ba[i].toAscii())
            else:
                hexbytes.append(ba[i].toHex()) 
                # the above might need to be:
                # hexbytes.append(QByteArray(ba[i]).toHex())
                # or even:
                # hexbytes.append(str(QByteArray(ba[i]).toHex()))
        self.ui.textEditAscii1.setPlainText("".join(hexbytes))


Still untested though!

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Rapid GUI Programming with Python and Qt" - ISBN 0132354187
            http://www.qtrac.eu/pyqtbook.html
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to