Qt: Memory view readability fixes

This commit is contained in:
Jeffrey Pfau 2015-04-30 00:02:37 -07:00
parent c021267ce6
commit 7ac49be6df
2 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ MemoryModel::MemoryModel(QWidget* parent)
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_margins = QMargins(metrics.width("FFFFFF ") + 4, m_cellHeight + 1, metrics.width(" AAAAAAAAAAAAAAAA") + 3, 0); m_margins = QMargins(metrics.width("0FFFFFF0 ") + 4, m_cellHeight + 1, metrics.width(" AAAAAAAAAAAAAAAA") + 3, 0);
connect(verticalScrollBar(), &QSlider::sliderMoved, [this](int position) { connect(verticalScrollBar(), &QSlider::sliderMoved, [this](int position) {
m_top = position; m_top = position;
@ -93,7 +93,7 @@ void MemoryModel::paintEvent(QPaintEvent* event) {
int height = (viewport()->size().height() - m_cellHeight) / m_cellHeight; int height = (viewport()->size().height() - m_cellHeight) / m_cellHeight;
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
int yp = m_cellHeight * y + m_margins.top(); int yp = m_cellHeight * y + m_margins.top();
QString data = QString("%0").arg(y + m_top + m_base / 16, 6, 16, c0).toUpper(); QString data = QString("%0").arg((y + m_top) * 16 + m_base, 8, 16, c0).toUpper();
painter.drawText(QRectF(QPointF(0, yp), QSizeF(m_margins.left(), m_cellHeight)), Qt::AlignHCenter, data); painter.drawText(QRectF(QPointF(0, yp), QSizeF(m_margins.left(), m_cellHeight)), Qt::AlignHCenter, data);
for (int x = 0; x < 16; ++x) { for (int x = 0; x < 16; ++x) {
uint8_t b = m_cpu->memory.load8(m_cpu, (y + m_top) * 16 + x + m_base, nullptr); uint8_t b = m_cpu->memory.load8(m_cpu, (y + m_top) * 16 + x + m_base, nullptr);

View File

@ -42,8 +42,8 @@ void MemoryView::setIndex(int index) {
{ "VRAM", BASE_VRAM, SIZE_VRAM }, { "VRAM", BASE_VRAM, SIZE_VRAM },
{ "OAM", BASE_OAM, SIZE_OAM }, { "OAM", BASE_OAM, SIZE_OAM },
{ "ROM", BASE_CART0, SIZE_CART0 }, { "ROM", BASE_CART0, SIZE_CART0 },
{ "ROM (WS1)", BASE_CART1, SIZE_CART1 }, { "ROM WS1", BASE_CART1, SIZE_CART1 },
{ "ROM (WS2)", BASE_CART2, SIZE_CART2 }, { "ROM WS2", BASE_CART2, SIZE_CART2 },
{ "SRAM", BASE_CART_SRAM, SIZE_CART_SRAM }, { "SRAM", BASE_CART_SRAM, SIZE_CART_SRAM },
}; };
const auto& info = indexInfo[index]; const auto& info = indexInfo[index];