Hi all
Please parden me ,if my question is silly..
How do implement the drag and drop for inside QTreewidget.. top toplevelitems only accept drops and if it have same item already it has to neglect it.. i tried with
{
if (event->source() == this) {
event->setDropAction(Qt::MoveAction);
event->accept();
}
{
event->accept();
{
if(ui->treeWidget->topLevelItem(1))
{
// Create a data stream that operates on the binary data
// Add each item's text for col 0 to the stream
// Set the data associated with the mime type foo/bar to ba
md->setData("foo/bar", ba);
}
}
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (event->source() == this) {
event->setDropAction(Qt::MoveAction);
event->accept();
}
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
event->accept();
void MainWindow::dropEvent(QDropEvent *event)
{
if(ui->treeWidget->topLevelItem(1))
{
QByteArray ba;
// Create a data stream that operates on the binary data
QDataStream ds(&ba, QIODevice::WriteOnly);
// Add each item's text for col 0 to the stream
QMimeData *md = new QMimeData;
// Set the data associated with the mime type foo/bar to ba
md->setData("foo/bar", ba);
}
}
To copy to clipboard, switch view to plain text mode
can you any one give a solution to implement the above senario
Advance Thanks
Thanks
Addu
Bookmarks