Beispiel #1
0
AnnotationWidget::AnnotationWidget(QWidget *parent) :
    QDialog(parent)
{
    setWindowIcon(QIcon(":/images/icons/graph.png"));
    setWindowTitle("Annotation");
    tabs = new QTabWidget(this);
    treeviewTab = new ToolsTreeviewTab(this);
    commandsTab = new ToolsCommandsTab(this);
    tabs->addTab(treeviewTab, "Tree View");
    tabs->addTab(commandsTab, "Commands");

    treeCountLabel = new QLabel("Total Tree Count: 0");
    nodeCountLabel = new QLabel("Total Node Count: 0");
    nodeCountLabel->setToolTip("Total number of nodes in the skeleton.");
    listedNodesLabel = new QLabel("Currently Listed Nodes: 0");
    listedNodesLabel->setToolTip("Number of nodes currently listed in the table.");
    QHBoxLayout *hLayout = new QHBoxLayout();
    QHBoxLayout *subHLayout = new QHBoxLayout();
    subHLayout->addWidget(listedNodesLabel, 0, Qt::AlignLeft);
    subHLayout->addWidget(nodeCountLabel, 0, Qt::AlignRight);
    hLayout->addWidget(treeCountLabel);
    hLayout->addLayout(subHLayout);


    mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(tabs);
    mainLayout->addLayout(hLayout);
    setLayout(mainLayout);

    connect(treeviewTab, &ToolsTreeviewTab::updateAnnotationLabelsSignal, this, &AnnotationWidget::updateLabels);

    connect(commandsTab, SIGNAL(treeActivatedSignal()), treeviewTab, SLOT(treeActivated()));
    connect(commandsTab, SIGNAL(treeAddedSignal(treeListElement*)), treeviewTab, SLOT(treeAdded(treeListElement*)));
    connect(commandsTab, SIGNAL(nodeActivatedSignal()), treeviewTab, SLOT(nodeActivated()));
    connect(commandsTab, SIGNAL(branchPushedSignal()), treeviewTab, SLOT(branchPushed()));
    connect(commandsTab, SIGNAL(branchPoppedSignal()), treeviewTab, SLOT(branchPopped()));

   this->setWindowFlags(this->windowFlags() & (~Qt::WindowContextHelpButtonHint));
}
void ToolsCommandsTab::activeNodeIDSpinChanged(int value) {
    nodeListElement *node = findNodeByNodeIDSignal(value);
    if(node == NULL) {
        return;
//        // no node with this value.
//        // jump to next or previous node, depending on wether spin box value is greater or smaller than active node id
//        if(state->skeletonState->activeNode == NULL) { // no active node, activate first node found
//            node = Skeletonizer::getNodeWithNextID(NULL, false);
//        }
//        else {
//            if((uint)value > state->skeletonState->activeNode->nodeID) { // move to next node
//                node = Skeletonizer::getNodeWithNextID(state->skeletonState->activeNode, false);
//            }
//            else if((uint)value < state->skeletonState->activeNode->nodeID) {
//                node = Skeletonizer::getNodeWithPrevID(state->skeletonState->activeNode, false);
//            }
//        }
    }
    if(node) {
        setActiveNodeSignal(CHANGE_MANUAL, node, 0);
        emit nodeActivatedSignal();
    }
    return;
}