[Kmymoney-devel] QWizard and combobox values

Alvaro Soliverez asoliverez at kde.org
Tue Aug 24 02:20:56 CEST 2010


It is being called.
The code is in the constructor method and I added debug statements to
verify the values at each stage.

------------------------------------------------

PaymentFrequencyWizardPage::PaymentFrequencyWizardPage(QWidget *parent)
    : PaymentFrequencyWizardPageDecl(parent)
{
  // Register the fields with the QWizard and connect the
  // appropriate signals to update the "Next" button correctly

  registerField("paymentFrequencyUnitEdit",
m_paymentFrequencyUnitEdit, "data",
SIGNAL(currentDataChanged(QVariant)));

  qDebug("combo count: %d", m_paymentFrequencyUnitEdit->count());
  qDebug("occur monthly index: %d",
m_paymentFrequencyUnitEdit->findData(QVariant(MyMoneySchedule::OCCUR_MONTHLY),
Qt::UserRole, Qt::MatchExactly));
  m_paymentFrequencyUnitEdit->setCurrentIndex(m_paymentFrequencyUnitEdit->findData(QVariant(MyMoneySchedule::OCCUR_MONTHLY),
Qt::UserRole, Qt::MatchExactly));
  QVariant data =
m_paymentFrequencyUnitEdit->itemData(m_paymentFrequencyUnitEdit->currentIndex(),
Qt::UserRole);
  qDebug("data: %d", data.toInt());

  qDebug("payment frequency occurrence: %d",
field("paymentFrequencyUnitEdit").toInt());
  qDebug("current data: %d", m_paymentFrequencyUnitEdit->currentData().toInt());

}
-----------------------------

And here is the debug output:

combo count: 16
occur monthly index: 8
data: 32
payment frequency occurrence: 0
current data: 32

On Mon, Aug 23, 2010 at 9:10 PM, Fernando Vilas <fvilas at iname.com> wrote:
> On Monday, August 23, 2010 08:52:18 Alvaro Soliverez wrote:
>> Hello all,
>> I'm trying to fix permanently the issue we had with the combobox using
>> the string to match the value instead of the data index. eg.
>> MyMoneySchedule::stringToOccurrence().
>>
>> For that, I need to store the value of data into the fields used by
>> the QWizard, with RegisterField.
>>
>> However, so far I haven't had luck trying to link the field and the
>> widget. It doesn't throw any errors, but the value of the field never
>> changes. Even setting it manually doesn't change the value.
>>
>> Is there a trick or something to it?
>>
>
> If setField() is failing to set it, the changes may not be getting called. If
> you put the code into initializePage(), it will only get called once because
> IndependentPages is set.
>
> --
> Thanks,
> Fernando Vilas
> fvilas at iname.com
>
> _______________________________________________
> KMyMoney-devel mailing list
> KMyMoney-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kmymoney-devel
>
>


More information about the KMyMoney-devel mailing list