Jitendra Gupta
Jitendra Gupta

Reputation: 11

How to read a mimedata coming from QTreeWidget in a QFrame void DragWidget::dropEvent(QDropEvent *event), where DragWidget::QFrame

debug mode image

Can anyone help me reading the text from QByteArray as iam new to Qt. Also its a internal drag and drop from QTreeWidget to a QFrame. How can i get the QTreeWidgetItem if i am dragging the item from Qtrewidgetitem to QFrame in dropEvent function?

 void DragWidget::dropEvent(QDropEvent *event)
    {
        if (event->mimeData()->hasFormat("application/x-
    abstractitemmodeldatalist")) {
            QByteArray i

temData = event->mimeData()->data("application/x-
    abstractitemmodeldatalist");

//how to read the string from itemData//mystring is 'LDA'

Upvotes: 0

Views: 370

Answers (1)

Dragos Pop
Dragos Pop

Reputation: 458

QByteArray encapsulates chars. Either access them directly using [] operator or use data or constData member functions that return a (const) pointer to c char array.

Upvotes: 1

Related Questions