- painter.drawText(xPosAscii, yPos, QString(ch));
- xPosAscii += charWidth_;
+ size_t pos = (lineIdx * BYTES_PER_LINE + i) * 2;
+ if ((pos >= selectBegin_) && (pos < selectEnd_)) {
+ painter.setBackground(selected);
+ painter.setPen(palette().color(QPalette::HighlightedText));
+ } else {
+ painter.setBackground(regular);
+ painter.setPen(palette().color(QPalette::Text));
+ }
+
+ painter.drawText(x, y, QString(ch));
+ x += charWidth_;