本文整理汇总了C++中IAlgorithm_sptr::getProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ IAlgorithm_sptr::getProperties方法的具体用法?C++ IAlgorithm_sptr::getProperties怎么用?C++ IAlgorithm_sptr::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAlgorithm_sptr
的用法示例。
在下文中一共展示了IAlgorithm_sptr::getProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void MonitorDlg::update() {
if (!m_tree) {
m_tree = new QTreeWidget(this);
m_tree->setColumnCount(3);
m_tree->setSelectionMode(QAbstractItemView::NoSelection);
// Make the algorithm name column wider
m_tree->setColumnWidth(0, 220);
QStringList hList;
hList << "Algorithm"
<< "Progress"
<< "";
m_tree->setHeaderLabels(hList);
QHeaderView *hHeader = (QHeaderView *)m_tree->header();
hHeader->setResizeMode(1, QHeaderView::Stretch);
hHeader->setResizeMode(2, QHeaderView::Fixed);
hHeader->setStretchLastSection(false);
} else
m_tree->clear();
if (!isVisible())
return;
m_algMonitor->lock();
QVector<Mantid::API::AlgorithmID>::const_iterator iend =
m_algMonitor->algorithms().end();
for (QVector<Mantid::API::AlgorithmID>::const_iterator itr =
m_algMonitor->algorithms().begin();
itr != iend; ++itr) {
IAlgorithm_sptr alg =
Mantid::API::AlgorithmManager::Instance().getAlgorithm(*itr);
// m_algorithms << alg;
QStringList iList;
iList << QString::fromStdString(alg->name());
QTreeWidgetItem *algItem = new QTreeWidgetItem(iList);
m_tree->addTopLevelItem(algItem);
QProgressBar *algProgress = new QProgressBar;
algProgress->setAlignment(Qt::AlignHCenter);
AlgButton *cancelButton = new AlgButton("Cancel", alg);
m_tree->setItemWidget(algItem, 1, algProgress);
m_tree->setItemWidget(algItem, 2, cancelButton);
const std::vector<Mantid::Kernel::Property *> &prop_list =
alg->getProperties();
for (std::vector<Mantid::Kernel::Property *>::const_iterator prop =
prop_list.begin();
prop != prop_list.end(); ++prop) {
QStringList lstr;
Mantid::Kernel::MaskedProperty<std::string> *maskedProp =
dynamic_cast<Mantid::Kernel::MaskedProperty<std::string> *>(*prop);
if (maskedProp) {
lstr << QString::fromStdString(maskedProp->name()) + ": "
<< QString::fromStdString(maskedProp->getMaskedValue());
} else {
lstr << QString::fromStdString((**prop).name()) + ": "
<< QString::fromStdString((**prop).value());
}
if ((**prop).isDefault())
lstr << " Default";
algItem->addChild(new QTreeWidgetItem(lstr));
}
connect(
cancelButton, SIGNAL(clicked(Mantid::API::AlgorithmID, QPushButton *)),
m_algMonitor, SLOT(cancel(Mantid::API::AlgorithmID, QPushButton *)));
}
m_algMonitor->unlock();
}