Restrict date selection in QDateEdit



  • I have two QDateEdit widgets in my application. I have set values of these widgets from my code.

    I need to restrict the user in date selection. The user should not be able to select date before the startdate and after the end date. How can I implement this.

    Can I disable dates in QDateEdit after or before a certain date?
    I could not find selectionChanged signal for QDateEdit.

    Any help would be highly appreciated.



  • It is inherited from SpinBox and QDateTimeEdit. Did you try setting the maximumDate and minimumDate ? Overring some of the spinbox methods may help you.



  • Try this. It works.
    QDateEdit tim;
    tim.setMaximumDate(QDate(2010,1,1));
    tim.show()


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.