From 460e7bdf3f6c1de69f41b02a16deb85522ae3c49 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 13 Oct 2008 21:05:50 +0000 Subject: [FIX] Sprite no longer stores a QImage, but a QByteArray [FIX] Preparing for move to a collaged map instead of a tiled map git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@278 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- sigmodr/TileUI.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sigmodr/TileUI.cpp') diff --git a/sigmodr/TileUI.cpp b/sigmodr/TileUI.cpp index acab991f..f360f438 100644 --- a/sigmodr/TileUI.cpp +++ b/sigmodr/TileUI.cpp @@ -49,16 +49,22 @@ void Sigmodr::TileUI::initGui() void Sigmodr::TileUI::refreshGui() { + int maxHeight = 0; + int maxWidth = 0; const bool blocked = varSprite->blockSignals(true); varSprite->clear(); for (int i = 0; i < sigmod()->spriteCount(); ++i) { const Sigmod::Sprite* sprite = sigmod()->sprite(i); - if (sprite->sprite().size() == QSize(64, 64)) - varSprite->addItem(QPixmap::fromImage(sprite->sprite()), sprite->name(), sprite->id()); + QPixmap icon; + icon.loadFromData(sprite->sprite()); + maxHeight = qMax(maxHeight, icon.height()); + maxWidth = qMax(maxWidth, icon.width()); + varSprite->addItem(icon, sprite->name(), sprite->id()); } varSprite->blockSignals(blocked); - varSprite->setIconSize(QSize(64, 64)); + const QSize maxSize(maxWidth, maxHeight); + varSprite->setIconSize(maxSize); } void Sigmodr::TileUI::setGui() -- cgit