Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Restrict date selection in QDateEdit

Restrict date selection in QDateEdit

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tesmai4
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

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

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

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

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved