mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix cut off tiles and alignment issues in tile viewer
This commit is contained in:
parent
9c5d434d90
commit
111337e3e0
1
CHANGES
1
CHANGES
|
@ -14,6 +14,7 @@ Bugfixes:
|
||||||
- Qt: Fix changing resolution of software renderer
|
- Qt: Fix changing resolution of software renderer
|
||||||
- Qt: Fix setting overrides
|
- Qt: Fix setting overrides
|
||||||
- GBA Cheats: Fix GameShark ROM patches
|
- GBA Cheats: Fix GameShark ROM patches
|
||||||
|
- Qt: Fix cut off tiles and alignment issues in tile viewer
|
||||||
Misc:
|
Misc:
|
||||||
- SDL: Remove scancode key input
|
- SDL: Remove scancode key input
|
||||||
- GBA Video: Clean up unused timers
|
- GBA Video: Clean up unused timers
|
||||||
|
|
|
@ -27,7 +27,9 @@ void TilePainter::paintEvent(QPaintEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilePainter::resizeEvent(QResizeEvent* event) {
|
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) {
|
if (width() / m_size != m_backing.width() / m_size || m_backing.height() != calculatedHeight) {
|
||||||
m_backing = QPixmap(width(), calculatedHeight);
|
m_backing = QPixmap(width(), calculatedHeight);
|
||||||
m_backing.fill(Qt::transparent);
|
m_backing.fill(Qt::transparent);
|
||||||
|
@ -53,7 +55,9 @@ void TilePainter::setTile(int index, const uint16_t* data) {
|
||||||
|
|
||||||
void TilePainter::setTileCount(int tiles) {
|
void TilePainter::setTileCount(int tiles) {
|
||||||
m_tileCount = 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);
|
resizeEvent(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,9 @@
|
||||||
<property name="widgetResizable">
|
<property name="widgetResizable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
|
@ -106,6 +109,12 @@
|
||||||
<height>768</height>
|
<height>768</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
|
Loading…
Reference in New Issue