Neat; so he'd set a QRegExp that only accepts input when it has the two decimal points, and he'd reimplement fixup?
If so, it's a better version of my answer => Jesse_mark will still need to subclass
As a side note, I wouldn't be afraid of subclassing. You can fit all of your code into the header file probably:
#include <QLineEdit>
public:
//constructor/destructors go here
//something close to this. Syntax might be off a bit
void fixup
( QString & input
) const { input
= input.
number(input,
'f',
2);
} };
#include <QLineEdit>
class MyLineEdit :public QLineEdit{
public:
//constructor/destructors go here
//something close to this. Syntax might be off a bit
void fixup ( QString & input ) const { input = input.number(input,'f',2);}
};
To copy to clipboard, switch view to plain text mode
Then just promote in your UI if you need to. It's not scary
Bookmarks