Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <ui_PlotAxisConfigWidget.h>
00020
00021 #include "rqt_multiplot/PlotAxisConfigWidget.h"
00022
00023 namespace rqt_multiplot {
00024
00025
00026
00027
00028
00029 PlotAxisConfigWidget::PlotAxisConfigWidget(QWidget* parent) :
00030 QWidget(parent),
00031 ui_(new Ui::PlotAxisConfigWidget()),
00032 config_(0) {
00033 ui_->setupUi(this);
00034
00035 connect(ui_->lineEditTitle, SIGNAL(editingFinished()),
00036 this, SLOT(lineEditTitleEditingFinished()));
00037 connect(ui_->checkBoxTitleAuto, SIGNAL(stateChanged(int)),
00038 this, SLOT(checkBoxTitleAutoStateChanged(int)));
00039 connect(ui_->checkBoxTitleVisible, SIGNAL(stateChanged(int)),
00040 this, SLOT(checkBoxTitleVisibleStateChanged(int)));
00041 }
00042
00043 PlotAxisConfigWidget::~PlotAxisConfigWidget() {
00044 delete ui_;
00045 }
00046
00047
00048
00049
00050
00051 void PlotAxisConfigWidget::setConfig(PlotAxisConfig* config) {
00052 if (config != config_) {
00053 if (config_) {
00054 disconnect(config_, SIGNAL(titleTypeChanged(int)),
00055 this, SLOT(configTitleTypeChanged(int)));
00056 disconnect(config_, SIGNAL(customTitleChanged(const QString&)),
00057 this, SLOT(configCustomTitleChanged(const QString&)));
00058 disconnect(config_, SIGNAL(titleVisibleChanged(bool)),
00059 this, SLOT(configTitleVisibleChanged(bool)));
00060 }
00061
00062 config_ = config;
00063
00064 if (config) {
00065 connect(config, SIGNAL(titleTypeChanged(int)),
00066 this, SLOT(configTitleTypeChanged(int)));
00067 connect(config, SIGNAL(customTitleChanged(const QString&)),
00068 this, SLOT(configCustomTitleChanged(const QString&)));
00069 connect(config, SIGNAL(titleVisibleChanged(bool)),
00070 this, SLOT(configTitleVisibleChanged(bool)));
00071
00072 configTitleTypeChanged(config->getTitleType());
00073 configCustomTitleChanged(config->getCustomTitle());
00074 configTitleVisibleChanged(config->isTitleVisible());
00075 }
00076 }
00077 }
00078
00079 PlotAxisConfig* PlotAxisConfigWidget::getConfig() const {
00080 return config_;
00081 }
00082
00083
00084
00085
00086
00087 void PlotAxisConfigWidget::configTitleTypeChanged(int type) {
00088 ui_->checkBoxTitleAuto->setCheckState((type == PlotAxisConfig::AutoTitle) ?
00089 Qt::Checked : Qt::Unchecked);
00090 }
00091
00092 void PlotAxisConfigWidget::configCustomTitleChanged(const QString& title) {
00093 ui_->lineEditTitle->setText(title);
00094 }
00095
00096 void PlotAxisConfigWidget::configTitleVisibleChanged(bool visible) {
00097 ui_->checkBoxTitleVisible->setCheckState(visible ? Qt::Checked :
00098 Qt::Unchecked);
00099 }
00100
00101 void PlotAxisConfigWidget::checkBoxTitleAutoStateChanged(int state) {
00102 ui_->lineEditTitle->setEnabled(state != Qt::Checked);
00103
00104 if (config_)
00105 config_->setTitleType((state == Qt::Checked) ? PlotAxisConfig::AutoTitle :
00106 PlotAxisConfig::CustomTitle);
00107 }
00108
00109 void PlotAxisConfigWidget::lineEditTitleEditingFinished() {
00110 if (config_)
00111 config_->setCustomTitle(ui_->lineEditTitle->text());
00112 }
00113
00114 void PlotAxisConfigWidget::checkBoxTitleVisibleStateChanged(int state) {
00115 if (config_)
00116 config_->setTitleVisible(state == Qt::Checked);
00117 }
00118
00119 }