From 6db5a8de6d687d72c6ce5eac867b3d28f06c9261 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Fri, 30 Jun 2006 00:35:36 +0000 Subject: [PATCH] Allow disabling motifs 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 | 8 +++++++- qui/motif_editor/MotifDetail.hpp | 5 +++++ qui/motif_editor/MotifEditor.cpp | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qui/motif_editor/MotifDetail.cpp b/qui/motif_editor/MotifDetail.cpp index 6c76825..4774bdf 100644 --- a/qui/motif_editor/MotifDetail.cpp +++ b/qui/motif_editor/MotifDetail.cpp @@ -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); +} diff --git a/qui/motif_editor/MotifDetail.hpp b/qui/motif_editor/MotifDetail.hpp index a503a67..6c882d3 100644 --- a/qui/motif_editor/MotifDetail.hpp +++ b/qui/motif_editor/MotifDetail.hpp @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -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; diff --git a/qui/motif_editor/MotifEditor.cpp b/qui/motif_editor/MotifEditor.cpp index 28e1afe..288f713 100644 --- a/qui/motif_editor/MotifEditor.cpp +++ b/qui/motif_editor/MotifEditor.cpp @@ -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()); } -- 2.30.2