本文整理汇总了C++中Formula::getRepre方法的典型用法代码示例。如果您正苦于以下问题:C++ Formula::getRepre方法的具体用法?C++ Formula::getRepre怎么用?C++ Formula::getRepre使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formula
的用法示例。
在下文中一共展示了Formula::getRepre方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
CreatorDialog::CreatorDialog(bool edit, QWidget *parent)
: QDialog(parent)
{
setWindowTitle(edit? tr("Edit logic function..."): tr("New logic function..."));
m_gm = GUIManager::instance();
Formula *formula = (edit? new Formula(*m_gm->getFormula()): 0);
if (formula)
m_name = formula->getName();
else
m_name = Formula::DEFAULT_NAME;
m_nameLine = new QLineEdit(QString(m_name));
m_nameLine->setMinimumWidth(20);
m_nameLine->setMaximumWidth(40);
m_nameLine->setAlignment(Qt::AlignRight);
connect(m_nameLine, SIGNAL(editingFinished()), this, SLOT(setName()));
QLabel *nameLabel = new QLabel(tr("Function &name: "));
nameLabel->setBuddy(m_nameLine);
QHBoxLayout *nameLayout = new QHBoxLayout;
nameLayout->addWidget(nameLabel);
nameLayout->addWidget(m_nameLine);
m_repreCombo = new QComboBox;
m_repreCombo->insertItem(SOP_IDX, tr("Sum of Products"));
m_repreCombo->insertItem(POS_IDX, tr("Product of Sums"));
if ((formula && formula->getRepre() == Formula::REP_SOP) || m_gm->isSoP()) {
setRepre(Formula::REP_SOP);
m_repreCombo->setCurrentIndex(SOP_IDX);
}
else {
setRepre(Formula::REP_POS);
m_repreCombo->setCurrentIndex(POS_IDX);
}
connect(m_repreCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setRepre(int)));
QLabel *repreLabel = new QLabel(tr("&Representation: "));
repreLabel->setBuddy(m_repreCombo);
QHBoxLayout *repreLayout = new QHBoxLayout;
repreLayout->addWidget(repreLabel);
repreLayout->addWidget(m_repreCombo);
m_vcCombo = new QComboBox;
m_vcCombo->setMinimumWidth(30);
m_vcCombo->addItem(QString());
for (unsigned i = 1; i <= Formula::MAX_VARS; i++)
m_vcCombo->addItem(QString::number(i));
connect(m_vcCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setVarsCount(int)));
QLabel *vcLabel = new QLabel(tr("Variables &count: "));
vcLabel->setBuddy(m_vcCombo);
QHBoxLayout *vcLayout = new QHBoxLayout;
vcLayout->addWidget(vcLabel);
vcLayout->addWidget(m_vcCombo);
m_varsLine = new QLineEdit;
connect(m_varsLine, SIGNAL(editingFinished()), this, SLOT(setVars()));
QLabel *varsLabel = new QLabel(tr("&Variables: "));
varsLabel->setBuddy(m_varsLine);
QHBoxLayout *varsLayout = new QHBoxLayout;
varsLayout->addWidget(varsLabel);
varsLayout->addWidget(m_varsLine);
m_ttModel = new TruthTableModel;
m_ttView = new TruthTableView;
m_ttView->setModel(m_ttModel);
m_ttView->setItemDelegate(new TruthTableDelegate);
m_ttView->setMinimumSize(400, 300);
m_ttView->setMaximumSize(500, 400);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QGridLayout *mainLayout = new QGridLayout;
mainLayout->setVerticalSpacing(5);
mainLayout->setHorizontalSpacing(40);
mainLayout->addLayout(nameLayout, 0, 0);
mainLayout->addLayout(repreLayout, 0, 1);
mainLayout->addLayout(vcLayout, 1, 0);
mainLayout->addLayout(varsLayout, 1, 1);
mainLayout->addWidget(m_ttView, 2, 0, 1, 2);
mainLayout->addWidget(buttonBox, 3, 0, 1, 2);
setLayout(mainLayout);
if (formula) {
m_gm->setNewFormula(formula);
m_vcCombo->setCurrentIndex((m_varsCount = formula->getVarsCount()));
m_vars = formula->getVars();
printVars();
m_ttModel->setFormula(formula);
m_ttView->resizeColumnsToContents();
}
}