当前位置: 首页>>代码示例>>C++>>正文


C++ Person::color方法代码示例

本文整理汇总了C++中Person::color方法的典型用法代码示例。如果您正苦于以下问题:C++ Person::color方法的具体用法?C++ Person::color怎么用?C++ Person::color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person::color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: manageDiceRoll

void ChatWindow::manageDiceRoll(QString str,QString& messageTitle,QString& message)
{
    updateListAlias();

    QString localPersonIdentifier = m_selectPersonComboBox->itemData(m_selectPersonComboBox->currentIndex(), PlayersList::IdentifierRole).toString();
    Person * localPerson = PlayersList::instance()->getPerson(localPersonIdentifier);
    QColor color;
    if(m_diceParser->parseLine(str))
    {
        m_diceParser->Start();
        if(m_diceParser->getErrorMap().isEmpty())
        {
            messageTitle = tr("You");
            QString value;
            QString cmdLine;
            QString list;
            bool onlyValue = getMessageResult(value, cmdLine,list);
            color = localPerson->color();

            if(!onlyValue)
            {
                QString diceOutput = tr("got <span class=\"dice\">%1</span> at your dice roll [%2 (%3)]", "You got").arg(value).arg(cmdLine).arg(list);
                showMessage(messageTitle, color, diceOutput,NetMsg::DiceMessageAction);
                QString diceOutput2 = tr("got <span class=\"dice\">%1</span> [%2 (%3)]","He got").arg(value).arg(cmdLine).arg(list);
                message = diceOutput2;
            }
            else
            {
                messageTitle="";
                showMessage(messageTitle, color,value,NetMsg::DiceMessageAction);
                message = value;
            }

        }
        else
        {
            QString messageCorps = m_diceParser->humanReadableError();
            messageTitle = tr("Syntax");
            color = Qt::red;
            showMessage(messageTitle, color, messageCorps);
        }
    }
    else
    {
        QString messageCorps = m_diceParser->humanReadableError();
        messageTitle = tr("Syntax");
        color = Qt::red;
        showMessage(messageTitle, color, messageCorps);
    }
}
开发者ID:pit-le-rouge,项目名称:rolisteam,代码行数:50,代码来源:chatwindow.cpp

示例2: data

QVariant PlayersList::data(const QModelIndex &index, int role) const
{
    if (!index.isValid() || index.column() != 0)
            return QVariant();

    Person * person;

    int row = index.row();
    if (row < 0)
        return QVariant();

    quint32 parentRow = (quint32)(index.internalId() & NoParent);
    if (parentRow == NoParent)
    {
        if (row >= m_playersList.size())
            return QVariant();

        Player * player = m_playersList.at(row);
        person = player;

        if (role == Qt::BackgroundRole && player->isGM())
        {
            QPalette pal = qApp->palette();
            return QVariant(pal.color(QPalette::Active,QPalette::Button));
        }
    }
    else
    {
        if (parentRow >= (quint32)m_playersList.size())
            return QVariant();
        Player * player = m_playersList.at(parentRow);

        if (row >= player->getCharactersCount())
            return QVariant();
        person = player->getCharacterByIndex(row);
    }

    switch (role) {
        case Qt::DisplayRole:
        case Qt::EditRole:
            return QVariant(person->name());
        case Qt::DecorationRole:
            return QVariant(person->color());
        case IdentifierRole:
            return QVariant(person->uuid());
    }

    return QVariant();
}
开发者ID:pit-le-rouge,项目名称:rolisteam,代码行数:49,代码来源:playersList.cpp

示例3: emettreTexte

// not (const QString & message), because we change it !
void ChatWindow::emettreTexte(bool hasHtml,QString message)
{
    //NetMsg::ChatMessageAction, NetMsg::DiceMessageAction, NetMsg::EmoteMessageAction
    NetMsg::Action action = NetMsg::DiceMessageAction;

    bool ok=true;
    m_editionZone->clear();


    QString localPersonIdentifier = m_selectPersonComboBox->itemData(m_selectPersonComboBox->currentIndex(), PlayersList::IdentifierRole).toString();
    Person* localPerson = PlayersList::instance()->getPerson(localPersonIdentifier);

    QString tmpmessage=message.simplified();
    QString messageCorps="";
    QString messageTitle="";
    QColor color;

    if(m_operatorMap->contains(tmpmessage.left(1)))
    {
        CHAT_OPERATOR chatOperator = m_operatorMap->value(tmpmessage.left(1));
        tmpmessage=tmpmessage.remove(0,1);
        switch(chatOperator)
        {
        case DICEROLL:
            manageDiceRoll(tmpmessage,messageTitle,message);
            break;
        case SECRET_DICEROLL:
            manageDiceRoll(tmpmessage,messageTitle,message);
            return;
            break;
        case COMMAND:
        {
            int pos = tmpmessage.indexOf(' ');
            QString cmd = tmpmessage.left(pos);
            if(m_keyWordList.contains(cmd))
            {
                tmpmessage=tmpmessage.remove(0,pos);
                message = tmpmessage;
                if (!m_warnedEmoteUnavailable && !m_chat->everyPlayerHasFeature(QString("Emote")))
                {
                    messageTitle = tr("Warning");
                    messageCorps = tr("Some users won't be enable to see your emotes.");
                    color = Qt::red;
                    showMessage(messageTitle, color, messageCorps);
                    m_warnedEmoteUnavailable = true;
                }

                if(NULL!=localPerson)
                {
                    showMessage(localPerson->name(), localPerson->color(), tmpmessage,NetMsg::EmoteMessageAction);
                    action = NetMsg::EmoteMessageAction;
                }
                break;

            }
        }

        }
    }
    else
    {//sending info to others.
        messageTitle = localPerson->name();
		if(!hasHtml)
		{
			message = message.toHtmlEscaped();
		}
		message = message.replace('\n',"<br/>");
        showMessage(messageTitle, localPerson->color(), message);
        action = NetMsg::ChatMessageAction;
    }


    if(!ok)
        return;

    // Emission du message
    NetworkMessageWriter data(NetMsg::ChatCategory, action);
    data.string8(localPersonIdentifier);
    data.string8(m_chat->identifier());
    data.string32(message);
    m_chat->sendThem(data);
}
开发者ID:pit-le-rouge,项目名称:rolisteam,代码行数:83,代码来源:chatwindow.cpp


注:本文中的Person::color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。