Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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.


  • Qt Champions 2017

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


  • Qt Champions 2017

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


Log in to reply