Allow disabling motifs
authorDiane Trout <diane@caltech.edu>
Fri, 30 Jun 2006 00:35:36 +0000 (00:35 +0000)
committerDiane Trout <diane@caltech.edu>
Fri, 30 Jun 2006 00:35:36 +0000 (00:35 +0000)
So this adds a check box that'll let one enable/disable a motif
though i really should think about adding some headers ot my dialog box
or perhaps even use a table widget of somet type.

qui/motif_editor/MotifDetail.cpp
qui/motif_editor/MotifDetail.hpp
qui/motif_editor/MotifEditor.cpp

index 6c76825e3f2b98b99c748a089f5912c37fa6cc98..4774bdfa9880ccbd9b73d5928428723c66ddbb69 100644 (file)
@@ -38,8 +38,9 @@ void MotifDetail::setupWidget()
 {
   QHBoxLayout *layout = new QHBoxLayout;
 
+  enabledButton.setCheckState(Qt::Checked);
+  layout->addWidget(&enabledButton);
   colorButton.setFlat(true);
-    
   colorButton.setPalette(QPalette(qcolor()));
   colorButton.setAutoFillBackground(true);
   connect(&colorButton, SIGNAL(clicked()), this, SLOT(promptColor()));
@@ -97,3 +98,8 @@ void MotifDetail::promptColor()
   Color new_color(new_qcolor.redF(), new_qcolor.greenF(), new_qcolor.blueF());
   setColor(new_color);
 }
+
+bool MotifDetail::enabled() const
+{
+  return (enabledButton.checkState() == Qt::Checked);
+}
index a503a673971c2c5ab661a7f4ce101ce29d4bb1f5..6c882d3f11123f797d02524565ab3a6e73023262 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <string>
 
+#include <QCheckBox>
 #include <QColor>
 #include <QLineEdit>
 #include <QPushButton>
@@ -31,6 +32,9 @@ public:
   Color color() const;
   QColor qcolor() const;
 
+  // is this motif enabled?
+  bool MotifDetail::enabled() const;
+
 public slots:
   void promptColor();
 
@@ -40,6 +44,7 @@ private:
   Color motif_color;
 
   // widgets
+  QCheckBox enabledButton;
   QPushButton colorButton;
   QLineEdit motifText;
   QLineEdit motifName;
index 28e1afe46ce512a0c3411688919d39ff99c78563..288f7134b0a2b1acdd43ea4a558e223a94c54bea 100644 (file)
@@ -54,7 +54,7 @@ void MotifEditor::updateMotifs()
       md_i != motif_details.end();
       ++md_i)
   {
-    if ((*md_i)->motif().size() > 0) {
+    if ((*md_i)->motif().size() > 0 && (*md_i)->enabled()) {
       motifs.push_back((*md_i)->motif());
       colors.push_back((*md_i)->color());
     }