本文整理汇总了C++中UserModel::seenComment方法的典型用法代码示例。如果您正苦于以下问题:C++ UserModel::seenComment方法的具体用法?C++ UserModel::seenComment怎么用?C++ UserModel::seenComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::seenComment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例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 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);
}