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. [Solved]QDateEdit - How to restrict user input ?
Forum Updated to NodeBB v4.3 + New Features

[Solved]QDateEdit - How to restrict user input ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.1k Views 1 Watching
  • 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 Offline
    R Offline
    Rahul Das
    wrote on last edited by
    #1

    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.


    Declaration of (Platform) independence.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rahul Das
        wrote on last edited by
        #3

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


        Declaration of (Platform) independence.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Cayan
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rahul Das
            wrote on last edited by
            #5

            Thank you Cyan and Lukas for the hints.

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


            Declaration of (Platform) independence.

            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