本文整理汇总了C++中IrcUser::prefix方法的典型用法代码示例。如果您正苦于以下问题:C++ IrcUser::prefix方法的具体用法?C++ IrcUser::prefix怎么用?C++ IrcUser::prefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IrcUser
的用法示例。
在下文中一共展示了IrcUser::prefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
/*!
Returns the data for specified \a role referred to by the \a index.
\sa Irc::DataRole, roleNames()
*/
QVariant IrcUserModel::data(const QModelIndex& index, int role) const
{
Q_D(const IrcUserModel);
if (!d->channel || !hasIndex(index.row(), index.column(), index.parent()))
return QVariant();
IrcUser* user = static_cast<IrcUser*>(index.internalPointer());
Q_ASSERT(user);
switch (role) {
case Qt::DisplayRole:
return data(index, d->role);
case Irc::UserRole:
return QVariant::fromValue(user);
case Irc::NameRole:
return user->name();
case Irc::PrefixRole:
return user->prefix().left(1);
case Irc::ModeRole:
return user->mode().left(1);
case Irc::TitleRole:
return user->title();
}
return QVariant();
}
示例2: data
QVariant IrcUserListModel::data( const QModelIndex& index, int role ) const
{
if ( !channel() || !hasIndex( index.row(), index.column(), index.parent() ) )
{
return QVariant();
}
IrcUser* user = static_cast<IrcUser*>( index.internalPointer() );
Q_ASSERT( user );
switch ( role )
{
case Qt::DisplayRole:
return user->name();
case Qt::DecorationRole:
return modeToIcon( user->mode().left( 1 ) );
case Qt::ForegroundRole:
if ( user->isServOp() )
{
if ( user->isAway() )
{
return QColor( "red" );
}
else
{
return QColor( "#9A2A2A" );
}
}
else
{
if ( user->isAway() )
{
return QColor( quazaaSettings.Chat.Colors[IrcColorType::Inactive] );
}
else
{
return QColor( quazaaSettings.Chat.Colors[IrcColorType::Default] );
}
}
case Irc::UserRole:
return QVariant::fromValue( user );
case Irc::NameRole:
return user->name();
case Irc::PrefixRole:
return user->prefix().left( 1 );
case Irc::ModeRole:
return user->mode().left( 1 );
case Irc::TitleRole:
return user->title();
}
return QVariant();
}
示例3: addUser
void IrcChannelPrivate::addUser(const QString& name)
{
Q_Q(IrcChannel);
const QStringList prefixes = q->network()->prefixes();
IrcUser* user = new IrcUser(q);
IrcUserPrivate* priv = IrcUserPrivate::get(user);
priv->channel = q;
priv->setName(userName(name, prefixes));
priv->setPrefix(getPrefix(name, prefixes));
priv->setMode(getMode(q->network(), user->prefix()));
activeUsers.prepend(user);
userList.append(user);
userMap.insert(user->name(), user);
names = userMap.keys();
foreach (IrcUserModel* model, userModels)
IrcUserModelPrivate::get(model)->addUser(user);
}