void TablePile::timerEvent(QTimerEvent *) { QList<CardItem *> oldCards; _m_mutex_pileCards.lock(); m_currentTime++; foreach (CardItem* toRemove, m_visibleCards) { if (m_currentTime - toRemove->m_uiHelper.tablePileClearTimeStamp > S_CLEARANCE_DELAY_BUCKETS) { oldCards.append(toRemove); m_visibleCards.removeOne(toRemove); } else if (m_currentTime > toRemove->m_uiHelper.tablePileClearTimeStamp) toRemove->setEnabled(false); // @todo: this is a dirty trick. Use another property in the future } if (oldCards.empty()) { _m_mutex_pileCards.unlock(); return; } _fadeOutCardsLocked(oldCards); _m_mutex_pileCards.unlock(); adjustCards(); }
void HandArea::addCardItem(Card* card) { CardItem* cardItem=new CardItem(card); cardItem->setParentItem(this); connect(cardItem,SIGNAL(cardSelected(int)),this,SLOT(onCardSelected(int))); connect(cardItem,SIGNAL(cardUnselected(int)),this,SLOT(onCardUnselected(int))); cardItems << cardItem; adjustCards(); }
void Dashboard::setWidth(int width){ if(width == 0){ setMiddleWidth(middle->brush().texture().width()); prepareGeometryChange(); adjustCards(); }else if(width > 500){ qreal left_width = left->boundingRect().width(); qreal right_width = right->boundingRect().width(); qreal button_width = getButtonWidgetWidth(); qreal middle_width = width - left_width - right_width - button_width; setMiddleWidth(middle_width); prepareGeometryChange(); adjustCards(); } }
void TipArea::showStatus(int id) { Player* player=dataInterface->getPlayerList().at(id); QList<BasicStatus*> status=player->getBasicStatus(); Card* card; int i; reset(); msg=""; for(i=0;i<status.size();i++) { card=status[i]->getCard(); CardItem* cardItem=new CardItem(card); cardItem->setParentItem(this); connect(cardItem,SIGNAL(cardSelected(int)),this,SLOT(onCardSelected(int))); connect(cardItem,SIGNAL(cardUnselected(int)),this,SLOT(onCardUnselected(int))); cardItems<< cardItem; } adjustCards(); setVisible(1); update(); }