00001 /***************************************************************************
00002 doublespinbox.cpp - double values spinbox
00003 -------------------
00004 begin : Fri Apr 13 2001
00005 copyright : (C) 2001 by Claudiu Costin
00006 email : claudiuc@geocities.com
00007 ***************************************************************************/
00008
00009 /***************************************************************************
00010 * *
00011 * This program is free software; you can redistribute it and/or modify *
00012 * it under the terms of the GNU General Public License as published by *
00013 * the Free Software Foundation; either version 2 of the License, or *
00014 * (at your option) any later version. *
00015 * *
00016 ***************************************************************************/
00017
00018 #include <qlineedit.h>
00019 #include "doublespinbox.h"
00020
00021
00022 DoubleSpinBox::DoubleSpinBox(QWidget *parent, const char *name) :
00023 QSpinBox(parent,name)
00024 {
00025 editor()->setAlignment(Qt::AlignRight);
00026 }
00027
00028 DoubleSpinBox::DoubleSpinBox(int minValue, int maxValue, int step, QWidget *parent, const char *name) :
00029 QSpinBox(minValue,maxValue,step,parent,name)
00030 {
00031 editor()->setAlignment(Qt::AlignRight);
00032 }
00033
00034 QString DoubleSpinBox::mapValueToText(int value) {
00035 return QString("%1.%2").arg(value/10).arg(value%10);
00036 }
00037
00038 int DoubleSpinBox::mapTextToValue(bool *ok) {
00039 bool foo; foo=ok;
00040 return int(text().toFloat()*10);
00041 }
00042
00043
1.2.15