I have a QDateTimeEdit and user should select a date with it. However, I need to select the last day of each month. So, for example if user select 3rd of March, I should set date to 31th of March.
I try to do this in the slot of dateChanged(const QDate&)
signal. But when I call setDate()
function, it causes the slot to be called once more.
Here is the sample code
connect(m_pDateEdit, SIGNAL(dateChanged(const QDate&)), this, SLOT(OnDateChanged(const QDate&)));
void MyClass::OnDateChanged(const QDate& date)
{
const bool b = m_pDateEdit->blockSignals(true);
// THIS LINE CAUSES TO THIS SLOT TO BE CALLED TWICE
m_pDateEdit->setDate(QDate(date.year(), date.month(), date.daysInMonth()));
CallSomeFunction();
m_pDateEdit->blockSignals(b)
}
Anything I'm missing? Any Ideas?
Thank you for your time!