data_ = data;
cursorPos_ = 0;
resetSelection(0);
+
+ viewport()->update();
}
void QHexView::showFromOffset(size_t offset)
int cursorY = cursorPos_ / (2 * BYTES_PER_LINE);
verticalScrollBar() -> setValue(cursorY);
}
+
+ viewport()->update();
}
void QHexView::clear()
{
verticalScrollBar()->setValue(0);
data_ = nullptr;
+
+ viewport()->update();
}
QSize QHexView::getFullSize() const
// Fill widget background
painter.fillRect(event->rect(), palette().color(QPalette::Base));
- if (!data_) {
+ if (!data_ || (data_->size() == 0)) {
painter.setPen(palette().color(QPalette::Text));
QString s = tr("No data available");
int x = (areaSize.width() - fontMetrics().boundingRect(s).width()) / 2;
position = 0;
int maxPos = 0;
- if (data_) {
+ if (data_)
maxPos = data_->count() * 2;
- if (data_->count() % BYTES_PER_LINE)
- maxPos++;
- }
if (position > maxPos)
position = maxPos;