added the ability to change the combo box items
@@ -707,10 +707,25 @@ QvisSimulationWindow::UpdateUIComponent(QWidget *window, const QString &name,
}
if (ui->inherits("QComboBox"))
+ {
+ bool okay;
+ int index = value.toInt( &okay );
+
+ if( okay )
{
debug5 << "found QComboBox " << name.toStdString()
<< " value = " << value.toInt() << endl;
- ((QComboBox*)ui)->setCurrentIndex(value.toInt());
+
+ ((QComboBox*)ui)->setCurrentIndex(index);
+ }
+ else
+ {
+ debug5 << "found QComboBox " << name.toStdString()
+ << " items = " << value.toStdString() << endl;
+
+ ((QComboBox*)ui)->clear();
+ ((QComboBox*)ui)->addItems( value.split('|') );
+ }
}
if (ui->inherits("QTableWidget"))
@@ -1812,6 +1827,33 @@ QvisSimulationWindow::GetUIFile(const QString &key) const
return retval;
}
+// ****************************************************************************
+// Method: QvisSimulationWindow::parseCompositeCMD
+//
+// Purpose:
+// This method is called to parse a composite cmd to get the
+// index and name.
+//
+// Arguments:
+// cmd : The properly form command string.
+//
+// Programmer: Allen Sanderson
+// Creation: 6 May 2016
+//
+// Modifications:
+//
+// ****************************************************************************
+void
+QvisSimulationWindow::parseCompositeCMD( const std::string cmd,
+ std::string &ctrl,
+ std::string &text )
+{
+ std::string strcmd(cmd);
+
+ ctrl = getNextString( strcmd, " | " );
+ text = getNextString( strcmd, " | " );
+}
+
// ****************************************************************************
// Method: QvisSimulationWindow::parseCompositeCMD
//
@@ -1940,6 +1982,10 @@ std::string QvisSimulationWindow::getNextString( std::string &cmd,
str.erase(delim, std::string::npos);
cmd.erase(0, delim+delimiter.length());
}
+ else
+ {
+ cmd.clear();
+ }
return str;
}
