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
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
Qt Code:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) treeWidget.header()->setSectionsMovable(false); #else treeWidget.header()->setMovable(false); #endifTo copy to clipboard, switch view to plain text mode
Last edited by Santosh Reddy; 3rd September 2013 at 12:13.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
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
Bookmarks