PDA

View Full Version : display date in LineEdit using CalendarWidget.



gauravg
15th September 2011, 12:10
Hello all..
please tell me how to display date in LineEdit or on QDateEdit control using CalendarWidget.
ie( Calendar widget will popup on clicking on calendar icon nea by LineEdit or QDateEdit. On selection of date that specific date should display in LineEdit or QDateEdit control.)



thanks with regards:
gauravg

high_flyer
15th September 2011, 15:28
You can catch the mosuePressEvent() in your QLineEdit, and there popup the Calendar widget, and have the selectionChanged() or as below me suggested the ::clicked ( const QDate & date ) signal trigger a slot in which you get the selected date and set it in your LineEdit.

stampede
15th September 2011, 15:28
Create a slot and connect it to void QCalendarWidget::clicked ( const QDate & date ) (http://doc.qt.nokia.com/stable/qcalendarwidget.html#clicked) signal, then convert the date to string and set this text in line edit.
Edit: QCalendarWidget::selectionChanged () will be better.