Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, January 2007
[Qt4] what's the use of QAbstractItemModel::mimeTypes()


Message 1 in thread

<br><font size=2 face="sans-serif">Folks:</font>
<br>
<br><font size=2 face="sans-serif">The docs are not clear on why a model
needs to define the used MIME types using the mimeTypes() API. If my model
overrides mimeData(), what is the importance of mimeTypes()? Will Qt do
something behind my back if the actual MIME types created in mimeData()
do not match the types returned in mimeTypes()?</font>
<br>
<br><font size=2 face="sans-serif">The use-case I am encountering is that
my model does not statically know which MIME types are possible. Plus,
components are dynamically loaded and unloaded and the generic model has
no visibility into those specific items. It would be a pain to try handle
this if the mimeTypes() data is really meaningless.</font>
<br>
<br><font size=2 face="sans-serif">So, can I just return one MIME type
from mimeTypes() and that would be sufficient?</font>
<br>
<br>
<br><font size=2 face="sans-serif">thanks,</font>
<br>
<br><font size=2 face="sans-serif">bob pizzi</font>
<br><font size=2 face="sans-serif">ni.com</font>
<br>
<br>

--
 [ signature omitted ] 

Message 2 in thread

I dont know where else it is used, but I do know it is used during the drag and drop system.
When you drag from a model it uses the mime data list to tell where you dropping into what type of data, and if the drop zone can hanle the drop.
 
If you dont plan on dragging from the model, just return the base class implementation. 
 
You will notice, the mimeData( QMIL ) method, returns a list based omn the requested QModelIndexList sent in... So, if you know the object your model index points to, you can return its valid mime times.
 
The mimeTypes is a union of all possible types, and thus, when something got added, you could dynamically update that list.

Scott

________________________________

From: Bob Pizzi [mailto:Bob.Pizzi@xxxxxx]
Sent: Mon 1/22/2007 11:47 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: [Qt4] what's the use of QAbstractItemModel::mimeTypes() 



Folks: 

The docs are not clear on why a model needs to define the used MIME types using the mimeTypes() API. If my model overrides mimeData(), what is the importance of mimeTypes()? Will Qt do something behind my back if the actual MIME types created in mimeData() do not match the types returned in mimeTypes()? 

The use-case I am encountering is that my model does not statically know which MIME types are possible. Plus, components are dynamically loaded and unloaded and the generic model has no visibility into those specific items. It would be a pain to try handle this if the mimeTypes() data is really meaningless. 

So, can I just return one MIME type from mimeTypes() and that would be sufficient? 


thanks, 

bob pizzi 
ni.com 

-- To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body. List archive and information: http://lists.trolltech.com/qt-interest/ 

--
 [ signature omitted ]