Hi,
I tried to disable drag and drop property for QTreeWidget's Header columns.
done m_Tree-> setDragEnabled(false);
but still drag and drop is working.
so how to disable drag and drop for QTreeWidget?
Thanks,
sanujas
Printable View
Hi,
I tried to disable drag and drop property for QTreeWidget's Header columns.
done m_Tree-> setDragEnabled(false);
but still drag and drop is working.
so how to disable drag and drop for QTreeWidget?
Thanks,
sanujas
I assume you refer to section drag and drop, well it depends on Qt version you use
Code:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) treeWidget.header()->setSectionsMovable(false); #else treeWidget.header()->setMovable(false); #endif
Hi,
Thanks a lot,Yah it got worked with setMovable.
One more question:
I wanted to do Sections of Hearder(Header columns) unstretchable.
By below code i could make first 3 columns unstretchable but 4 column is still stretchable.
I tried to use TreeView, but it gives compilation error that setStretchLastSection is not a member of QTreeView.
So pls let me know how can i make 4th column unstretchable?
m_TreeWidget->setColumnWidth(0, 80);
m_TreeWidget->setColumnWidth(1, 70);
m_TreeWidget->setColumnWidth(2, 100);
m_TreeWidget->setColumnWidth(3, 112);
m_TreeWidget->header()->setStretchLastSection(false);
m_TreeWidget->header()->setResizeMode(0,QHeaderView ::Fixed);
m_TreeWidget->header()->setResizeMode(1,QHeaderView ::Fixed);
m_TreeWidget->header()->setResizeMode(2,QHeaderView ::Fixed);
m_TreeWidget->header()->setResizeMode(3,QHeaderView ::Fixed);
Thanks,
Sanujas