Originally Posted by
pir
It would take me too long time prepare an example.
An example would help you make sure the error is not in your code.
I just wondered if it was a normal behaviour of QDockWidgets. I suppose it isn't.
It shouldn't be, but nobody says QDockWidget has to be responsible.
I couldn't find any entry in a task-tracker that'd seem related to the behaviour you experience.
Edit: I have written an example myself and it seems to work fine, so probably you have some error in your code.
#include <QMainWindow>
#include <QDockWidget>
#include <QApplication>
#include <QTreeWidget>
int main(int argc, char **argv){
for(int i=0;i<5;i++)
tree->setDragEnabled(true);
tree->setAcceptDrops(true);
dock->setWidget(tree);
mw.addDockWidget(Qt::LeftDockWidgetArea, dock);
mw.show();
return app.exec();
}
#include <QMainWindow>
#include <QDockWidget>
#include <QApplication>
#include <QTreeWidget>
int main(int argc, char **argv){
QApplication app(argc, argv);
QMainWindow mw;
QDockWidget *dock = new QDockWidget(&mw);
QTreeWidget *tree = new QTreeWidget;
for(int i=0;i<5;i++)
(new QTreeWidgetItem(tree))->setText(0,QString::number(i+1));
tree->setDragDropMode(QAbstractItemView::DragDrop);
tree->setDragEnabled(true);
tree->setAcceptDrops(true);
dock->setWidget(tree);
mw.addDockWidget(Qt::LeftDockWidgetArea, dock);
mw.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
If I float the dock widget I can still drag and drop items in the tree. Qt version 4.2.2.
Bookmarks