00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "qdoublespinbox2.h"
00022
00023
00025
00028 QDoubleSpinBox2::QDoubleSpinBox2(QWidget *parent) : QDoubleSpinBox(parent) {
00029 _depura("QDoubleSpinBox2::QDoubleSpinBox2", 0);
00030 installEventFilter(this);
00031 setAlignment(Qt::AlignRight);
00032 setButtonSymbols(QAbstractSpinBox::PlusMinus);
00033 _depura("EDN QDoubleSpinBox2::QDoubleSpinBox2", 0);
00034 }
00035
00036
00038
00040 QDoubleSpinBox2::~QDoubleSpinBox2() {
00041 _depura("QDoubleSpinBox2::~QDoubleSpinBox2", 0);
00042 _depura("END QDoubleSpinBox2::~QDoubleSpinBox2", 0);
00043 }
00044
00046
00049 QString const QDoubleSpinBox2::text() {
00050 _depura("QDoubleSpinBox2::text", 0);
00051 QString a = QDoubleSpinBox::text();
00052
00053 _depura("END QDoubleSpinBox2::text", 0);
00054 return a;
00055 }
00056
00057
00059
00062 void QDoubleSpinBox2::setValue(double valor) {
00063 _depura("QDoubleSpinBox2::setValue", 0);
00064 QDoubleSpinBox::setValue(valor);
00065 _depura("END QDoubleSpinBox2::setValue", 0);
00066 }
00067
00069
00074 bool QDoubleSpinBox2::eventFilter(QObject *obj, QEvent *event) {
00075 _depura("QDoubleSpinBox2::eventFilter", 0);
00077 if (event->type() == QEvent::KeyPress) {
00078 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
00079 int key = keyEvent->key();
00080 Qt::KeyboardModifiers mod = keyEvent->modifiers();
00081 switch (key) {
00082 case Qt::Key_Period:
00085 QLineEdit *linea = QAbstractSpinBox::lineEdit();
00087 QString strLinea = linea->text();
00088 if (!strLinea.contains(",", Qt::CaseInsensitive)) {
00089 linea->setText(linea->text() + ",");
00090 }
00091 return TRUE;
00092 }
00093 }
00094 _depura("END QDoubleSpinBox2::eventFilter", 0);
00095 return QDoubleSpinBox::eventFilter(obj, event);
00096 }
00097