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. entering date field in calibre
Forum Updated to NodeBB v4.3 + New Features

entering date field in calibre

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 1.5k 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.
  • Pl45m4P Pl45m4

    @RedOchre

    Hi and welcome,

    from your post I assume you are just a user of calibre app and no Qt dev, right?!

    Can we please have Jun, Jul & Sep accepted as valid input for month names?

    The question is:
    What widgets do "they" (calibre developers) use there?! Standard widgets or self-developed ones.

    That being said, I don't think it's a Qt issue ifself rather than how calibre implemented the calendar logic and defined valid inputs.

    Edit:

    Found the repo on github:

    • https://github.com/kovidgoyal/calibre/tree/master

    Ok, they are using PySide6 and QCalendar / QCalendarWidget.
    I guess they have to change some settings to allow three letter inputs for month names.

    (@Steven123 here would be an example of a Python-based app using Qt frontend)

    R Offline
    R Offline
    RedOchre
    wrote on last edited by
    #3

    @Pl45m4 said in entering date field in calibre:

    @Steven123

    Yes, I am just a user of calibre. I have posted your reply on their support page.
    Thank you.

    Pl45m4P 1 Reply Last reply
    0
    • R RedOchre

      @Pl45m4 said in entering date field in calibre:

      @Steven123

      Yes, I am just a user of calibre. I have posted your reply on their support page.
      Thank you.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #4

      @RedOchre

      Another thought:
      Are you sure there is something wrong?
      Maybe the month field is "three letters min, four letters at max"?!
      So the automatic jump to the next input happens after a maximum number of four characters were inserted, and then it still displayed the more or less standard short form for months in three letters.

      Haven't checked the code any deeper, but for example an input validator can be different from what is displayed.

      So both

      Jun (3 letters, then manually tabbing or moving to next input)
      June (4 letters, max letter limit reached, cursor jumps/tabs automatically to next field)
      

      would result in correctly setting the 6th month of the year, while

      Jun
      

      is displayed (based on your app's and OS' locale/language config)


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #5

        A QDateEdit does not allow entering the month by name so it must be a custom widget.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        JonBJ 1 Reply Last reply
        0
        • R Offline
          R Offline
          RedOchre
          wrote on last edited by
          #6

          I posted your reply to calibre support and they replied with:

          It's likely locale dependent and calibre uses bog standard qt provided widgets for this, no custom settings.

          I'm running on a MacBook Pro Sequoia 15.5 with Region: Australia and Date format: yyyy-mm-dd.

          • I have changed Date format to dd/mm/yyyy but issue is same
          • I have changed Region to United Kingdom but issue is same
          • I have changed Region to United States but issue is same
          1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            A QDateEdit does not allow entering the month by name so it must be a custom widget.

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

            @Christian-Ehrlicher said in entering date field in calibre:

            A QDateEdit does not allow entering the month by name so it must be a custom widget.

            Actually it does! (Though docs do not mention it and I cannot find a single post on web asking about month-name-text-input.) Although I have not tried to install the massive calibre project I can guess they are using QDateTimeEdit.setDisplayFormat("MMM d yy") (or similar, anything with MMM). Not only does this cause the month to be displayed by name instead of number, it also allows user to type first alphabetic characters of a month to change to that month. I see same behaviour whether QDateTimeEdit or just QDateEdit.

            Then I do see exactly the same behaviour/"inconsistency" as @RedOchre reports: if I type in, say, Jan as I hit the n at the end the cursor jumps on to the next field, but if I type in, say, Sep nothing happens when I type the p, but if I then proceed to type t the full Sept appear in the month and only then does the cursor move on to the next field. So some months require 3 characters for "auto-complete" while some require 4. As reported by the OP, and for no apparent reason. I did not go delving into the source of QDate[Time]Edit. [Actually I have had a look around https://codebrowser.dev/qt5/qtbase/src/widgets/widgets/qdatetimeedit.cpp.html now but did not spot anything about where the conversion/parsing of input month names is happening, so over to you Christian :) ]

            BTW I am Ubuntu and Qt 6.4 or 6.5 I think, and of course UK system format, so it does happen on other platforms than OP's MacOS.

            1 Reply Last reply
            1
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by Christian Ehrlicher
              #8

              With Qt6.9 I can only reproduce it with September:

              QApplication a(argc, argv);
              QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedKingdom));
              QDateTimeEdit edit;
              edit.setDisplayFormat("MMM d yy");
              edit.show();
              return a.exec();
              

              /edit: and this is correct according to https://web.library.yale.edu/cataloging/months - it's Sept, not Sep

              So all is fine here with Qt6.9

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              JonBJ 1 Reply Last reply
              2
              • Christian EhrlicherC Christian Ehrlicher

                With Qt6.9 I can only reproduce it with September:

                QApplication a(argc, argv);
                QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedKingdom));
                QDateTimeEdit edit;
                edit.setDisplayFormat("MMM d yy");
                edit.show();
                return a.exec();
                

                /edit: and this is correct according to https://web.library.yale.edu/cataloging/months - it's Sept, not Sep

                So all is fine here with Qt6.9

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

                @Christian-Ehrlicher
                I did not try any months other than Jan and Sep! I agree with you: unlike @RedOchre's

                However, if the month is June, July or September, I need to enter 4 chars before the cursor moves

                I find Jun & Jul fine, only Sep does not work.

                /edit: and this is correct according to https://web.library.yale.edu/cataloging/months - it's Sept, not Sep

                Indeed! But

                • I am interested what is that document and how does it relate to what code which Qt is using for QDate[Time]Edit
                • That document actually indicates that June & July should require 4 letters like Sept, which is as the OP reports but not as you & find.
                • Why in the world should e.g. Sept require 4 letters as its abbreviation in any case?!
                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  June and July work with Qt6. 9

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  JonBJ 1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    June and July work with Qt6. 9

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

                    @Christian-Ehrlicher
                    I agreed with that above, at my Qt 6.4 or 6.5 too. But Sept is still required, why, and ooi what call where is Qt using which uses this "month abbreviation" in code?

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      See https://doc.qt.io/qt-6/qcalendar.html#monthName

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      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