[Qt-interest] QDate compare
Robert Wood
robert.wood at apostrophe.co.uk
Fri Apr 29 14:43:17 CEST 2011
Sorry, I am a total idiot. I had simply not put .date() on the end of
ui.fromDateEdit.
Sorry for bothering you. :(
On 29/04/11 13:33, Robert Wood wrote:
> I'm struggling to do something really basic with comparing QDates. I
> just don't understand the documentation, so hope someone can help me!
>
> I have an array of structures, with one of the structure members being
> QDate as below:
>
> struct TransactionStructure
> {
> quint8 user;
> QDate transactionDate;
> QTime transactionTime;
> quint8 drawers;
> };
>
> struct TransactionStructure Transactions[2048];
>
> I have two QDateEdit objects on the ui which the user sets.
>
> I assumed I would be able to do this:
>
> if ((Transactions[i].transactionDate > ui.fromDateEdit) &&
> (Transactions[i].transactionDate < ui.toDateEdit))
>
> But this gives an error. The help goes on about operators such as this:
>
> QDate::operator> ( const QDate & d ) const
>
> I am guessing I need to use this kind of thing, but I just cannot work
> out how to use these operators. Google brings up zillions of hits, but
> they all just repeat the documentation and I can't find a simple example
> of how you actually use this in code.
>
> Would be most grateful if someone could demonstrate how to solve this! :~)
>
More information about the Qt-interest-old
mailing list