Hello !

You may want to have a look at our code for drag and drop, it's working well:

http://bitbucket.org/gregschlom/qml-drag-drop

(and more specifically
http://bitbucket.org/gregschlom/qml-drag-drop/src/tip/DeclarativeDragArea.cpp
)

On Tue, Aug 3, 2010 at 3:13 AM, Jan Ekholm <jan.ekh...@smultron.net> wrote:
> On Monday 02 August 2010 22:22:25 alexis.men...@nokia.com wrote:
>> Hello,
>>
>> QDeclarativeItemPrivate constructor does this :
>>
>> QGraphicsItemPrivate::acceptedMouseButtons = 0;
>>
>> which means that no mousePress/mouseMove/mouseRelease will be delivered.
>>
>> You need to call setAcceptedMouseButtons in your C++ item with the buttons
>> you want.
>
> ...
>
>> I think either we should document that the default values are different
>> than QGraphicsItem or we should bind Item{} to something else, otherwise
>> we will get lot of mails/bug reports like this, just because the default
>> values of QDeclarativeItem are different than the one in QGraphicsItem.
>
> Ok, I read the docs for QGraphicsItem and saw this property mentioned. I was
> about to test setting it, but as the docs says:
>
> "Mouse press events are only delivered to items that accept the mouse button
> that is pressed. By default, an item accepts all mouse buttons, but you can
> change this by calling setAcceptedMouseButtons()."
>
> I didn't test it. However, adding in my constructor:
>
>    setAcceptedMouseButtons( Qt::LeftButton );
>
> makes no difference, I still see no events. Makes me suspect something else.
> The C++ item itself has been used extensively as a plain QGraphicsItem before
> in a QGraphicsView based system, and should be just fine. I more or less only
> changed it to subclass QDeclarativeItem.
>
> I need to debug deeper, it seems.
>
> --
>
>  He says gods like to see an atheist around. Gives them something to aim at.
>                                            -- Terry Pratchett, Small Gods
> _______________________________________________
> Qt-qml mailing list
> Qt-qml@trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>

_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to