diff --git a/src/lib/GroupView.cpp b/src/lib/GroupView.cpp index 9a6cf94..e022f43 100644 --- a/src/lib/GroupView.cpp +++ b/src/lib/GroupView.cpp @@ -25,6 +25,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "main.h" #include "GroupView.h" @@ -94,10 +100,20 @@ void KeepassGroupView::mouseMoveEvent(QMouseEvent *event){ GroupViewItem* item=(GroupViewItem*)itemAt(DragStartPos); if(!item)return; QDrag *drag = new QDrag(this); + QFontMetrics fontmet(item->font(0)); + int DragPixmHeight=16; + if(fontmet.height()>16)DragPixmHeight=fontmet.height(); + DragPixmap = QPixmap(fontmet.width(item->text(0))+19,DragPixmHeight); + DragPixmap.fill(QColor(255,255,255)); + QPainter painter(&DragPixmap); + painter.setPen(QColor(0,0,0)); + painter.setFont(item->font(0)); + painter.drawPixmap(0,0,item->icon(0).pixmap()); + painter.drawText(19,DragPixmHeight-fontmet.strikeOutPos(),item->text(0)); QMimeData *mimeData = new QMimeData; mimeData->setData("keepass/group",QByteArray((char*)&(item->pGroup),sizeof(void*))); drag->setMimeData(mimeData); - drag->setPixmap(item->icon(0).pixmap()); + drag->setPixmap(DragPixmap); drag->start(); diff --git a/src/lib/GroupView.h b/src/lib/GroupView.h index fa6e989..7b13115 100644 --- a/src/lib/GroupView.h +++ b/src/lib/GroupView.h @@ -42,6 +42,7 @@ protected: private: QPoint DragStartPos; + QPixmap DragPixmap; GroupViewItem* LastHoverItem; GroupViewItem* getLastSameLevelItem(int level); };