Qt: Fix tile and sprite views not always displaying at first

This commit is contained in:
Vicki Pfau 2019-02-09 02:09:10 -08:00
parent 0c9802e4da
commit a36315097a
5 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Bugfixes:
- GBA: Reset now reloads multiboot ROMs
- GBA BIOS: Fix multiboot entry point (fixes Magic Floor)
- Switch: Fix final cleanup (fixes mgba.io/i/1283)
- Qt: Fix tile and sprite views not always displaying at first
Misc:
- GBA Savedata: EEPROM performance fixes
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash

View File

@ -46,6 +46,9 @@ ObjView::ObjView(std::shared_ptr<CoreController> controller, QWidget* parent)
m_ui.mode->setFont(font);
connect(m_ui.tiles, &TilePainter::indexPressed, this, &ObjView::translateIndex);
connect(m_ui.tiles, &TilePainter::needsRedraw, this, [this]() {
updateTiles(true);
});
connect(m_ui.objId, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &ObjView::selectObj);
connect(m_ui.magnification, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this]() {
updateTiles(true);

View File

@ -31,6 +31,7 @@ void TilePainter::resizeEvent(QResizeEvent* event) {
if (width() / m_size != m_backing.width() / m_size || m_backing.height() != calculatedHeight) {
m_backing = QPixmap(width(), calculatedHeight);
m_backing.fill(Qt::transparent);
emit needsRedraw();
}
}

View File

@ -26,6 +26,7 @@ public slots:
signals:
void indexPressed(int index);
void needsRedraw();
protected:
void paintEvent(QPaintEvent*) override;

View File

@ -25,6 +25,9 @@ TileView::TileView(std::shared_ptr<CoreController> controller, QWidget* parent)
m_ui.tile->setController(controller);
connect(m_ui.tiles, &TilePainter::indexPressed, m_ui.tile, &AssetTile::selectIndex);
connect(m_ui.tiles, &TilePainter::needsRedraw, this, [this]() {
updateTiles(true);
});
connect(m_ui.paletteId, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &TileView::updatePalette);
switch (m_controller->platform()) {