|
|
@ -53,11 +53,17 @@ if(LastHoverItem){ |
|
|
|
f.setBold(false); |
|
|
|
f.setBold(false); |
|
|
|
LastHoverItem->setFont(0,f); |
|
|
|
LastHoverItem->setFont(0,f); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(item){ |
|
|
|
if(item){ |
|
|
|
|
|
|
|
if(!db->isParentGroup(item->pGroup,DragItem->pGroup) && DragItem!=item){ |
|
|
|
QFont f=item->font(0); |
|
|
|
QFont f=item->font(0); |
|
|
|
f.setBold(true); |
|
|
|
f.setBold(true); |
|
|
|
item->setFont(0,f); |
|
|
|
item->setFont(0,f); |
|
|
|
LastHoverItem=item;} |
|
|
|
LastHoverItem=item; |
|
|
|
|
|
|
|
event->setAccepted(true);} |
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
event->setAccepted(false); |
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
LastHoverItem=NULL;} |
|
|
|
LastHoverItem=NULL;} |
|
|
|
|
|
|
|
|
|
|
@ -96,22 +102,21 @@ void KeepassGroupView::mouseMoveEvent(QMouseEvent *event){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
if ((event->pos() - DragStartPos).manhattanLength() < QApplication::startDragDistance()) |
|
|
|
if ((event->pos() - DragStartPos).manhattanLength() < QApplication::startDragDistance()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
DragItem=(GroupViewItem*)itemAt(DragStartPos); |
|
|
|
GroupViewItem* item=(GroupViewItem*)itemAt(DragStartPos); |
|
|
|
if(!DragItem)return; |
|
|
|
if(!item)return; |
|
|
|
|
|
|
|
QDrag *drag = new QDrag(this); |
|
|
|
QDrag *drag = new QDrag(this); |
|
|
|
QFontMetrics fontmet(item->font(0)); |
|
|
|
QFontMetrics fontmet(DragItem->font(0)); |
|
|
|
int DragPixmHeight=16; |
|
|
|
int DragPixmHeight=16; |
|
|
|
if(fontmet.height()>16)DragPixmHeight=fontmet.height(); |
|
|
|
if(fontmet.height()>16)DragPixmHeight=fontmet.height(); |
|
|
|
DragPixmap = QPixmap(fontmet.width(item->text(0))+19,DragPixmHeight); |
|
|
|
DragPixmap = QPixmap(fontmet.width(DragItem->text(0))+19,DragPixmHeight); |
|
|
|
DragPixmap.fill(QColor(255,255,255)); |
|
|
|
DragPixmap.fill(QColor(255,255,255)); |
|
|
|
QPainter painter(&DragPixmap); |
|
|
|
QPainter painter(&DragPixmap); |
|
|
|
painter.setPen(QColor(0,0,0)); |
|
|
|
painter.setPen(QColor(0,0,0)); |
|
|
|
painter.setFont(item->font(0)); |
|
|
|
painter.setFont(DragItem->font(0)); |
|
|
|
painter.drawPixmap(0,0,item->icon(0).pixmap()); |
|
|
|
painter.drawPixmap(0,0,DragItem->icon(0).pixmap()); |
|
|
|
painter.drawText(19,DragPixmHeight-fontmet.strikeOutPos(),item->text(0));
|
|
|
|
painter.drawText(19,DragPixmHeight-fontmet.strikeOutPos(),DragItem->text(0));
|
|
|
|
QMimeData *mimeData = new QMimeData; |
|
|
|
QMimeData *mimeData = new QMimeData; |
|
|
|
mimeData->setData("keepass/group",QByteArray((char*)&(item->pGroup),sizeof(void*))); |
|
|
|
mimeData->setData("keepass/group",QByteArray((char*)&(DragItem->pGroup),sizeof(void*))); |
|
|
|
drag->setMimeData(mimeData); |
|
|
|
drag->setMimeData(mimeData); |
|
|
|
drag->setPixmap(DragPixmap); |
|
|
|
drag->setPixmap(DragPixmap); |
|
|
|
drag->start(); |
|
|
|
drag->start(); |
|
|
|