示例#1
0
文件: menu.cpp 项目: ideallx/Hexagon
void GameMenu::updateCardsArea(QList<HandCard*> cards) {
    cs->setSceneRect(0, 0, ui->items->width(), ui->items->height());
    QList<QGraphicsItem*> ims = cs->items();
    for (int i = 0; i < ims.size(); i++) {
        cs->removeItem(ims[i]);
    }

    if (cards.size() == 0)
        return;

    for (int i = 0; i < cards.size(); i++) {
        cs->addItem(cards[i]);
    }

    resizeItems();
}
示例#2
0
/*!
 * This function sets the icon size we should use to draw the items in our
 * list.
 *
 * \param s Our new icon size.
 */
void CSIconListWidget::setIconSize(const QSize &s)
{
	icons = s;
	QListView::setIconSize(s);
	resizeItems();
}
示例#3
0
/*!
 * This function sets the amount of spacing we should have between items in the
 * list.
 *
 * \param s Our new spacing.
 */
void CSIconListWidget::setSpacing(int s)
{
	spc = s;
	QListView::setSpacing(s);
	resizeItems();
}
示例#4
0
/*!
 * We override our superclass's resize event, so we can make sure the items in
 * our list are all going to be sized correctly.
 *
 * \param e The event we are handling.
 */
void CSIconListWidget::resizeEvent(QResizeEvent *e)
{
	resizeItems();
	e->accept();
}