void TreeView::ExpandToIndex(const QModelIndex &ind) { if(ind.parent().isValid()){ // Expand my parent's parent before expanding my parent ExpandToIndex(ind.parent()); expand(ind.parent()); } }
void Polynom::SetCoef(int ind, double val) { if (ind < 0) { // TODO : dublicated code assert(!"Polynom::SetCoef : negative index"); return; } if (ind > Power() && val == 0.0) return; ExpandToIndex(ind); m_coef[ind] = val; }
void Polynom::SetCoefNZ(int ind, double val) // TODO : delete function? { if (ind < 0) { assert(!"Polynom::SetCoef : negative index"); return; } if (ind > Power() && AlmostZero(val)) return; ExpandToIndex(ind); m_coef[ind] = val; DeleteTopZeros(); }