Example #1
0
Dashboard::Dashboard()
    :Pixmap(":/dashboard.png"),  selected(NULL), player(NULL), avatar(NULL),
    weapon(NULL), armor(NULL), defensive_horse(NULL), offensive_horse(NULL), view_as_skill(NULL)
{
    int i;
    for(i=0; i<5; i++){
        magatamas[i].load(QString(":/magatamas/%1.png").arg(i+1));
    }
    magatamas[5] = magatamas[4];

    sort_combobox = new QComboBox;
    sort_combobox->addItem(tr("No sort"));
    sort_combobox->addItem(tr("Sort by suit"));
    sort_combobox->addItem(tr("Sort by type"));
    sort_combobox->addItem(tr("Sort by availability"));
    QGraphicsProxyWidget *sort_widget = new QGraphicsProxyWidget;
    sort_widget->setWidget(sort_combobox);
    connect(sort_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortCards()));

    sort_widget->setParentItem(this);
    sort_widget->setPos(0, 28);

    button_layout  = new QGraphicsLinearLayout(Qt::Horizontal);

    QGraphicsWidget *form = new QGraphicsWidget(this);
    form->setLayout(button_layout);
    form->setPos(sort_widget->pos());
    form->moveBy(sort_widget->boundingRect().width(), -10);

    avatar = new Pixmap;
    avatar->setPos(837, 35);    
    avatar->setParentItem(this);

    kingdom = new QGraphicsPixmapItem(this);
    kingdom->setPos(avatar->pos());

    chain_icon = new Pixmap(":/chain.png");
    chain_icon->setParentItem(this);
    chain_icon->setPos(avatar->pos());
    chain_icon->hide();
    chain_icon->setZValue(1.0);

    back_icon = new Pixmap(":/big-back.png");
    back_icon->setParentItem(this);
    back_icon->setPos(922, 104);
    back_icon->hide();
    back_icon->setZValue(1.0);

    equips << &weapon << &armor << &defensive_horse << &offensive_horse;

    QGraphicsPixmapItem *handcard_pixmap = new QGraphicsPixmapItem(this);
    handcard_pixmap->setPixmap(QPixmap(":/handcard.png"));
    handcard_pixmap->setPos(841, 146);

    handcard_num = new QGraphicsSimpleTextItem(handcard_pixmap);
    handcard_num->setFont(Config.TinyFont);
    handcard_num->setBrush(Qt::white);

    handcard_pixmap->hide();
}