代码拉取完成,页面将自动刷新
同步操作将从 wufangzhao/startalk_pc_v2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//
// Created by cc on 18-11-12.
//
#include "ChoseMemberWgt.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QListWidgetItem>
#include <QPainter>
#include <QMouseEvent>
#include "../CustomUi/HeadPhotoLab.h"
#include "../UICom/qimage/qimage.h"
#include "../UICom/StyleDefine.h"
#include "../Platform/AppSetting.h"
ChoseItemDelegate::ChoseItemDelegate(QWidget *parent)
: QStyledItemDelegate(parent)
{
}
void ChoseItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyledItemDelegate::paint(painter, option, index);
painter->save();
painter->setRenderHint(QPainter::TextAntialiasing);
QRect rect = option.rect;
QRect btnRect = QRect(rect.right() - 30, rect.y() + 10, 20, 20);
QString closeBtn;
closeBtn = ":/GroupManager/image1/delete_normal.png";
// if ((option.state & QStyle::State_Selected) || (option.state & QStyle::State_MouseOver))
// {
painter->fillRect(option.rect, QTalk::StyleDefine::instance().getGroupManagerNormalColor());
// closeBtn = ":/GroupManager/image1/delete_horver.png";
// }
// else
// {
// painter->fillRect(option.rect, QTalk::StyleDefine::instance().getGroupManagerNormalColor());
// }
painter->drawPixmap(btnRect, QPixmap(closeBtn));
// if(index.column() == ITEM_COLUMN_CONTENT)
{
QString head = index.data(EM_ITEM_DATA_HEAD).toString();
QString text = index.data(EM_ITEM_DATA_NAME).toString();
QPixmap headPix = QTalk::qimage::loadCirclePixmap(head, 11 * QTalk::qimage::dpi());
painter->setRenderHints(QPainter::Antialiasing, true);
painter->setRenderHints(QPainter::SmoothPixmapTransform, true);
painter->drawPixmap(rect.x() + 9, rect.y() + 9, 22, 22, headPix);
QTalk::setPainterFont(painter, AppSetting::instance().getFontLevel());
painter->setPen(QPen(QColor(51,51,51)));
painter->setPen(QTalk::StyleDefine::instance().getGroupManagerNormalFontColor());
painter->drawText(rect.x() + 40, rect.y(), rect.width() - 40, rect.height(), Qt::AlignVCenter, text);
}
painter->restore();
}
QSize ChoseItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
const QSize& size = QStyledItemDelegate::sizeHint(option, index);
return {size.width(), 40};
}
bool ChoseItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
const QModelIndex &index)
{
if(event->type() == QEvent::MouseButtonPress) {
QRect rect = option.rect;
rect = QRect(rect.right() - 30, rect.y() + 10, 20, 20);
auto * e = (QMouseEvent*)event;
if(rect.contains(e->pos()))
{
QString id = index.data(EM_ITEM_DATA_XMPPID).toString();
emit removeItem(id);
}
}
return QStyledItemDelegate::editorEvent(event, model, option, index);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。