void BasketTree::s_addBasket() { QModelIndex index = selectionModel()->currentIndex(); Basket basket(database); basket.setTitle("new"); basket.setParentId(index.internalId()); basket.save(); emit rowsInserted(index, index.row(), index.row()); }
QStringList BasketListViewItem::childNamesTree(int deep) { QStringList result; // Compute indentation spaces: QString spaces; for (int j = 0; j < deep; ++j) spaces += " "; // Append the names of sub baskets if(deep > 0) result.append(spaces + basket()->basketName()); // Append the children: for (int i = 0; i < childCount(); i++) { QStringList children = ((BasketListViewItem *)child(i))->childNamesTree(deep + 1); result.append(children); } return result; }
bool BasketListViewItem::isCurrentBasket() { return basket() == Global::bnpView->currentBasket(); }