Re: [kde] Qt ─ how to use enum as the QMimeData type/format

2014-02-03 Thread Marek Kochanowicz
Dnia poniedziałek, 3 lutego 2014 16:24:08 Kevin Krammer pisze:
 Hello Marek,
 
 First of all, you are probably better of reposting this to the developer
 list: https://mail.kde.org/mailman/listinfo/kde-devel
 
 But since I am replying already :)
 
 On Monday, 2014-02-03, 15:16:49, Marek Kochanowicz wrote:
  Hello,
  
  I have to admit, that I have some problems understanding the QtMetaTypes
  system. If I clearly misunderstood whole thing, please point this out.
  
  I need to create QMimeData subclass to store reference to some object.
  This
  object is of the concrete class, but can be of different semantics,
  depending on the enum member value. Therefore to accept drag I need to set
  the correct format of the QMimeData, depending on the said member enum
  value.
 
 Do we talk about an application internal dragdrop operation here?
 
 In such a case the easiest case might be to store an identifier of some sort
 and let the drop recipient use that to do an look up for the actual object.
 
 In either case this is most likely not related to the Qt meta type system at
 all.
 
 Cheers,
 Kevin

First of: thanks for the answer. I probably should consider going to the KDE-
devel but honestly, I forgot about it. ;-)

Yes, those are inner drag  drops, and are not meant to handled outside of the 
application.

The approach you suggested  would work, but I would like to use type in the 
QMimeData and properly accept, just because this would provide user visual 
feedback (cursor change to no-drop) if the drop will not be accepted.
___
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

Re: [kde] Qt ─ how to use enum as the QMimeData type/format

2014-02-03 Thread Kevin Krammer
On Monday, 2014-02-03, 16:43:39, Marek Kochanowicz wrote:
 Dnia poniedziałek, 3 lutego 2014 16:24:08 Kevin Krammer pisze:

  Do we talk about an application internal dragdrop operation here?
  
  In such a case the easiest case might be to store an identifier of some
  sort and let the drop recipient use that to do an look up for the actual
  object.

 First of: thanks for the answer. I probably should consider going to the
 KDE- devel but honestly, I forgot about it. ;-)
 
 Yes, those are inner drag  drops, and are not meant to handled outside of
 the application.
 
 The approach you suggested  would work, but I would like to use type in the
 QMimeData and properly accept, just because this would provide user visual
 feedback (cursor change to no-drop) if the drop will not be accepted.

I didn't mean to imply that the only information you can send is the 
identifier :)

But even with just the identifier your use case (selective drag/drop handling) 
is still possible. You just get the identifier, get the object and check the 
object's type.

If for whatever reason you don't want to do the object lookup in e.g. 
dragMoveEvent, just use a different MIME type for each object type.

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring


signature.asc
Description: This is a digitally signed message part.
___
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

Re: [kde] Qt ─ how to use enum as the QMimeData type/format

2014-02-03 Thread Marek Kochanowicz
Dnia poniedziałek, 3 lutego 2014 17:01:31 Kevin Krammer pisze:
 On Monday, 2014-02-03, 16:43:39, Marek Kochanowicz wrote:
  Dnia poniedziałek, 3 lutego 2014 16:24:08 Kevin Krammer pisze:
   Do we talk about an application internal dragdrop operation here?
   
   In such a case the easiest case might be to store an identifier of some
   sort and let the drop recipient use that to do an look up for the actual
   object.
  
  First of: thanks for the answer. I probably should consider going to the
  KDE- devel but honestly, I forgot about it. ;-)
  
  Yes, those are inner drag  drops, and are not meant to handled outside of
  the application.
  
  The approach you suggested  would work, but I would like to use type in
  the
  QMimeData and properly accept, just because this would provide user visual
  feedback (cursor change to no-drop) if the drop will not be accepted.
 
 I didn't mean to imply that the only information you can send is the
 identifier :)
 
 But even with just the identifier your use case (selective drag/drop
 handling) is still possible. You just get the identifier, get the object
 and check the object's type.
 
 If for whatever reason you don't want to do the object lookup in e.g.
 dragMoveEvent, just use a different MIME type for each object type.
 
 Cheers,
 Kevin

I think I misunderstood you initially but now I see what do you mean. This 
appears to be a good solution, probably less complex, than attempt to create 
object with format corresponding to the data type.
___
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.