Help to make tab key work in kcurrencycalculator and in budget window

Thomas Baumgart thb at net-bembel.de
Mon Feb 25 12:35:28 GMT 2019


Hi José,

On Montag, 25. Februar 2019 13:14:15 CET José Arthur Benetasso Villanova wrote:

> Hi.
> 
> I'm trying to make the tab key work properly in kcurrencycalculator and in
> budget windows, specially in the budget, that I'm using heavily those days.
> 
> I tried to put code this code in KCurrencyCalculatorPrivate or some
> variation of this, but without any effect:
> 
> diff --git a/kmymoney/dialogs/kcurrencycalculator.cpp
> b/kmymoney/dialogs/kcurrencycalculator.cpp
> index bf5874d2e..19eb744b9 100644
> --- a/kmymoney/dialogs/kcurrencycalculator.cpp
> +++ b/kmymoney/dialogs/kcurrencycalculator.cpp
> @@ -73,6 +73,11 @@ public:
>      m_date(date),
>      m_resultFraction(resultFraction)
>    {
> +      qq->setTabOrder(ui->m_amountButton, ui->m_toAmount);
> +      qq->setTabOrder(ui->m_toAmount, ui->m_dateEdit);
> +      qq->setTabOrder(ui->m_dateEdit, ui->m_updateButton);
> +      qq->setTabOrder(ui->m_updateButton, ui->buttonBox);
> +
>    }
> 
>    ~KCurrencyCalculatorPrivate()
> 
> 
> How can I achieve this? Thanks in advance.

You are calling the setTabOrder too early. The widgets already exist at this point but are not yet 'setup'.

Try to drop your code sequence into init() after the call to

   ui->setupUi(q)

Make sure to replace 'qq' with a simple 'q' at this point. It is the same thing and provided by Q_Q(KCur ...).

In setupUi (it's the generated code from the Qt-Designer ui file), the taborder will be setup according to the instructions made in Qt-Designer and since they are executed *after* the ctor - where you try to setup the order - they will override what you have done. 

You can find this generated file in the build directory as

  ui_kcurrencycalculator.h


Hope this helps. I know, it's not obvious if you have little knowledge about the underlying (Qt-) mechanisms.

-- 

Regards

Thomas Baumgart

https://www.signal.org/       Signal, the better WhatsApp
-------------------------------------------------------------
The Unix Guru's View of Sex:
============================
# unzip; strip; touch; finger; mount; fsck; more; yes; umount; sleep
-------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20190225/68fde3f7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20190225/68fde3f7/attachment.sig>


More information about the KMyMoney-devel mailing list