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. QDateEdit Is it possible for user to start typing date without auto completing?

QDateEdit Is it possible for user to start typing date without auto completing?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 684 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.
  • P Offline
    P Offline
    psigil
    wrote on last edited by
    #1

    I have a QDateEdit widget where the user can type in a date. The widget also has a calendar popup where they can select a date. The QDateEdit widget has 3 sections: month, date, year.

    Is it possible for the user to start typing a date without the rest of the date auto-completing? Currently, if the user types any value, the rest of the date auto-completes to the first of the month. The date is then validated each time the user switches between month, day, and year sections. Is it possible to not validate the date until the widget loses focus?

    I am new to developing with QT so please bear with me. Thanks!

    JonBJ 1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      From the sounds of what you want you probably don't want to use a QDateEdit. I would instead use a QLineEdit with an input mask. Then no date will be autocompleted and you can verify it yourself using a QDate when it loses focus.

      To answer your question though, no you can't change either of those things without overriding the classes and doing it yourself. There is no built in way to the class.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      4
      • P psigil

        I have a QDateEdit widget where the user can type in a date. The widget also has a calendar popup where they can select a date. The QDateEdit widget has 3 sections: month, date, year.

        Is it possible for the user to start typing a date without the rest of the date auto-completing? Currently, if the user types any value, the rest of the date auto-completes to the first of the month. The date is then validated each time the user switches between month, day, and year sections. Is it possible to not validate the date until the widget loses focus?

        I am new to developing with QT so please bear with me. Thanks!

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @psigil
        I agree with what @ambershark has said about QDateEdit widget.

        For the record: I (my users) could not cope with the way QDateEdit validates as it goes along, and does not allow the date to be left empty. I ended up rolling my own "composite widget": a QLineEdit plus a "..." button to the right of it which invokes a (modal) dialog containing a QCalendarWidget that copies the selected date back into the QLineEdit.

        1 Reply Last reply
        1

        • Login

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