ich habe in einem QListView Ordner aufgelistet und in einem zweiten die Dateien (mittels QFileSystemModel) und würde gerne die Dateien von einem Ordner in einen anderen verschieben.
Folgendes habe ich versucht:
Code: Alles auswählen
splitter = new QSplitter(centralwidget);
gridLayout->addWidget(splitter, 0, 0);
fModel = new QFileSystemModel(this);
fModel->setRootPath(origPath);
fModel->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
fModel->setSupportedDragActions(Qt::MoveAction);
nModel = new QFileSystemModel(this);
nModel->setRootPath(origPath); //just as an example
nModel->setFilter(QDir::Files);
nModel->setSupportedDragActions(Qt::MoveAction);
nbList = new QListView(splitter); //note book list
nbList->setModel(fModel);
nbList->setRootIndex(fModel->index(origPath));
nbList->setContextMenuPolicy(Qt::CustomContextMenu);
nbList->setDefaultDropAction(Qt::MoveAction);
nbList->setDragDropMode(QAbstractItemView::DropOnly);
nbList->setSelectionMode(QAbstractItemView::ExtendedSelection);
nbList->setDropIndicatorShown(true);
nList = new QListView(splitter); //note list
nList->setModel(nModel);
nList->setRootIndex(nModel->index(origPath));
nList->setContextMenuPolicy(Qt::CustomContextMenu);
nList->setDragDropMode(QAbstractItemView::DragOnly);
nList->setSelectionMode(QAbstractItemView::ExtendedSelection);
nList->setDropIndicatorShown(true);Viele Grüße, Hakaishi