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);
                }
            }
Пример #3
0
        void HandleAvatarUpdated(string jid, string hash)
        {
            if (jid == m_Account.Jid.Bare)
            {
                QApplication.Invoke(delegate {
                    QPixmap pixmap = new QPixmap(36, 36);
                    pixmap.Fill(GlobalColor.transparent);

                    QPainter painter = new QPainter(pixmap);
                    Gui.DrawAvatar(painter, m_AvatarLabel.Width(), m_AvatarLabel.Height(), (QPixmap)AvatarManager.GetAvatar(hash));
                    painter.Dispose();

                    m_AvatarLabel.Pixmap = pixmap;
                });
            }
        }