protected override void MouseMoveEvent(Qyoto.QGraphicsSceneMouseEvent evnt)
            {
                if (m_LeftButtonDown)
                {
                    if (evnt.Pos().Y() > m_Grid.HeaderHeight)
                    {
                        return;
                    }

                    var app = ((QApplication)QApplication.Instance());
                    if (new QLineF(evnt.ScreenPos(), evnt.ButtonDownScreenPos(Qt.MouseButton.LeftButton))
                        .Length() < app.StartDragDistance)
                    {
                        return;
                    }

                    if (m_Grid.Model is IAvatarGridEditableModel <T> )
                    {
                        QDrag drag = new QDrag(evnt.Widget());
                        drag.SetHotSpot(evnt.Pos().ToPoint());

                        var mime = new RosterItemGroupMimeData(this, m_Grid);
                        drag.SetMimeData(mime);

                        var pixmap = new QPixmap((int)BoundingRect().Width(), m_Grid.HeaderHeight);
                        pixmap.Fill(m_Grid.Palette.Color(QPalette.ColorRole.Base));
                        var painter = new QPainter(pixmap);
                        Paint(painter, null, null);
                        painter.End();
                        drag.SetPixmap(pixmap);

                        drag.Exec();
                    }
                }
            }
Пример #2
0
            protected override void MouseMoveEvent(Qyoto.QGraphicsSceneMouseEvent evnt)
            {
                var app = ((QApplication)QApplication.Instance());

                if (new QLineF(evnt.ScreenPos(), evnt.ButtonDownScreenPos(Qt.MouseButton.LeftButton))
                    .Length() < app.StartDragDistance)
                {
                    return;
                }

                if (m_Grid.Model is IAvatarGridEditableModel <T> )
                {
                    QDrag     drag = new QDrag(evnt.Widget());
                    QMimeData mime = new RosterItemMimeData <T>(this, m_Grid);
                    drag.SetMimeData(mime);

                    QPixmap pixmap = new QPixmap(m_Grid.IconSize, m_Grid.IconSize);
                    pixmap.Fill(m_Grid.Palette.Color(QPalette.ColorRole.Base));
                    var painter = new QPainter(pixmap);
                    Paint(painter, null, null);
                    painter.End();
                    drag.SetPixmap(pixmap);


                    drag.Exec((uint)Qt.DropAction.MoveAction | (uint)Qt.DropAction.CopyAction | (uint)Qt.DropAction.IgnoreAction);
                }
            }