~ubuntu-branches/ubuntu/maverick/ktechlab/maverick

« back to all changes in this revision

Viewing changes to src/gui/doublespinbox.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2009-02-09 00:28:49 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090209002849-9o8eqqiczqo4vat3
Tags: 0.3.6-4
modified debian/rules so it does not invoke make if there is no 
Makefile
Closes: #514552

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***************************************************************************
2
 
 *   Copyright (C) 2003-2004 by David Saxton                               *
 
2
 *   Copyright (C) 2003-2006 by David Saxton                               *
3
3
 *   david@bluehaze.org                                                    *
4
4
 *                                                                         *
5
5
 *   This program is free software; you can redistribute it and/or modify  *
40
40
        m_minAbsValue = minAbs;
41
41
        m_queuedSuffix = QString::null;
42
42
        
 
43
        init();
 
44
        setValue( value );
 
45
}
 
46
 
 
47
 
 
48
DoubleSpinBox::DoubleSpinBox( QWidget * parent )
 
49
        : QSpinBox( parent )
 
50
{
 
51
        m_lastEmittedValue = 0;
 
52
        m_minValue = 0;
 
53
        m_maxValue = 1e9;
 
54
        m_minAbsValue = 1e-9;
 
55
        m_queuedSuffix = QString::null;
 
56
        
 
57
        init();
 
58
        setValue( 0 );
 
59
}
 
60
 
 
61
 
 
62
void DoubleSpinBox::init()
 
63
{
43
64
        editor()->setAlignment( Qt::AlignRight );
44
65
        
45
66
        connect( this, SIGNAL(valueChanged(int)), this, SLOT(checkIfChanged()) );
46
67
        QSpinBox::setMinValue( -(1<<30) );
47
68
        QSpinBox::setMaxValue( +(1<<30) );      
48
 
        setValue( value );
49
69
        
50
70
        setValidator( 0 );
51
71
}
64
84
 
65
85
void DoubleSpinBox::setValue( double value )
66
86
{
 
87
        if ( this->value() == value )
 
88
                return;
 
89
        
67
90
        if ( value > maxValue() )
68
91
                value = maxValue();
69
92
        
101
124
void DoubleSpinBox::setQueuedSuffix()
102
125
{
103
126
        bool changed = false;
104
 
        if ( !m_queuedSuffix.isNull() && suffix() != m_queuedSuffix )
 
127
        if ( !m_queuedSuffix.isNull() && suffix().simplifyWhiteSpace() != m_queuedSuffix.simplifyWhiteSpace() )
105
128
        {
106
129
                setSuffix( m_queuedSuffix );
107
130
                changed = true;