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. QCalendarWidget Set day name manually

QCalendarWidget Set day name manually

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 659 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.
  • B Offline
    B Offline
    basimchowdhury
    wrote on last edited by
    #1

    I am trying to set each of the daynames on the horizontal header of the QCalendarWidget manually. I was able to do this with the month names in the month menu by accessing each of the QActions and setting its text to what I wanted. I want to do the same for the day names, such as Mon, Tue, etc to something fictional. How can I do this?

    JonBJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      AFAIK, there's no easy way for that. QCalendarWidget uses a custom model that relies on the locale to provide the name of the day.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • B basimchowdhury

        I am trying to set each of the daynames on the horizontal header of the QCalendarWidget manually. I was able to do this with the month names in the month menu by accessing each of the QActions and setting its text to what I wanted. I want to do the same for the day names, such as Mon, Tue, etc to something fictional. How can I do this?

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

        @basimchowdhury
        Can you not use setLocale() to achieve what you desire for both month & day names?

        B 1 Reply Last reply
        0
        • JonBJ JonB

          @basimchowdhury
          Can you not use setLocale() to achieve what you desire for both month & day names?

          B Offline
          B Offline
          basimchowdhury
          wrote on last edited by
          #4

          @JonB I am aware if setLocale() but what I need to do is set the names of the day to anything else, even a made up language for example. Isnt there a way to access the text being set in the header and set it manually using setText() or something like that?

          JonBJ 1 Reply Last reply
          0
          • B basimchowdhury

            @JonB I am aware if setLocale() but what I need to do is set the names of the day to anything else, even a made up language for example. Isnt there a way to access the text being set in the header and set it manually using setText() or something like that?

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

            @basimchowdhury
            Well you & I are not finding such a setText(), and @SGaist posted at the same time as I was composing my reply stating

            AFAIK, there's no easy way for that. QCalendarWidget uses a custom model that relies on the locale to provide the name of the day.

            Hence my suggestion, and I was also thinking you might be able to invent a "dummy" locale if you had to. Though quite why you want to change these names to something which isn't even in a locale I don't know! Unless you are deliberately wanting to confuse the user by e.g. showing "Wednesday" when it's "Tuesday" or "November" when it's "February" :)

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi and welcome to devnet,

              AFAIK, there's no easy way for that. QCalendarWidget uses a custom model that relies on the locale to provide the name of the day.

              B Offline
              B Offline
              basimchowdhury
              wrote on last edited by
              #6

              @SGaist Is there a way to access the widget or the component that holds the text for the days so that I may manually set it using setText()? Again I was able to accomplish this with the month name by accessing the QMenu object attached to the month button and then getting the QList of QActions, each corresponding to a month, and manually calling setText() for each of them. I am looking for a similar solution.

              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