Qt-interest Archive, April 2007
rendering dragged data
Message 1 in thread
Hi,
How can I change the look of view items while they are dragged? The
default seems to be that dragged data looks exactly the same as it looks
in the view. E.g. my table view displays a custom model with 5 columns
is about 400 pixels wide; the rows are about 100 pixels high. When I
select a row and drag it over another view, the whole row is 'moved'
around with the mouse cursor, resulting in a huge (400x100 pixels) blue
rectangle covering up the screen. It's so big that the view I want to
drop the item on is completely hidden.
I hope this can be customised in some way, but so far I didn't find any
hint in the docs. Can someone give me a tip here?
Thanks!
M
--
[ signature omitted ]
Message 2 in thread
Hi, Martin,
http://doc.trolltech.com/4.2/qabstractitemview.html#startDrag
I think you can write your own startDrag, and set your own pixmap to
QDrag object.
Regards,
Liang
On 12/04/07, QMartin <martin.umgeher@xxxxxxxxxxx> wrote:
> Hi,
>
> How can I change the look of view items while they are dragged? The
> default seems to be that dragged data looks exactly the same as it looks
> in the view. E.g. my table view displays a custom model with 5 columns
> is about 400 pixels wide; the rows are about 100 pixels high. When I
> select a row and drag it over another view, the whole row is 'moved'
> around with the mouse cursor, resulting in a huge (400x100 pixels) blue
> rectangle covering up the screen. It's so big that the view I want to
> drop the item on is completely hidden.
>
> I hope this can be customised in some way, but so far I didn't find any
> hint in the docs. Can someone give me a tip here?
>
> Thanks!
> M
--
[ signature omitted ]
Message 3 in thread
Liang Qi wrote:
> Hi, Martin,
>
> http://doc.trolltech.com/4.2/qabstractitemview.html#startDrag
> I think you can write your own startDrag, and set your own pixmap to
> QDrag object.
>
> Regards,
> Liang
Hi, thanks for your answer.
Does this mean that I have to re-implement the whole d&d myself?
QDrag::setPixmap seems to be what I want, but to get to the QDrag object
I think I have to create it myself and handle everything manually.
I currently just use my custom model class for the drag part: my indices
are draggable, and I implemented the MIME methods of QAbstractItemModel.
I don't think I can combine the built-in d&d of models and a manually
created QDrag.
Lots of assumptions, but very little knowlege... can someone shed light
on this issue? :)
Thanks!
M
> On 12/04/07, QMartin <martin.umgeher@xxxxxxxxxxx> wrote:
>> Hi,
>>
>> How can I change the look of view items while they are dragged? The
>> default seems to be that dragged data looks exactly the same as it looks
>> in the view. E.g. my table view displays a custom model with 5 columns
>> is about 400 pixels wide; the rows are about 100 pixels high. When I
>> select a row and drag it over another view, the whole row is 'moved'
>> around with the mouse cursor, resulting in a huge (400x100 pixels) blue
>> rectangle covering up the screen. It's so big that the view I want to
>> drop the item on is completely hidden.
>>
>> I hope this can be customised in some way, but so far I didn't find any
>> hint in the docs. Can someone give me a tip here?
>>
>> Thanks!
>> M
>
--
[ signature omitted ]
Message 4 in thread
Hi,
I think you only need to copy all the code from
QAbstractItemView::startDrag() and change the content for setPixmap()
and do not need change other things.
Regards,
Liang
--
[ signature omitted ]