Skip to content

Commit

Permalink
Refs #7255. Tweaking ThresholdRangeWidget layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Jun 6, 2013
1 parent 2b3cf49 commit dee68ea
Showing 1 changed file with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,46 @@

ThresholdRangeWidget::ThresholdRangeWidget(double min, double max)
{
QGridLayout* headerLayout = new QGridLayout();
headerLayout->addWidget(new QLabel("Thresholds"), 0, 0, 1, 2, Qt::AlignCenter);

QGridLayout* layout = new QGridLayout;
layout->addLayout(headerLayout, 0, 1);
QVBoxLayout* layout = new QVBoxLayout;

//QHLayout* headerLayout = new QGridLayout();
layout->addWidget(new QLabel("Thresholds"), Qt::AlignCenter);
//layout->addLayout(headerLayout);

m_thresholdStrategyComboBox = new QComboBox;
m_thresholdStrategyComboBox->addItem("Ignore Zeros");
m_thresholdStrategyComboBox->addItem("No Threshold Range");
m_thresholdStrategyComboBox->addItem("Median and Below");
m_thresholdStrategyComboBox->addItem("User Defined");

connect(m_thresholdStrategyComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(strategySelectedListener(const QString &)));
layout->addWidget(m_thresholdStrategyComboBox, 1, 0, Qt::AlignLeft);
layout->addWidget(m_thresholdStrategyComboBox, Qt::AlignLeft);

QHBoxLayout* mmLayout = new QHBoxLayout();

mmLayout->addWidget(new QLabel("Min"));

m_minEditBox = new QLineEdit();
m_minEditBox->setValidator(new QDoubleValidator(this));
std::string minValueString = boost::str(boost::format("%0.2f") % min);
m_minEditBox->setText(minValueString.c_str());
layout->addWidget(new QLabel("Min"), 1, 1, Qt::AlignLeft);
layout->addWidget(m_minEditBox, 1, 2, Qt::AlignLeft);
m_minEditBox->setCursorPosition(0);
mmLayout->addWidget(m_minEditBox, Qt::AlignLeft);
m_minEditBox->setDisabled(true); //Disabled by default.
connect(m_minEditBox, SIGNAL(textEdited(const QString &)), this, SLOT(minThresholdListener(const QString &)));


mmLayout->addWidget(new QLabel("Max"));

m_maxEditBox = new QLineEdit();
m_maxEditBox->setValidator(new QDoubleValidator(this));
std::string maxValueString = boost::str(boost::format("%0.2f") % max);
m_maxEditBox->setText(maxValueString.c_str());
m_maxEditBox->setCursorPosition(0);
m_maxEditBox->setDisabled(true); //Disabled by default
layout->addWidget(new QLabel("Max"), 1, 3, Qt::AlignLeft);
layout->addWidget(m_maxEditBox, 1, 4, Qt::AlignLeft);
mmLayout->addWidget(m_maxEditBox, Qt::AlignLeft);
connect(m_maxEditBox, SIGNAL(textEdited(const QString &)), this, SLOT(maxThresholdListener(const QString &)));

layout->addLayout(mmLayout);

this->setLayout(layout);
}

Expand Down Expand Up @@ -74,12 +81,14 @@ void ThresholdRangeWidget::setMaximum(double value)
{
std::string maxValueString = boost::str(boost::format("%0.2f") % value);
m_maxEditBox->setText(maxValueString.c_str());
m_maxEditBox->setCursorPosition(0);
}

void ThresholdRangeWidget::setMinimum(double value)
{
std::string minValueString = boost::str(boost::format("%0.2f") % value);
m_minEditBox->setText(minValueString.c_str());
m_minEditBox->setCursorPosition(0);
}

ThresholdRangeWidget::~ThresholdRangeWidget()
Expand Down

0 comments on commit dee68ea

Please sign in to comment.