Exemplo n.º 1
0
void PlotPredicateDialog::updateInnerWidgets() {
    // remove all widgets first
    for (std::vector<QLabel*>::iterator it = labelVector_.begin(); it != labelVector_.end(); ++it)
        delete *it;
    labelVector_.clear();

    for (std::vector<QDoubleSpinBox*>::iterator it = sbVector_.begin(); it != sbVector_.end(); ++it)
        delete *it;
    sbVector_.clear();

    for (std::vector<QLineEdit*>::iterator it = editVector_.begin(); it != editVector_.end(); ++it)
        delete *it;
    editVector_.clear();

    // now create the new widgets
    int innerWidgetCount = (predicate_ == 0 ? 0 : predicate_->getNumberOfThresholdValues());
    if (innerWidgetCount > 0) {
        std::vector<std::string> titles = predicate_->getThresholdTitles();
        std::vector<PlotCellValue> values = predicate_->getThresholdValues();

        for (int i = 0; i < innerWidgetCount; ++i) {
            labelVector_.push_back(new QLabel(QString::fromStdString(titles[i])));
            mainLayout_->addWidget(labelVector_[i], i+2, 0);

            if (tagsOnly_) {
                editVector_.push_back(new QLineEdit(QString::fromStdString(values[i].getTag())));
                connect(editVector_[i], SIGNAL(editingFinished()), this, SLOT(updatePredicate()));
                mainLayout_->addWidget(editVector_[i], i+2, 1, 1, 2);
            }
            else {
                sbVector_.push_back(new QDoubleSpinBox());
                // REMARK: std::numeric_limits<double>::min() does not work here :( hopefully -1000000000 is low enough
                sbVector_[i]->setMinimum(-1000000000);
                sbVector_[i]->setMaximum(std::numeric_limits<double>::max());
                sbVector_[i]->setDecimals(5);
                sbVector_[i]->setValue(values[i].getValue());
                connect(sbVector_[i], SIGNAL(editingFinished()), this, SLOT(updatePredicate()));
                mainLayout_->addWidget(sbVector_[i], i+2, 1, 1, 2);
            }
        }
    }

    // move dialog buttons to the appropriate position
    mainLayout_->addWidget(btnOK_, innerWidgetCount + 3, 1);
    mainLayout_->addWidget(btnCancel_, innerWidgetCount + 3, 2);
}
Exemplo n.º 2
0
static void
binaryPredicate(State &state,
                const ControlFlowInst &cf,
                const AluInst &alu,
                const char *op)
{
   // predicate (src0 op src1)
   fmt::MemoryWriter condition;
   insertSource0(state, condition, cf, alu);
   condition << op;
   insertSource1(state, condition, cf, alu);
   updatePredicate(state, cf, alu, condition.str());
}