From koffice Mon Aug 26 18:33:01 2002 From: Ferdinand Gassauer s Date: Mon, 26 Aug 2002 18:33:01 +0000 To: koffice Subject: Re: Patch for kspread_editors.cc X-MARC-Message: https://marc.info/?l=koffice&m=103038690400877 Norbert Andres wrote: > Thanks for that code. > > Please allow a few days for checking this and putting in (if nobody else > does - unfortunately I have no time for KSpread in the next two days). > What about this idea: prepending the '=' only if there are just numbers in > there and an operator which is not at the beginning. If ' is the first > character don't prepend anything, but remove the ' and pass it on. I will > check tomorrow (at work) how Excel behaves. Well I thougth, that in edit mode you migth start with a formula and end up with a number Example =A4-3 remove A4 it would stay a formula, but should automagicaly be transformed in a negativ number. So if my code realy works (never wrote c or c++ before), it has to be done leaving enter or edit mode (Hitting or eventualy other cursor keys). > > Regards > Norbert > > On Monday 26 August 2002 15:36, Ferdinand Gassauer wrote: >> Norbert Andres wrote: >> > I'm not sure if I like it. I tested it and have one concern: >> > >> > if I wanted to insert just a negative number, e.g. -14, KSpread creates >> > a formula: =-14. Can you improve it to e.g. remove the "=" if there is >> > no other operator? >> > >> > Regards >> > Norbert >> > >> > On Sunday 25 August 2002 15:12, Ferdinand Gassauer wrote: >> >> Hi! >> >> Hope that it is not to late for 1.2 >> >> Please check >> >> I wrote a piece of code, but I do not know where to put it >> it should run on leaving the edit mode. >> >> QString t1( m_pEdit->text()); >> if ( t1[0] == '=' ) >> { >> // check matching pattern - formula with signed values only >> QRegExp exp("(=)([+-])([0-9]+)"); >> int n = exp.search(t1); >> >> if ( n == 1 ) // FIX ME - which value ? >> { >> t1 = m_pEdit->text().right(0); >> if (t1[0] == '+') >> t1 = m_pEdit->text().right(1); >> >> m_pEdit->setText(t1); >> } >> } >> >> apparently my first reply didn't hit the list ____________________________________ koffice mailing list koffice@mail.kde.org To unsubscribe please visit: http://mail.kde.org/mailman/listinfo/koffice