Ejemplo n.º 1
0
void WTreeNode::expand()
{
  if (!isExpanded()) {
    if (!childrenLoaded_) {
      loadChildren();
    }

    /*
     * Happens if expandable() for an unpopulated node returned true,
     * but after populate(), there were no children: update the node to
     * reflect that in fact this node cannot be expanded after all
     */
    if (parentNode() && childNodes_.empty()) {
      parentNode()->resetLearnedSlots();
      update();
    }

    if (loadPolicy_ == NextLevelLoading)
      loadGrandChildren();

    doExpand();

    updateChildren();
  }
}
Ejemplo n.º 2
0
void WTreeNode::expand()
{
  if (!expanded()) {
    if (!childrenLoaded_) {
      loadChildren();
    }

    if (loadPolicy_ == NextLevelLoading)
      loadGrandChildren();

    doExpand();
  }
}
Ejemplo n.º 3
0
void WTreeNode::setLoadPolicy(LoadPolicy loadPolicy)
{
  loadPolicy_ = loadPolicy;

  switch (loadPolicy) {
  case PreLoading:
    loadChildren();

    break;
  case NextLevelLoading:
    if (isExpanded()) {
      loadChildren();
      loadGrandChildren();
    } else {
      WTreeNode *parent = parentNode();
      if (parent && parent->isExpanded())
	loadChildren();

      expandIcon_
	->icon1Clicked().connect(this, &WTreeNode::loadGrandChildren);
    }
    break;
  case LazyLoading:
    if (isExpanded())
      loadChildren();
    else {
      if (childCountPolicy_ == Enabled) {
	WTreeNode *parent = parentNode();
	if (parent && parent->isExpanded())
	  doPopulate();
      }

      expandIcon_->icon1Clicked().connect(this, &WTreeNode::expand);
    }
  }

  if (loadPolicy_ != LazyLoading) {
    for (unsigned i = 0; i < childNodes_.size(); ++i)
      childNodes_[i]->setLoadPolicy(loadPolicy_);
  }
}
Ejemplo n.º 4
0
void WTreeNode::setLoadPolicy(LoadPolicy loadPolicy)
{
  loadPolicy_ = loadPolicy;

  switch (loadPolicy) {
  case PreLoading:
    loadChildren();

    break;
  case NextLevelLoading:
    if (expanded()) {
      loadChildren();
      loadGrandChildren();
    } else {
      if (parentNode_ && parentNode_->expanded())
	loadChildren();
      expandIcon_
	->icon1Clicked.connect(SLOT(this, WTreeNode::loadGrandChildren));
    }
    break;
  case LazyLoading:
    if (expanded())
      loadChildren();
    else {
      if (parentNode_ && parentNode_->expanded()) {
	if (!populated_) {
	  populate();
	  populated_= true;
	}
      }

      expandIcon_->icon1Clicked.connect(SLOT(this, WTreeNode::expand));
    }
  }

  if (loadPolicy_ != LazyLoading) {
    for (unsigned i = 0; i < childNodes_.size(); ++i)
      childNodes_[i]->setLoadPolicy(loadPolicy_);
  }
}