Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [Solved]QDateEdit - How to restrict user input ?

    General and Desktop
    3
    5
    2823
    Loading More Posts
    • 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.
    • R
      Rahul Das last edited by

      Hi all ,

          How can i restrict the user input to QDateEdit ? How can i stop the user from changing the day, and at the same time , month and year can be changed. 
      

      Setting the Display Format to hide the day wasn't an exact solution in my case. Because i would like to show the date [dd/mm/yyyy] but edit only mm and yy part.


        Rahul Das
      

      1 Reply Last reply Reply Quote 0
      • L
        lgeyer last edited by

        Have you tried subclassing the QDateEdit and reimplementing the validate() method?

        1 Reply Last reply Reply Quote 0
        • R
          Rahul Das last edited by

          No, should try.. Couldnt find any other work around..


            Rahul Das
          

          1 Reply Last reply Reply Quote 0
          • C
            Cayan last edited by

            You can also filter the events, check the current section and deny the input if needed.

            1 Reply Last reply Reply Quote 0
            • R
              Rahul Das last edited by

              Thank you Cyan and Lukas for the hints.

              Found a little dirty work around : Upon the datechanged signal, resetting the day!


                Rahul Das
              

              1 Reply Last reply Reply Quote 0
              • First post
                Last post