I have a QDateEdit
with current date as default and the date format as "dd/MM/yyyy
". When I click on the Month then the MM text should be selected. Also, when I click on the date edit the cursor position of the lineEdit()
returns 0 as the cursor position.
If I click on the Month then the current section returns as Day section (based on date format), since the cursor position is 0. By default the cursor position is 0 So the current Section gives as Day (based on date Format).
By default it happens on the Double Click event. But how can we achieve this on single click?
I have tried using the event filter. But it didn't work.
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent *mouseevent = static_cast<QMouseEvent *>(event);
if(mouseevent != NULL)
{
if(mouseevent->buttons() == Qt::LeftButton)
{
setSelectedSection(currentSection());
}
}
}