本文整理汇总了C++中UserModel::getChannel方法的典型用法代码示例。如果您正苦于以下问题:C++ UserModel::getChannel方法的具体用法?C++ UserModel::getChannel怎么用?C++ UserModel::getChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::getChannel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateChannel
void UserView::updateChannel(const QModelIndex &idx) {
UserModel *um = static_cast<UserModel *>(model());
if(!idx.isValid())
return;
Channel * c = um->getChannel(idx);
for(int i = 0; idx.child(i, 0).isValid(); ++i) {
updateChannel(idx.child(i,0));
}
if(c && idx.parent().isValid()) {
if(g.s.bFilterActive == false) {
setRowHidden(idx.row(),idx.parent(),false);
} else {
if(ChannelHidden(c)) {
QByteArray ba = c->qsName.toLocal8Bit();
setRowHidden(idx.row(),idx.parent(),true);
} else {
if(g.s.bFilterHidesEmptyChannels && !ChannelHasUsers(c)) {
setRowHidden(idx.row(),idx.parent(),true);
} else {
setRowHidden(idx.row(),idx.parent(),false);
}
}
}
}
}
示例2: mouseReleaseEvent
/**
* This function is used to create custom behaviour when clicking
* on user/channel flags (e.g. showing the comment)
*/
void UserView::mouseReleaseEvent(QMouseEvent *evt) {
QPoint qpos = evt->pos();
QModelIndex idx = indexAt(qpos);
if ((evt->button() == Qt::LeftButton) && idx.isValid()) {
UserModel *um = static_cast<UserModel *>(model());
ClientUser *cu = um->getUser(idx);
Channel * c = um->getChannel(idx);
if ((cu && ! cu->qbaCommentHash.isEmpty()) ||
(! cu && c && ! c->qbaDescHash.isEmpty())) {
QRect r = visualRect(idx);
int offset = 18;
if (cu) {
// Calculate pixel offset of comment flag
if (cu->bLocalIgnore)
offset += 18;
if (cu->bRecording)
offset += 18;
if (cu->bPrioritySpeaker)
offset += 18;
if (cu->bMute)
offset += 18;
if (cu->bSuppress)
offset += 18;
if (cu->bSelfMute)
offset += 18;
if (cu->bLocalMute)
offset += 18;
if (cu->bSelfDeaf)
offset += 18;
if (cu->bDeaf)
offset += 18;
if (! cu->qsFriendName.isEmpty())
offset += 18;
if (cu->iId >= 0)
offset += 18;
}
offset = r.topRight().x() - offset;
if ((qpos.x() >= offset) && (qpos.x() <= (offset+18))) {
QString str = um->data(idx, Qt::ToolTipRole).toString();
if (str.isEmpty()) {
um->bClicked = true;
} else {
QWhatsThis::showText(viewport()->mapToGlobal(r.bottomRight()), str, this);
um->seenComment(idx);
}
return;
}
}
}
QTreeView::mouseReleaseEvent(evt);
}
示例3: nodeActivated
void UserView::nodeActivated(const QModelIndex &idx) {
UserModel *um = static_cast<UserModel *>(model());
ClientUser *p = um->getUser(idx);
if (p) {
g.mw->openTextMessageDialog(p);
return;
}
Channel *c = um->getChannel(idx);
if (c) {
// if a channel is activated join it
g.sh->joinChannel(g.uiSession, c->iId);
}
}
示例4: updateChannel
void UserView::updateChannel(const QModelIndex &idx) {
UserModel *um = static_cast<UserModel *>(model());
if(!idx.isValid())
return;
Channel * c = um->getChannel(idx);
for(int i = 0; idx.child(i, 0).isValid(); ++i) {
updateChannel(idx.child(i,0));
}
if(c && idx.parent().isValid()) {
if(g.s.bFilterActive == false) {
setRowHidden(idx.row(),idx.parent(),false);
} else {
bool isChannelUserIsIn = false;
// Check whether user resides in this channel or a subchannel
if (g.uiSession != 0) {
const ClientUser* user = ClientUser::get(g.uiSession);
if (user != NULL) {
Channel *chan = user->cChannel;
while (chan) {
if (chan == c) {
isChannelUserIsIn = true;
break;
}
chan = chan->cParent;
}
}
}
if(channelFiltered(c) && !isChannelUserIsIn) {
setRowHidden(idx.row(),idx.parent(),true);
} else {
if(g.s.bFilterHidesEmptyChannels && !channelHasUsers(c)) {
setRowHidden(idx.row(),idx.parent(),true);
} else {
setRowHidden(idx.row(),idx.parent(),false);
}
}
}
}
}
示例5: mouseReleaseEvent
/**
* This function is used to create custom behaviour when clicking
* on user/channel flags (e.g. showing the comment)
*/
void UserView::mouseReleaseEvent(QMouseEvent *evt) {
QPoint clickPosition = evt->pos();
QModelIndex idx = indexAt(clickPosition);
if ((evt->button() == Qt::LeftButton) && idx.isValid()) {
UserModel *userModel = qobject_cast<UserModel *>(model());
ClientUser *clientUser = userModel->getUser(idx);
Channel *channel = userModel->getChannel(idx);
int commentFlagPxOffset = -UserDelegate::FLAG_DIMENSION;
bool hasComment = false;
if (clientUser && !clientUser->qbaCommentHash.isEmpty()) {
hasComment = true;
if (clientUser->bLocalIgnore)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bRecording)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bPrioritySpeaker)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bMute)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bSuppress)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bSelfMute)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bLocalMute)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bSelfDeaf)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->bDeaf)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (! clientUser->qsFriendName.isEmpty())
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
if (clientUser->iId >= 0)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
} else if (channel && !channel->qbaDescHash.isEmpty()) {
hasComment = true;
if (channel->bFiltered)
commentFlagPxOffset -= UserDelegate::FLAG_DIMENSION;
}
if (hasComment) {
QRect r = visualRect(idx);
const int commentFlagPxPos = r.topRight().x() + commentFlagPxOffset;
if ((clickPosition.x() >= commentFlagPxPos)
&& (clickPosition.x() <= (commentFlagPxPos + UserDelegate::FLAG_DIMENSION))) {
// Clicked comment icon
QString str = userModel->data(idx, Qt::ToolTipRole).toString();
if (str.isEmpty()) {
userModel->bClicked = true;
} else {
QWhatsThis::showText(viewport()->mapToGlobal(r.bottomRight()), str, this);
userModel->seenComment(idx);
}
return;
}
}
}
QTreeView::mouseReleaseEvent(evt);
}