Logo Search packages:      
Sourcecode: tagua version File versions  Download package

void Board::updateBackground (  )  [private]

this internal function updates the background after the board has been resized

Definition at line 93 of file board.cpp.

References boardRect(), PixmapLoader::getValue(), m_canvas_background, m_square_size, and m_tags_loader.

Referenced by onResize().

                             {
  while(!m_canvas_background->items()->isEmpty())
    delete m_canvas_background->items()->first();

  if(!m_square_size)
    return;

  Loader::PixmapOrMap bg = m_tags_loader.getValue<Loader::PixmapOrMap>("background");
  if(const QPixmap* p = boost::get<QPixmap>(&bg)) {
    KGameCanvasTiledPixmap *t = new KGameCanvasTiledPixmap(*p, boardRect().size(), QPoint(),
                                    true, m_canvas_background);
    t->show();
  }
  else if(const Loader::PixmapMap* p = boost::get<Loader::PixmapMap>(&bg)) {
    for(Loader::PixmapMap::const_iterator it = p->begin(); it != p->end(); ++it) {
      KGameCanvasTiledPixmap *t = new KGameCanvasTiledPixmap(it->second, it->first.size(),
                                      QPoint(), true, m_canvas_background);
      t->moveTo(it->first.topLeft());
      t->show();
    }
  }
  else
    kError() << "Board::updateBackground(): unexpected type in boost::variant!";
}


Generated by  Doxygen 1.6.0   Back to index