[Kde-bindings] [Bug 189041] New: [qyoto] QMouseEvent and Buttons() => exeption

yan mongaulois at gmail.com
Tue Apr 7 15:12:02 UTC 2009


https://bugs.kde.org/show_bug.cgi?id=189041

           Summary: [qyoto] QMouseEvent and Buttons() => exeption
           Product: bindings
           Version: unspecified
          Platform: unspecified
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: general
        AssignedTo: kde-bindings at kde.org
        ReportedBy: mongaulois at gmail.com


Version:            (using KDE 4.2.0)
OS:                Linux

under ubuntu,
when i try use QMouseEvent Buttons function an exeption is generate : cast
invalid to uint..

code :

using System;
using Qyoto;

public class maWidget : QWidget
{
     //position dans le repere widget de click gauche
    QPoint p;
    bool b;


    public maWidget()
        : base(null, (uint)(Qt.WindowType.FramelessWindowHint |
Qt.WindowType.SubWindow))
    {
        b = false;

        Resize(300,300);
        QBitmap mask = new QBitmap(5,5);
        {
            QPainter p = new QPainter(mask);
            p.FillRect(mask.Rect() , Qt.GlobalColor.color0);
            p.SetPen(Qt.GlobalColor.color1);
            for (int i = 0 ; i < mask.Height() ; ++i)
                for(int j = 0 ; j< mask.Width() ; ++j)
                    if( (i%2 ^ j%2) != 0)
                        p.DrawPoint(j,i);
        }

        mask = new QBitmap(mask.Scaled( this.Size ));

        SetMask(mask);

    }

    protected override void MousePressEvent   ( QMouseEvent  mouseEvent )
    {
        if(mouseEvent.Button() == Qt.MouseButton.LeftButton) 
        {
            p = mouseEvent.Pos();
            b = true;
        }

    }
    protected override void MouseReleaseEvent   ( QMouseEvent  mouseEvent )
    {
        if(mouseEvent.Button() == Qt.MouseButton.LeftButton) 
        {
            b = false;
        }

    }
    protected override void MouseMoveEvent  ( QMouseEvent  mouseEvent )
    {

        uint but = mouseEvent.Buttons(); // <= cast exeption

        if(b)    
        {
            QPoint po= mouseEvent.GlobalPos() - p;
            Move(po.X(),po.Y() );
        }
    }
}


public class Test
{

    public static int Main(String[] args)
    {
        QApplication app = new QApplication(args);
        maWidget w = new maWidget();
        w.Show();
        return QApplication.Exec();
    }

}

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kde-bindings mailing list