Commit fb6f6e4f authored by Stéphane Albert's avatar Stéphane Albert
Browse files

BUG: MANTIS-1138: Improved color-band dynamics editing (refresh only when...

BUG: MANTIS-1138: Improved color-band dynamics editing (refresh only when editing is finished; set string-double conversion precision to max 17 significant digits as specified in IEEE 754; Fixed minimal size of QLineEdit to display at least 7 digits).
parent d1eaa1dc
......@@ -37,6 +37,10 @@
#include "Core/mvdAlgorithm.h"
#include "Gui/mvdDoubleValidator.h"
// Used for QString::number() calls. By default, QString::number()
// uses a 6 digit precision.
#define MAX_SIGNIFICANT_DIGITS 17
namespace mvd
{
/*
......@@ -120,8 +124,10 @@ void
ColorBandDynamicsWidget
::SetLowIntensity( double value )
{
// qDebug() << this << "::SetLowIntensity(" << value << ")";
QString number(
QString::number( value, 'g', m_LowIntensityValidator->decimals() )
QString::number( value, 'g', MAX_SIGNIFICANT_DIGITS )
);
assert( !number.isEmpty() );
......@@ -144,8 +150,10 @@ void
ColorBandDynamicsWidget
::SetHighIntensity( double value )
{
// qDebug() << this << "::SetHighIntensity(" << value << ")";
QString number(
QString::number( value, 'g', m_HighIntensityValidator->decimals() )
QString::number( value, 'g', MAX_SIGNIFICANT_DIGITS )
);
assert( !number.isEmpty() );
......@@ -262,19 +270,20 @@ ColorBandDynamicsWidget
return m_Channel;
}
/*******************************************************************************/
/* SLOTS */
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
void
ColorBandDynamicsWidget
::on_lowIntensityLineEdit_textChanged( const QString& text )
::on_lowIntensityLineEdit_editingFinished()
{
// qDebug() << this << "::on_lowIntensityLineEdit_textChanged(" << text << ")";
// qDebug() << this << "::on_lowIntensityLineEdit_editingFinished()";
assert( m_UI!=NULL );
assert( m_UI->lowIntensityLineEdit!=NULL );
bool isOk = true;
double value = text.toDouble( &isOk );
double value = m_UI->lowIntensityLineEdit->text().toDouble( &isOk );
if( !isOk )
{
......@@ -293,12 +302,15 @@ ColorBandDynamicsWidget
/*****************************************************************************/
void
ColorBandDynamicsWidget
::on_highIntensityLineEdit_textChanged( const QString& text )
::on_highIntensityLineEdit_editingFinished()
{
// qDebug() << this << "::on_lowIntensityLineEdit_textChanged(" << text << ")";
// qDebug() << this << "::on_highIntensityLineEdit_editingFinished()";
assert( m_UI!=NULL );
assert( m_UI->highIntensityLineEdit!=NULL );
bool isOk = true;
double value = text.toDouble( &isOk );
double value = m_UI->highIntensityLineEdit->text().toDouble( &isOk );
if( !isOk )
{
......
......@@ -255,8 +255,8 @@ private:
//
// Slots.
private slots:
void on_lowIntensityLineEdit_textChanged( const QString& );
void on_highIntensityLineEdit_textChanged( const QString& );
void on_lowIntensityLineEdit_editingFinished();
void on_highIntensityLineEdit_editingFinished();
void on_lowQuantileSpinBox_valueChanged( double );
void on_highQuantileSpinBox_valueChanged( double );
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>254</width>
<width>270</width>
<height>88</height>
</rect>
</property>
......@@ -141,6 +141,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
......@@ -229,22 +235,6 @@
</item>
</layout>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="lowIntensityLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="lowQuantileSpinBox">
<property name="enabled">
......@@ -401,6 +391,28 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="lowIntensityLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
......
......@@ -1134,7 +1134,7 @@ ColorDynamicsController
void
ColorDynamicsController
::OnHighIntensityChanged( RgbwChannel channel, double value )
{
{
// qDebug()
// << this
// << "::OnHighIntensityChanged("
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment