Project

General

Profile

enable/disable a WTreeTable and all of its subnodes

Added by Michael Leitman over 12 years ago

Hello out there :)

Due to user-right handling in my application,

it starts with a "not clickable" WTreeTable (per setting this->m_treeTable->disable();)

At first i create a TreeTable, then adding it as a Widget to a Layout

and at last calling disable().

For testing, on reaction to a Button Click, i enable the treeTable, calling this->m_treeTable->enable();

But then, only the "first level nodes" are clickable,

if i expand a Node, which contains subnodes, these are not available.

Is that supposed to be?

If yes, how can i en/disable all nodes and subnodes of a treetable?

I attached code, which represents my test case.

As seen in my code, the same process works for a WTreeView!

- the incredible Leitman

PS: oh, and i have another question, regarding WTreeView:

Using a WTreeTable, i can simply delete the current selection with

WTreeTable->tree()->clearSelection()

How would this look alike using a WTreeView?

I tried WTreeView->selectionModel()->selectedIndexes().clear(); but this did not work :(

thank you for every help

  • the incredible Leitman

Replies (3)

RE: enable/disable a WTreeTable and all of its subnodes - Added by Michael Leitman over 12 years ago

EDIT:

I just discovered another strange (in my eyes) behavior:

If i set a TristateCheckbox in the WTreeView header like

mode->setHeaderFlags(0, Horizontal, HeaderIsTristate | HeaderIsUserCheckable);

and set Sorting Enabled: treeView->setSortingEnabled(col, false);

and then set the whole WTreeView to disabled,

it's still available and the user can sort columns and select the tristate checkbox in the header?

RE: enable/disable a WTreeTable and all of its subnodes - Added by Koen Deforche over 12 years ago

Hey,

1) Indeed, WTreeTable::disable()/enable() and WTreeView::disable()/enable() require some extra work.

Could you file this as a bug ?

2) WTreeView::setSelectedIndexes(WModelIndexSet()) will clear the selection.

Regards,

koen

RE: enable/disable a WTreeTable and all of its subnodes - Added by Michael Leitman over 12 years ago

thank you again, very much :)

@2: that helps ;) works perfect now

@1: i reported a bug under http://redmine.emweb.be/issues/1247

regards

  • the incredible Leitman
    (1-3/3)