[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/office/kmymoney/kmymoney2/widgets
From: Cristian OneČ› <onet.cristian () gmail ! com>
Date: 2009-09-20 10:47:33
Message-ID: 1253443653.413705.1980.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1025976 by conet:
Fixed the kMyMoneyCalculator and other warnings caused by using deprecated API.
M +10 -11 kmymoneycalculator.cpp
M +1 -1 kmymoneycalculator.h
M +18 -17 kmymoneyedit.cpp
M +4 -4 kmymoneyedit.h
--- trunk/playground/office/kmymoney/kmymoney2/widgets/kmymoneycalculator.cpp #1025975:1025976
@@ -26,8 +26,7 @@
#include <QLabel>
#include <QSignalMapper>
#include <QRegExp>
-//Added by qt3to4:
-#include <Q3GridLayout>
+#include <QGridLayout>
#include <QFrame>
#include <QKeyEvent>
@@ -42,20 +41,22 @@
#include "kmymoneycalculator.h"
-kMyMoneyCalculator::kMyMoneyCalculator(QWidget* parent, const char *name)
- : QFrame(parent, name)
+kMyMoneyCalculator::kMyMoneyCalculator(QWidget* parent)
+ : QFrame(parent)
{
m_comma = KGlobal::locale()->monetaryDecimalSymbol()[0];
m_clearOperandOnDigit = false;
- Q3GridLayout* grid = new Q3GridLayout(this, 5, 5, 1, 2);
+ QGridLayout* grid = new QGridLayout(this);
display = new QLabel(this);
- display->setBackgroundColor(QColor("#BDFFB4"));
+ QPalette palette;
+ palette.setColor(display->backgroundRole(), QColor("#BDFFB4"));
+ display->setPalette(palette);
display->setFrameStyle( QFrame::Panel | QFrame::Sunken );
display->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- grid->addMultiCellWidget(display, 0, 0, 0, 4);
+ grid->addWidget(display, 0, 0, 1, 5);
buttons[0] = new KPushButton("0", this);
buttons[1] = new KPushButton("1", this);
@@ -139,8 +140,6 @@
setMinimumSize(width, height);
setMaximumSize(width, height);
-
- show();
}
kMyMoneyCalculator::~kMyMoneyCalculator()
@@ -164,7 +163,7 @@
{
if(operand.length() == 0)
operand = "0";
- if(operand.contains('.', false) == 0)
+ if(operand.contains('.', Qt::CaseInsensitive) == 0)
operand.append('.');
if(operand.length() > 16)
@@ -178,7 +177,7 @@
operand = m_result;
if(operand.length() > 0) {
- if(operand.find('-') != -1)
+ if(operand.indexOf('-') != -1)
operand.replace('-', QString());
else
operand.prepend('-');
--- trunk/playground/office/kmymoney/kmymoney2/widgets/kmymoneycalculator.h #1025975:1025976
@@ -61,7 +61,7 @@
class kMyMoneyCalculator : public QFrame {
Q_OBJECT
public:
- kMyMoneyCalculator(QWidget* parent = 0, const char *name = 0);
+ kMyMoneyCalculator(QWidget* parent = 0);
~kMyMoneyCalculator();
/**
--- trunk/playground/office/kmymoney/kmymoney2/widgets/kmymoneyedit.cpp #1025975:1025976
@@ -48,14 +48,14 @@
#include "kmymoneycalculator.h"
#include "mymoneymoney.h"
-kMyMoneyMoneyValidator::kMyMoneyMoneyValidator(QObject * parent, const char * name) :
- QDoubleValidator(parent, name)
+kMyMoneyMoneyValidator::kMyMoneyMoneyValidator(QObject * parent) :
+ QDoubleValidator(parent)
{
}
kMyMoneyMoneyValidator::kMyMoneyMoneyValidator( double bottom, double top, int decimals,
- QObject * parent, const char * name ) :
- QDoubleValidator(bottom, top, decimals, parent, name)
+ QObject * parent) :
+ QDoubleValidator(bottom, top, decimals, parent)
{
}
@@ -79,17 +79,17 @@
t = l->monetaryThousandsSeparator();
// first, delete p's and t's:
if ( !p.isEmpty() )
- for ( int idx = s.find( p ) ; idx >= 0 ; idx = s.find( p, idx ) )
+ for ( int idx = s.indexOf( p ) ; idx >= 0 ; idx = s.indexOf( p, idx ) )
s.remove( idx, p.length() );
if ( !t.isEmpty() )
- for ( int idx = s.find( t ) ; idx >= 0 ; idx = s.find( t, idx ) )
+ for ( int idx = s.indexOf( t ) ; idx >= 0 ; idx = s.indexOf( t, idx ) )
s.remove( idx, t.length() );
// then, replace the d's and n's
- if ( ( !n.isEmpty() && n.find('.') != -1 ) ||
- ( !d.isEmpty() && d.find('-') != -1 ) ) {
+ if ( ( !n.isEmpty() && n.indexOf('.') != -1 ) ||
+ ( !d.isEmpty() && d.indexOf('-') != -1 ) ) {
// make sure we don't replace something twice:
kWarning() << "KDoubleValidator: decimal symbol contains '-' or "
"negative sign contains '.' -> improve algorithm" << endl;
@@ -97,11 +97,11 @@
}
if ( !d.isEmpty() && d != "." )
- for ( int idx = s.find( d ) ; idx >= 0 ; idx = s.find( d, idx + 1 ) )
+ for ( int idx = s.indexOf( d ) ; idx >= 0 ; idx = s.indexOf( d, idx + 1 ) )
s.replace( idx, d.length(), ".");
if ( !n.isEmpty() && n != "-" )
- for ( int idx = s.find( n ) ; idx >= 0 ; idx = s.find( n, idx + 1 ) )
+ for ( int idx = s.indexOf( n ) ; idx >= 0 ; idx = s.indexOf( n, idx + 1 ) )
s.replace( idx, n.length(), "-" );
// Take care of monetary parens around the value if selected via
@@ -111,24 +111,24 @@
if(l->negativeMonetarySignPosition() == KLocale::ParensAround
|| l->positiveMonetarySignPosition() == KLocale::ParensAround) {
QRegExp regExp("^(\\()?([\\d-\\.]*)(\\))?$");
- if(s.find(regExp) != -1) {
+ if(s.indexOf(regExp) != -1) {
s = regExp.cap(2);
}
}
// check for non numeric values (QDoubleValidator allows an 'e', we don't)
QRegExp nonNumeric("[^\\d-\\.]+");
- if(s.find(nonNumeric) != -1)
+ if(s.indexOf(nonNumeric) != -1)
return Invalid;
// check for minus sign trailing the number
QRegExp trailingMinus("^([^-]*)\\w*-$");
- if(s.find(trailingMinus) != -1) {
+ if(s.indexOf(trailingMinus) != -1) {
s = QString("-%1").arg(trailingMinus.cap(1));
}
// check for the maximum allowed number of decimal places
- int decPos = s.find('.');
+ int decPos = s.indexOf('.');
if(decPos != -1) {
if(decimals() == 0)
return Invalid;
@@ -159,7 +159,7 @@
return rc;
}
-kMyMoneyEdit::kMyMoneyEdit(QWidget *parent, const char *name, const int prec)
+kMyMoneyEdit::kMyMoneyEdit(QWidget *parent, const int prec)
: KHBox(parent)
{
m_prec = prec;
@@ -168,7 +168,7 @@
init();
}
-kMyMoneyEdit::kMyMoneyEdit(const MyMoneySecurity& sec, QWidget *parent, const char *name)
+kMyMoneyEdit::kMyMoneyEdit(const MyMoneySecurity& sec, QWidget *parent)
: KHBox(parent)
{
m_prec = MyMoneyMoney::denomToPrec(sec.smallestAccountFraction());
@@ -219,6 +219,7 @@
m_edit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_calculatorFrame = new KVBox(this);
+ m_calculatorFrame->setWindowFlags(Qt::Popup);
m_calculatorFrame->setFrameStyle(Q3Frame::PopupPanel | Q3Frame::Raised);
m_calculatorFrame->setLineWidth(3);
@@ -381,7 +382,7 @@
}
} else if(m_prec == 0) {
while(s.contains(decimalSymbol)) {
- int pos = s.findRev(decimalSymbol);
+ int pos = s.lastIndexOf(decimalSymbol);
if(pos != -1) {
s.truncate(pos);
}
--- trunk/playground/office/kmymoney/kmymoney2/widgets/kmymoneyedit.h #1025975:1025976
@@ -63,14 +63,14 @@
* (whatever QDoubleValidator uses for that) and parent @p
* parent
*/
- kMyMoneyMoneyValidator( QObject * parent, const char * name=0 );
+ kMyMoneyMoneyValidator( QObject * parent );
/**
* Constuct a locale-aware KDoubleValidator for range [@p bottom,@p
* top] and a precision of @p decimals decimals after the decimal
* point.
*/
kMyMoneyMoneyValidator( double bottom, double top, int decimals,
- QObject * parent, const char * name=0 );
+ QObject * parent );
/**
* Destructs the validator.
*/
@@ -141,8 +141,8 @@
void slotCalculatorOpen(void);
public:
- kMyMoneyEdit(QWidget *parent=0, const char *name=0, const int prec = -2);
- kMyMoneyEdit(const MyMoneySecurity& eq, QWidget *parent=0, const char *name=0);
+ kMyMoneyEdit(QWidget *parent=0, const int prec = -2);
+ kMyMoneyEdit(const MyMoneySecurity& eq, QWidget *parent=0);
~kMyMoneyEdit();
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic