[Kmymoney-devel] QWizard and combobox values
Alvaro Soliverez
asoliverez at kde.org
Tue Aug 24 04:27:01 CEST 2010
On Mon, Aug 23, 2010 at 10:54 PM, Fernando Vilas <fvilas at iname.com> wrote:
> On Monday, August 23, 2010 19:20:56 Alvaro Soliverez wrote:
>> 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("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
>>
>
> There is no property of KComboBox or QComboBox named "data". I think you may
> have to look at the currentIndex and currentText properties to get what you
> want. You could read the currentText property and then calculate the
> occurrence from there. Somehow that seems off, though.
Yes, that's what I'm trying to remove, actually.
The combobox is actually a KMyMoneyFrequencyCombo, which now has the
property data. I'm not sure I've configured it correctly, though.
class KMyMoneyFrequencyCombo : public KMyMoneyOccurrenceCombo
{
Q_OBJECT
Q_PROPERTY(QVariant data READ currentData WRITE setCurrentData STORED false)
public:
KMyMoneyFrequencyCombo(QWidget* parent = 0);
int eventsPerYear(void) const;
int daysBetweenEvents(void) const;
QVariant data;
QVariant currentData(void) const;
void setCurrentData(QVariant data);
Q_SIGNALS:
void currentDataChanged(QVariant data);
protected slots:
void slotCurrentDataChanged();
};
I can post you the patch if you want to give it a try.
More information about the KMyMoney-devel
mailing list