Mercurial > hg > octave-avbm
changeset 13474:3b7573c783cc
Build data source selection.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Wed, 20 Apr 2011 11:35:29 +0200 |
parents | ba1f40c33359 |
children | d65b8f5373b4 |
files | gui/src/Plot2dWidget.cpp gui/src/Plot2dWidget.h |
diffstat | 2 files changed, 67 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/Plot2dWidget.cpp +++ b/gui/src/Plot2dWidget.cpp @@ -3,6 +3,7 @@ #include <QHBoxLayout> #include <QPushButton> #include <QTimer> +#include <QLabel> #include <math.h> Plot2dView::Plot2dView(QWidget *parent) @@ -121,6 +122,14 @@ construct(); } +void Plot2dWidget::dataSourceTypeChanged(QString type) { + if(type == "Sampled") { + m_dataSourceStackedWidget->setCurrentIndex(0); + } else if(type == "Parameterized") { + m_dataSourceStackedWidget->setCurrentIndex(1); + } +} + void Plot2dWidget::construct() { QVBoxLayout *layout = new QVBoxLayout(); m_plot2dView = new Plot2dView(this); @@ -131,24 +140,68 @@ m_tabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); layout->addWidget(m_tabWidget); + m_generalTab = new QWidget(this); m_dataSourceTab = new QWidget(this); m_verticalAxisTab = new QWidget(this); m_horizontalAxisTab = new QWidget(this); + m_tabWidget->addTab(m_generalTab, tr("General")); m_tabWidget->addTab(m_dataSourceTab, tr("Data Source")); m_tabWidget->addTab(m_verticalAxisTab, tr("Vertical Axis")); m_tabWidget->addTab(m_horizontalAxisTab, tr("Horizontal Axis")); + // Build general tab. + QHBoxLayout *generalTabLayout = new QHBoxLayout(); + m_generalTab->setLayout(generalTabLayout); + // Build data source tab. QHBoxLayout *dataSourceTabLayout = new QHBoxLayout(); - m_dataSourceTypeComboBox = new QComboBox(this); + m_dataSourceTypeComboBox->addItem(tr("Sampled")); m_dataSourceTypeComboBox->addItem(tr("Parameterized")); - m_dataSourceTypeComboBox->addItem(tr("Sampled")); + + m_dataSourceStackedWidget = new QStackedWidget(this); + m_sampledFromLineEdit = new QLineEdit("0", this); + m_sampledToLineEdit = new QLineEdit("4096", this); + m_parameterizedFromLineEdit = new QLineEdit("0.0", this); + m_parameterizedToLineEdit = new QLineEdit("1.0", this); + + m_sampledFromLineEdit->setAlignment(Qt::AlignRight); + m_sampledToLineEdit->setAlignment(Qt::AlignRight); + m_parameterizedFromLineEdit->setAlignment(Qt::AlignRight); + m_parameterizedToLineEdit->setAlignment(Qt::AlignRight); + + QWidget *sampledDataSourceRange = new QWidget(this); + QHBoxLayout *sampledDataSourceLayout = new QHBoxLayout(); + sampledDataSourceLayout->addWidget(new QLabel(tr("From sample"), this)); + sampledDataSourceLayout->addWidget(m_sampledFromLineEdit); + sampledDataSourceLayout->addWidget(new QLabel(tr("to sample"), this)); + sampledDataSourceLayout->addWidget(m_sampledToLineEdit); + sampledDataSourceLayout->addWidget(new QLabel(".", this)); + sampledDataSourceLayout->setMargin(0); + sampledDataSourceRange->setLayout(sampledDataSourceLayout); + + QWidget *parameterizedDataSourceRange = new QWidget(this); + QHBoxLayout *parameterizedDataSourceLayout = new QHBoxLayout(); + parameterizedDataSourceLayout->addWidget(new QLabel(tr("From value"), this)); + parameterizedDataSourceLayout->addWidget(m_parameterizedFromLineEdit); + parameterizedDataSourceLayout->addWidget(new QLabel(tr("to value"), this)); + parameterizedDataSourceLayout->addWidget(m_parameterizedToLineEdit); + parameterizedDataSourceLayout->addWidget(new QLabel(".", this)); + parameterizedDataSourceLayout->setMargin(0); + parameterizedDataSourceRange->setLayout(parameterizedDataSourceLayout); + + m_dataSourceStackedWidget->addWidget(sampledDataSourceRange); + m_dataSourceStackedWidget->addWidget(parameterizedDataSourceRange); + + m_refreshDataRangeButton = new QPushButton(tr("Refresh"), this); + dataSourceTabLayout->addWidget(new QLabel(tr("Type:"), this)); dataSourceTabLayout->addWidget(m_dataSourceTypeComboBox); - dataSourceTabLayout->addStretch(); + dataSourceTabLayout->addWidget(m_dataSourceStackedWidget); + dataSourceTabLayout->addWidget(m_refreshDataRangeButton); m_dataSourceTab->setLayout(dataSourceTabLayout); layout->setMargin(0); setLayout(layout); + connect(m_dataSourceTypeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(dataSourceTypeChanged(QString))); }
--- a/gui/src/Plot2dWidget.h +++ b/gui/src/Plot2dWidget.h @@ -4,9 +4,12 @@ #include <QWidget> #include <QGLWidget> #include <QTabWidget> +#include <QStackedWidget> #include <QComboBox> #include <QWheelEvent> #include <QMouseEvent> +#include <QLineEdit> +#include <QPushButton> class Plot2dView : public QGLWidget { Q_OBJECT @@ -45,17 +48,24 @@ signals: public slots: + void dataSourceTypeChanged(QString type); private: void construct(); Plot2dView *m_plot2dView; QTabWidget *m_tabWidget; + QWidget *m_generalTab; QWidget *m_dataSourceTab; QWidget *m_verticalAxisTab; QWidget *m_horizontalAxisTab; QComboBox *m_dataSourceTypeComboBox; - + QStackedWidget *m_dataSourceStackedWidget; + QLineEdit *m_sampledFromLineEdit; + QLineEdit *m_sampledToLineEdit; + QLineEdit *m_parameterizedFromLineEdit; + QLineEdit *m_parameterizedToLineEdit; + QPushButton *m_refreshDataRangeButton; }; #endif // PLOT2DWIDGET_H