41 #include <QStringList>
43 #include <QTextStream>
53 parameterEntry(parameter),
61 this->
docString =
"Sorry, but we don't recognize the type of the " + name +
" parameter.\n"
62 +
"No worries though. Everything should be fine.\n"
63 "We'll just go ahead and set this parameter to its default value for you."
64 "\n\nActual Documentation:\n" + QString::fromStdString(parameter->docString());
67 this->
docString = QString::fromStdString(parameter->docString());
79 std::cout <<
name.toStdString() <<
": ";
106 if(role == Qt::ToolTipRole){
107 if(
name.compare(QString(
"Kurtis is awesome!"), Qt::CaseInsensitive) == 0){
108 return QString(
"I know! I think I'm awesome too!\n"
109 "You're pretty awesome yourself! You should send\n"
110 "me an e-mail letting me know you found the easter egg.\n"
112 "kob0724@gmail.com or klnusbaum@gmail.com");
114 else if(
name.compare(QString(
"Jim is awesome!"), Qt::CaseInsensitive) == 0){
115 return QString(
"I know! I think he's awesome too!\n"
116 "You're pretty awesome yourself! You should send\n"
117 "Jim an e-mail letting him know you think he's awesome.\n"
119 "Tell him Kurtis sent you. jmwille@sandia.gov");
121 else if(
name.compare(QString(
"Dr. Heroux is awesome!"), Qt::CaseInsensitive) == 0){
122 return QString(
"I know! I think he's awesome too!\n"
123 "You're pretty awesome yourself! You should send\n"
124 "Dr. Heroux an e-mail letting him know you think he's awesome.\n"
126 "Tell him Kurtis sent you. maherou@sandia.gov");
130 else if(role == Qt::DisplayRole &&
isHeader){
134 else if (column == 1){
137 else if(column == 2){
145 else if (column == 1){
146 return QVariant(
"N/A");
148 else if(column == 2){
152 else if(role == Qt::DisplayRole){
156 else if(column == 1 &&
161 return QString(
"Click to view 2D Array");
163 else if(column == 1 &&
175 return QString::fromStdString(str);
177 else if(column == 2){
218 catch(std::exception& ){
236 catch(std::exception& e){
237 return QString::fromStdString(e.what());
244 int newValue = value.value<
int>();
250 short newValue = value.value<
short>();
256 double newValue = value.value<
double>();
262 float newValue = value.value<
float>();
268 bool newValue = value.value<
bool>();
274 std::string newValue = value.toString().toStdString();
340 else if(parameter->isList()){
343 else if(parameter->isType<
int>()){
346 else if(parameter->isType<
short>()){
349 else if(parameter->isType<
double>()){
352 else if(parameter->isType<
float>()){
355 else if(parameter->isType<
bool>()){
358 else if(parameter->isType<std::string>()){
361 else if(parameter->isArray()){
364 return QString(
arrayId +
" "+ determinedId);
370 else if(parameter->isTwoDArray()){
void appendChild(TreeItem *child)
Appends a child TreeItem to the TreeItem.
bool is_null(const boost::shared_ptr< T > &p)
QVariant data(int column, int role=Qt::DisplayRole) const
Returns the data located in a particular column.
int childCount() const
Gets the number of child nodes this item has.
bool changeValue(QVariant value)
Changes the value of the TreeItem. Should only be used with TreeItems that represent Parameters...
QString getCurrentInvalidValueMessage() const
Gets a message desribing the error with the current value.
bool isHeader
Whether or not this is a header treeitem.
const char * toString(const EReductionType reductType)
TreeItem(const QString &name, RCP< ParameterEntry > parameterEntry, TreeItem *parent=0, bool isHeader=false)
Constructs a TreeItem object.
void printOut() const
Prints out the values in the TreeItem.
TreeItem * child(int row)
Returns the child treeitem in the row specified by the row argument.
const QString name
the name of the tree item.
QString determineArrayType(RCP< const ParameterEntry > parameter, bool twoD)
Determines the type of array stored in a parameter.
bool is_null(const RCP< T > &p)
QVariant arrayEntryToVariant(RCP< const ParameterEntry > arrayEntry, QString type, bool twoD)
Creates a QVariant containing the array that is in arrayEntry.
The TreeItem class is the item class used by the TreeModel class.
bool hasValidValue() const
Determines whether or not the current value associated with the TreeItem is valid.
QList< TreeItem * > childItems
The childitems of the TreeItem.
~TreeItem()
Deconstrcutor for the TreeItem.
TreeItem * parentItem
The parent TreeItem.
void changeValueForArray(QVariant value, QString type, bool twoD=false)
Changes the value of an array.
int columnCount() const
How man columns the TreeItem has. Should always be 3.
QString myTypeId
The type id associated with this TreeItem.
bool nonnull(const boost::shared_ptr< T > &p)
RCP< ParameterEntry > parameterEntry
The ParameterEntry being represented by the TreeItem.
static QString getTypeId(const RCP< const ParameterEntry > parameter)
Gets the type id to be used for the TreeItem.
int row() const
Returns the row in which this TreeItem is located.
const QList< TreeItem * > getChildItems()
Gets a list of all the child items.
QString docString
The docString for the TreeItem.
TreeItem * parent()
Gets the parent TreeItem.
void setValidator(RCP< const ParameterEntryValidator > validator)
Sets the validator for the parameter the TreeItem represents.
QString getArrayType(QString itemType)
Given a type string, determines the template type of the Array.
static const int getRawDataRole()
Returns constant representing the RawDataRole.