void DataInspectionDialog::onNextButtonClick()
{
    subjectIndex++;
    NextButton->setDisabled(subjectIndex == nSubjects-1);
    PreviousButton->setEnabled(subjectIndex > 0);
    SubjectsTree->setCurrentItem(SubjectsTree->invisibleRootItem()->child(subjectIndex));
    updateSubject();
}
void DataInspectionDialog::onTreeItemPressed(QTreeWidgetItem *item, int col)
{
    if ( (item == NULL) || SubjectsTree->selectedItems().isEmpty() || col == -1)
        return;
    uint index = SubjectsTree->invisibleRootItem()->indexOfChild(item);
    qDebug()<<"tree ind "<<index<<" current: "<<subjectIndex;
    if (index == subjectIndex)
        return;
    subjectIndex = index;
    PreviousButton->setDisabled(subjectIndex == 0);
    NextButton->setDisabled(subjectIndex == nSubjects-1);
    updateSubject();
}
void DataInspectionDialog::init(bool isInd,const QString &src, const QString &bn,
                                ImageFileType ft,int nImgs)
{
    // note that fileType should never be allowed to be RAW
    individual = isInd;
    path = src;
    baseName = bn;
    fileType = ft;
    expectedNImages = nImgs;

    PreviousButton->setEnabled(false);
    if (individual) {
        // if individual, disable all control buttons, no need for tree
        NextButton->setEnabled(false);
        Subject_ID_Text->setEnabled(false);
        SubjectsTree->setEnabled(false);
    }
    else {
        QStringList subjects = QDir(path).entryList(QDir::NoDotAndDotDot | QDir::AllDirs);
        nSubjects = subjects.size();
        NextButton->setEnabled(nSubjects > 1);
        // identify first subject
        Subject_ID_Text->setText("Subject ID: "+subjects.first());
        SubjectsTree->clear();
        // prepare tree
        for (int i =0; i<subjects.size();i++) {
            QTreeWidgetItem *item = new QTreeWidgetItem();
            item->setData(0,Qt::CheckStateRole,true);
            item->setText(1,subjects.at(i));
            item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsUserCheckable);
            SubjectsTree->insertTopLevelItem(i,item);
        }
        SubjectsTree->setColumnWidth(0,36);
        SubjectsTree->setColumnWidth(1,64);
        SubjectsTree->setCurrentItem(SubjectsTree->invisibleRootItem()->child(0));
    }
    subjectIndex = 0;
    imageIndex = 0;
    // prepare color table
    for (int i = 0;i<256;i++)
        cTable.append(qRgb( i, i, i ));

    // load image
    clearDisplay();
    data.clear();
    updateSubject();
}
示例#4
0
void TodoEditor::setupGui()
{
    startDateEdit = new QDateTimeEdit;
    dueDateEdit = new QDateTimeEdit;
    subjectLineEdit = new QLineEdit;
    descriptionTextEdit = new QTextEdit;
    doneButton = new QPushButton(tr("Done"));

    setupCombos();

    connect(startDateEdit, SIGNAL(editingFinished()),
        this, SLOT(updateDates()));
    connect(dueDateEdit, SIGNAL(editingFinished()), this, SLOT(updateDates()));
    connect(subjectLineEdit, SIGNAL(editingFinished()),
        this, SLOT(updateSubject()));
    connect(descriptionTextEdit, SIGNAL(textChanged()),
        this, SLOT(updateDescription()));
    connect(statusCombo, SIGNAL(activated(int)), this, SLOT(updateStatus(int)));
    connect(priorityCombo, SIGNAL(activated(int)),
        this, SLOT(updatePriority(int)));
    connect(alarmCombo, SIGNAL(activated(int)), this, SLOT(updateAlarm(int)));
    connect(doneButton, SIGNAL(clicked()), this, SLOT(finishEditing()));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(new QLabel(tr("Subject:")));
    layout->addWidget(subjectLineEdit);
    layout->addWidget(new QLabel(tr("Start Date:")));
    layout->addWidget(startDateEdit);
    layout->addWidget(new QLabel(tr("Due Date:")));
    layout->addWidget(dueDateEdit);
    layout->addWidget(new QLabel(tr("Status:")));
    layout->addWidget(statusCombo);
    layout->addWidget(new QLabel(tr("Priority:")));
    layout->addWidget(priorityCombo);
    layout->addWidget(new QLabel(tr("Alarm:")));
    layout->addWidget(alarmCombo);
    layout->addWidget(new QLabel(tr("Description")));
    layout->addWidget(descriptionTextEdit);
    layout->addWidget(doneButton);

    setLayout(layout);
}