DropIndicator is empty when moving an item from QTreeWidget to QTableWidget
Good am!
I have just startet to deal with DnD and I got it working already.
But there is one problem left: The DropIndicator is empty! Means, there is the '+'-sign and a small empty square only while copying an item.
I guess, it's not not a big thing but I was not able to find it out by myself.
Here is some code:
tablewidget.h
Code:
{
Q_OBJECT
public:
TableWidget
( QWidget *parent
= 0 );
protected:
private:
TableWidget *tableWidget;
};
tablewidget.cpp
Code:
#include "tablewidget.h"
TableWidget
::TableWidget( QWidget *parent
){
setAcceptDrops( true );
}
{
itemAt( event->pos() )->setText( event->mimeData()->text() );
event->acceptProposedAction();
}
{
event->acceptProposedAction();
}
{
event->accept();
}
treewidget.h
Code:
{
Q_OBJECT
public:
protected:
private:
TreeWidget *treeWidget;
};
treewidget.cpp
Code:
TreeWidget
::TreeWidget( QWidget *parent
){
setDragEnabled( true );
}
{
if ( ! ( event->buttons() & Qt::LeftButton ) )
return;
if ( currentItem() == NULL )
return;
mimeData->setText( currentItem()->text( 0 ) );
drag->setMimeData( mimeData );
drag->start( Qt::CopyAction | Qt::MoveAction );
}
Any idea what's missing?
Re: DropIndicator is empty when moving an item from QTreeWidget to QTableWidget
Found an old thread about the same problem:
http://www.qtcentre.org/threads/1219...iew.-Need-help
Unfortunately it ends without a solution ... :(
Re: DropIndicator is empty when moving an item from QTreeWidget to QTableWidget
I have tried this sample now: http://sector.ynet.sk/qt4-tutorial/dnd.html
Same problem. The moment I'll subclass QTableWidget/QTreeWidget the drop-indicaor is empty.
I have tried it under Linux with Qt 4.6.3. and Qt 4.7.0, same problem ... :(