6 #include <QtGui/QSortFilterProxyModel>
27 mpParameterSetCopy(NULL),
28 mpParameterSetDM(NULL),
29 mpParameterSetSortDM(NULL),
44 mpTreeView->sortByColumn(0, Qt::AscendingOrder);
47 mpTreeView->setItemDelegateForColumn(1, pPushButtonDelegate);
48 connect(pPushButtonDelegate, SIGNAL(clicked(
const QModelIndex &)),
this, SLOT(
slotResolve(
const QModelIndex &)));
51 mpTreeView->setItemDelegateForColumn(5, pComboDelegate);
130 static_cast< CModelParameter::Framework >(
mFramework),
168 mpTreeView->expandAll();
169 mpTreeView->resizeColumnToContents(3);
195 mpTreeView->header()->hideSection(1);
200 mpHeaderWidget->hide();
209 mpTreeView->expandAll();
211 for (
int i = 0; i < 6; i++)
213 mpTreeView->resizeColumnToContents(i);
231 for (; it != end; ++it)
243 mpBtnRevert->setFocus();
250 mpBtnCommit->setFocus();
301 "You are about to overwrite the current model values.\n"
302 "Do you want to save them?",
303 QMessageBox::Save | QMessageBox::Discard,
304 QMessageBox::Save) == QMessageBox::Save)
313 QStringList SelectionList;
315 for (; it != end; ++it)
317 SelectionList.append(
FROM_UTF8((*it)->getName()));
323 if (Dialog.exec() != QDialog::Rejected &&
326 if (SelectionList.indexOf(Name) == -1)
330 Sets.
add(pNew,
true);
373 std::string Name =
"Parameter Set";
379 Name =
"Parameter Set ";
380 Name +=
TO_UTF8(QString::number(i));
385 Sets.
add(pNew,
true);
399 C_INT32 Answer = QMessageBox::No;
402 while (Answer == QMessageBox::No)
406 "untitled.tsv",
"Tab Separated Files (*.tsv);;Comma Separated Files (*.csv);;TEXT Files (*.txt)",
"Save as");
408 if (fileName.isEmpty())
return;
413 if (Answer == QMessageBox::Cancel)
return;
418 if (file.fail())
return;
421 std::string separator;
423 if (fileName.endsWith(
".txt"))
428 else if (fileName.endsWith(
".csv"))
469 QStringList SelectionList;
471 for (; it != end; ++it)
473 SelectionList.append(
FROM_UTF8((*it)->getName()));
478 if (Dialog.exec() == QDialog::Rejected)
490 if (SelectionList.indexOf(Name) == -1)
494 Sets.
add(pNew,
true);
513 QModelIndex Tmp = index;
514 const QAbstractItemModel *pModel = Tmp.model();
516 while (pModel->inherits(
"QSortFilterProxyModel"))
518 Tmp =
static_cast< const QSortFilterProxyModel *
>(pModel)->mapToSource(index);
519 pModel = Tmp.model();
527 QModelIndex Tmp = index;
528 const QAbstractItemModel *pModel = Tmp.model();
530 while (pModel->inherits(
"QSortFilterProxyModel"))
532 Tmp =
static_cast< const QSortFilterProxyModel *
>(pModel)->mapToSource(index);
533 pModel = Tmp.model();
536 mpTreeView->closePersistentEditor(Tmp);
543 if (pModelParameter == NULL)
556 mpTreeView->expandAll();
557 mpTreeView->resizeColumnToContents(3);
void setSelectionList(const QStringList &selectionList)
const CModelParameterSet & getModelParameterSet() const
void switchToOtherWidget(const size_t &id, const std::string &key)
bool compareWithModel(const CModelParameter::Framework &framework)
const std::string & getObjectName() const
CModelParameter * getModelParameter(const std::string &cn) const
virtual size_t getIndex(const std::string &name) const
bool saveToStream(std::ostream &os, const CModelParameter::Framework &framework, const std::string &mode, const std::string &separator)
virtual bool add(const CType &src)
virtual const std::string & getKey() const
C_INT32 checkSelection(const QString &file)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
const QString & getSelection() const
const CCopasiVectorN< CModelParameterSet > & getModelParameterSets() const
const std::string & getKey() const
static CModelParameter * nodeFromIndex(const QModelIndex &index)
virtual void remove(const std::string &name)
virtual bool refreshFromModel(const bool &modifyExistence)
void setFramework(const int &framework)
std::vector< CModelParameter * >::const_iterator const_iterator
virtual const CompareResult & diff(const CModelParameter &other, const CModelParameter::Framework &framework, const bool &createMissing=false)
static CLocaleString fromUtf8(const std::string &utf8)
bool setObjectName(const std::string &name)
void assignSetContent(const CModelParameterSet &src, const bool &createMissing)
virtual bool updateModel()
void setModelParameterset(CModelParameterSet *pModelParameterSet)
CModel * getModel() const
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)