Exemplo n.º 1
0
void PlayerListWidget::selectionChangedSlot()
{
    const QModelIndexList& selection = ui->tagList->selectionModel()->selectedIndexes();
    if (selection.count())
    {
        QString ts = selection[0].data().toString();
        playerSelected(ts);
    }
    else
    {
        playerSelected(QString());
    }
}
Exemplo n.º 2
0
KHLogin::KHLogin(QWidget *parent ) : KDialogBase(parent, "KHLogin", true, i18n("Log in"), User1 |KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, true)
{
    QVBox *page = makeVBoxMainWidget();
    page->setMargin(5);
    page->setLineWidth(4);
    page->setMidLineWidth(4);
    page->setFrameStyle (QFrame::Box | QFrame::Raised );

    QVGroupBox *m_container = new QVGroupBox(i18n("Select your player"),page);

    m_selector = new KHSelectUser(m_container);
    m_selector->readPlayers(true);
    connect(m_selector, SIGNAL(playerSelected()), this, SLOT(setPlayerInformation()));

    QVBox *m_infoBox = new QVBox(m_container);

    m_labelName = new QLabel(i18n("Name: "), m_container);
    m_labelElo = new QLabel(i18n("Elo: "), m_container);
    m_labelType = new QLabel(i18n("Type: "), m_container);

    new KSeparator(m_container);

    new QLabel(i18n("Login"), m_container);
    m_login = new KLineEdit(m_container);
    new QLabel(i18n("Password"), m_container);
    m_password = new KLineEdit(m_container);

    setModal(true);

    setButtonGuiItem (KDialogBase::User1, KGuiItem( i18n("Create a new user"), SmallIcon("penguin"), i18n("Click to create new user"), i18n("Clicking this button you can create a new user") ));

    hide();
}
Exemplo n.º 3
0
void PlayerItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    if(!this->selected)
    {
        selected=1;
        update();
        emit playerSelected(player->getID());
    }
    else
    {
        selected=0;
        update();
        emit playerUnselected(player->getID());
    }
}
Exemplo n.º 4
0
void PlayerListWidget::selectPlayer(const QString& player)
{
    playerSelected(player);
    if (!player.isEmpty())
    {
        const QStringList& list = m_filterModel->stringList();
        int row = list.indexOf(player);
        if (row>=0)
        {
            QModelIndex index = m_filterModel->index( row, 0 );
            if ( index.isValid() )
            {
                ui->tagList->selectionModel()->select( index, QItemSelectionModel::ClearAndSelect );
                ui->tagList->scrollTo(index);
            }
        }
    }
}