void AnimationFrame::setSprite(const SpritePtr &spr) { int width = (spr->isNull())? 0 : spr->mSubimg.first().img.width(); int height = (spr->isNull())? 0 : spr->mSubimg.first().img.height(); mWidth->setText("Width: " + QString::number(width) + "px"); mHeight->setText("Height: " + QString::number(height) + "px"); mFrames->setText("Frames: " + QString::number(spr->count())); mModel->setSprite(new Sprite(*spr)); mToolBar->frame->setMaximum(std::max(0, static_cast<int>(mModel->getSprite()->count()))); }
void SpriteModel::setSprite(const SpritePtr &spr) { beginResetModel(); if (!spr->isNull()) { QImage img = spr->mSubimg[0].img; img.fill(Qt::gray); mDefault = SubImage(img); } mSpr = spr; endResetModel(); }