|
|
|
|
@ -96,8 +96,14 @@ bool AccountDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, cons
|
|
|
|
|
event->type() != QEvent::MouseButtonDblClick) return false; |
|
|
|
|
auto* mouse = static_cast<QMouseEvent*>(event); |
|
|
|
|
if (mouse->button() != Qt::LeftButton) return false; |
|
|
|
|
if (QRect(option.rect.left()+4, option.rect.center().y()-12, 24,24).contains(mouse->pos())) { |
|
|
|
|
if (event->type()==QEvent::MouseButtonRelease) emit avatarRequested(index); |
|
|
|
|
const bool onAvatar=QRect(option.rect.left()+4,option.rect.center().y()-12,24,24).contains(mouse->pos()); |
|
|
|
|
if (event->type()==QEvent::MouseButtonPress) { |
|
|
|
|
m_avatarPress=onAvatar ? index : QModelIndex(); m_avatarPosition=mouse->pos(); |
|
|
|
|
} |
|
|
|
|
if (onAvatar) { |
|
|
|
|
if (event->type()==QEvent::MouseButtonRelease && m_avatarPress==index && (mouse->pos()-m_avatarPosition).manhattanLength()<5) |
|
|
|
|
emit avatarRequested(index); |
|
|
|
|
if (event->type()==QEvent::MouseButtonRelease) m_avatarPress=QPersistentModelIndex(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
if (index.data(Qt::UserRole + 2).toBool()) return false; |
|
|
|
|
|