本文整理汇总了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);
}
}
示例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();
}
示例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);
}