Implement "hide root" properly.
This commit is contained in:
@@ -851,9 +851,14 @@ wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text,
|
|||||||
wxTreeItemData *data)
|
wxTreeItemData *data)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *root = m_qtTreeWidget->invisibleRootItem();
|
QTreeWidgetItem *root = m_qtTreeWidget->invisibleRootItem();
|
||||||
wxTreeItemId newItem = DoInsertItem(wxQtConvertTreeItem(root), 0, text, image, selImage, data);
|
wxTreeItemId newItem = DoInsertItem(wxQtConvertTreeItem(root), 0, text, image, selImage, data);
|
||||||
m_qtTreeWidget->setCurrentItem(NULL);
|
m_qtTreeWidget->setCurrentItem(NULL);
|
||||||
|
|
||||||
|
if ( (GetWindowStyleFlag() & wxTR_HIDE_ROOT) != 0 )
|
||||||
|
m_qtTreeWidget->setRootIndex(m_qtTreeWidget->model()->index(0, 0));
|
||||||
|
else
|
||||||
|
m_qtTreeWidget->setRootIndex(QModelIndex());
|
||||||
|
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1043,7 +1048,7 @@ bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item, wxRect& WXUNUSED(rect
|
|||||||
void wxTreeCtrl::SetWindowStyleFlag(long styles)
|
void wxTreeCtrl::SetWindowStyleFlag(long styles)
|
||||||
{
|
{
|
||||||
wxControl::SetWindowStyleFlag(styles);
|
wxControl::SetWindowStyleFlag(styles);
|
||||||
m_qtTreeWidget->invisibleRootItem()->setHidden((styles & wxTR_HIDE_ROOT) != 0);
|
|
||||||
m_qtTreeWidget->setSelectionMode(styles & wxTR_MULTIPLE ? QTreeWidget::ExtendedSelection : QTreeWidget::SingleSelection);
|
m_qtTreeWidget->setSelectionMode(styles & wxTR_MULTIPLE ? QTreeWidget::ExtendedSelection : QTreeWidget::SingleSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user