Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QDateTimeEdit increments
Forum Update on Monday, May 27th 2025

QDateTimeEdit increments

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 854 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.
  • B Offline
    B Offline
    BlueBreezy
    wrote on last edited by
    #1

    How do I put an increment for 30 minutes on the QDateTimeWidget so that the user can only increment time by half an hour for example, 10:30 to 11:00 and so on.

    JonBJ 1 Reply Last reply
    0
    • B BlueBreezy

      How do I put an increment for 30 minutes on the QDateTimeWidget so that the user can only increment time by half an hour for example, 10:30 to 11:00 and so on.

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

      @BlueBreezy
      I assume that whatever you can do will be via https://doc.qt.io/qt-5/qdatetimeedit.html#stepEnabled and https://doc.qt.io/qt-5/qdatetimeedit.html#stepBy.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BlueBreezy
        wrote on last edited by
        #3

        will this work using Pyqt5

        JonBJ 1 Reply Last reply
        0
        • B BlueBreezy

          will this work using Pyqt5

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

          @BlueBreezy
          Yes. They are both virtual, you would have to sub-class and override. Whether they are the right to thing to try to use I'm not sure. There doesn't seem to be anything obvious (to me) to achieve what you want.

          P.S.
          My suspicions conformed by https://stackoverflow.com/questions/47188200/qtimeedit-how-to-increment-to-next-hour-when-minutes-are-incremented. Only example I've found, see how stepBy is being overridden. I think that question/answer applies to your situation. Or similarly https://stackoverflow.com/questions/48150522/qtimeedit-change-only-hours.

          B 1 Reply Last reply
          0
          • JonBJ JonB

            @BlueBreezy
            Yes. They are both virtual, you would have to sub-class and override. Whether they are the right to thing to try to use I'm not sure. There doesn't seem to be anything obvious (to me) to achieve what you want.

            P.S.
            My suspicions conformed by https://stackoverflow.com/questions/47188200/qtimeedit-how-to-increment-to-next-hour-when-minutes-are-incremented. Only example I've found, see how stepBy is being overridden. I think that question/answer applies to your situation. Or similarly https://stackoverflow.com/questions/48150522/qtimeedit-change-only-hours.

            B Offline
            B Offline
            BlueBreezy
            wrote on last edited by
            #5

            @JonB ok thanks I will check

            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