all repos — mgba @ 111337e3e0907bde2a84bf89b259e05e9224dc96

mGBA Game Boy Advance Emulator

Qt: Fix cut off tiles and alignment issues in tile viewer
Jeffrey Pfau jeffrey@endrift.com
Thu, 20 Oct 2016 22:51:30 -0700
commit

111337e3e0907bde2a84bf89b259e05e9224dc96

parent

9c5d434d9084fcff22c8128fdbe5e3f6281c3784

3 files changed, 16 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -14,6 +14,7 @@ - Windows: Fix Unicode directory handling

- Qt: Fix changing resolution of software renderer - Qt: Fix setting overrides - GBA Cheats: Fix GameShark ROM patches + - Qt: Fix cut off tiles and alignment issues in tile viewer Misc: - SDL: Remove scancode key input - GBA Video: Clean up unused timers
M src/platform/qt/TilePainter.cppsrc/platform/qt/TilePainter.cpp

@@ -27,7 +27,9 @@ painter.drawPixmap(QPoint(), m_backing);

} void TilePainter::resizeEvent(QResizeEvent* event) { - int calculatedHeight = (m_tileCount * m_size) / (width() / m_size) + m_size / 2; + int w = width() / m_size; + int calculatedHeight = (m_tileCount + w - 1) * m_size / w; + calculatedHeight -= calculatedHeight % m_size; if (width() / m_size != m_backing.width() / m_size || m_backing.height() != calculatedHeight) { m_backing = QPixmap(width(), calculatedHeight); m_backing.fill(Qt::transparent);

@@ -53,7 +55,9 @@ }

void TilePainter::setTileCount(int tiles) { m_tileCount = tiles; - setMinimumSize(16, (tiles * m_size) / (width() / m_size)); + int w = width() / m_size; + int h = (tiles + w - 1) * m_size / w; + setMinimumSize(16, h - (h % m_size)); resizeEvent(nullptr); }
M src/platform/qt/TileView.uisrc/platform/qt/TileView.ui

@@ -97,6 +97,9 @@ </property>

<property name="widgetResizable"> <bool>true</bool> </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> <widget class="QWidget" name="scrollAreaWidgetContents"> <property name="geometry"> <rect>

@@ -105,6 +108,12 @@ <y>0</y>

<width>286</width> <height>768</height> </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing">