MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / removeFromStackRequested

Method removeFromStackRequested

gui/nnotebookview.cpp:851–880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849
850
851void NNotebookView::removeFromStackRequested() {
852 QList<QTreeWidgetItem*> items = selectedItems();
853 qint32 lid = items[0]->data(NAME_POSITION, Qt::UserRole).toInt();
854 NotebookTable table(global.db);
855 table.removeFromStack(lid);
856
857 // Now move it in the actual tree
858 NNotebookViewItem *stackWidget, *notebookWidget;
859 notebookWidget = dataStore[lid];
860 stackWidget = (NNotebookViewItem*)notebookWidget->parent();
861
862 stackWidget->removeChild(notebookWidget);
863 stackWidget->parent()->addChild(notebookWidget);
864
865 if (stackWidget->childCount() == 0) {
866 stackWidget->parent()->removeChild(stackWidget);
867 QString text = stackWidget->text(NAME_POSITION);
868 for (int i=0; i<stackMenu->actions().size(); i++) {
869 if (stackMenu->actions().at(i)->text() == text) {
870 stackMenu->actions().at(i)->setVisible(false);
871 emit(stackDeleted(text));
872 i = stackMenu->actions().size();
873 }
874 }
875 }
876
877 this->sortItems(NAME_POSITION, Qt::AscendingOrder);
878 resetSize();
879 this->sortByColumn(NAME_POSITION);
880}
881
882
883void NNotebookView::sortStackMenu() {

Callers

nothing calls this directly

Calls 2

dataMethod · 0.80
removeFromStackMethod · 0.45

Tested by

no test coverage detected