]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Update.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Dec 2010 23:16:31 +0000 (23:16 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 20 Dec 2010 23:16:31 +0000 (23:16 +0000)
git-svn-id: https://svn.dealii.org/trunk@23036 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/contrib/parameter_gui/parameter_delegate.cpp

index 6530425656d6e1e74fec050f55fd20dccf0308f3..f0754f4402c153b0baec182e9ee0172c2aad77dc 100644 (file)
@@ -85,7 +85,8 @@ QWidget *ParameterDelegate::createEditor(QWidget *parent,
                rx_dirname("\\b(DirectoryName)\\b"),    
                rx_integer("\\b(Integer)\\b"),
                rx_double("\\b(Double|Float|Floating)\\b"),
-               rx_selection("\\b(Selection)\\b");
+               rx_selection("\\b(Selection)\\b"),
+               rx_bool("\\b(Bool)\\b");
 
       if (rx_string.indexIn (pattern_description) != -1)               // if the type "Anything"
         {
@@ -181,6 +182,24 @@ QWidget *ParameterDelegate::createEditor(QWidget *parent,
 
           combo_box->setEditable(false);
 
+          connect(combo_box, SIGNAL(currentIndexChanged(int)),         // connect editors signal to the closer function
+                  this, SLOT(commit_and_close_editor()));
+
+          return combo_box;
+        }
+      else if (rx_bool.indexIn (pattern_description) != -1)            // and booleans
+        {
+          QComboBox * combo_box = new QComboBox(parent);
+
+          std::vector<std::string> choices;                            // list with the different items
+          choices.push_back(std::string("true"));                      // add true
+          choices.push_back(std::string("false"));                     // and false
+
+          for (unsigned int i=0; i<choices.size(); ++i)                        // add items to the combo box
+            combo_box->addItem (tr(choices[i].c_str()), tr(choices[i].c_str()));
+
+          combo_box->setEditable(false);
+
           connect(combo_box, SIGNAL(currentIndexChanged(int)),         // connect editors signal to the closer function
                   this, SLOT(commit_and_close_editor()));
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.