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. Jalali calender

Jalali calender

Scheduled Pinned Locked Moved General and Desktop
12 Posts 5 Posters 6.6k 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.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    Hi

    Is there any implementation of Jalali or other calenders in Qt? I couldn't find anything in docs. googled around but there is nothing out there.

    Do you think it's necessary to implement various types of calenders inside QtCore?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      As far as I know, there's no support yet. You might follow the discussions on the enhancements on [[Doc:QDateTime]]. The current state is documented on the Contributors' Summit's "wiki page about QDateTime":http://developer.qt.nokia.com/groups/qt_contributors_summit/wiki/QDateTime

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        soroush
        wrote on last edited by
        #3

        I would like to write my own calender class. I want it to be like date class of Qt. also, if possible, I want to have a widget for that.

        What you'll suggest? should I subclass QDate or write another one ?

        1 Reply Last reply
        0
        • frankcyblogic.deF Offline
          frankcyblogic.deF Offline
          frankcyblogic.de
          wrote on last edited by
          #4

          Subclassing most likely is not a good idea. As far as I know QDateTime is based on a Julian date internally, although it expects a Gregorian date externally. Check out the static constructor functions. Maybe writing a wrapper from Jalali to Gregorian is all you need. What actually is Jalali? Never heard of this calendar before.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            If you can not wait for Qt 5 (no guarantees it will be in there, but the people at QtCS I discussed this with seemed very motivated to get it into Qt 5), I suggest you take a look at what the KDE libs have to offer you.

            QDate is not a good class to subclass, because it only has a default destructor and those are not virtual. If you subclass such a class, and you destruct it through a pointer to the base class, the results are undefined. You do not want to move into the realm of undefined behaviour.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              soroush
              wrote on last edited by
              #6

              It seems that I'll have to write a Qt-like class, (subclass of QObject) from scratch. It should not be so hard... for converting between calenders, got some complex algorithms for convert between Jalali, Hijri and Julian calender from Geophysical Institute of Tehran.

              bq. What actually is Jalali? Never heard of this calendar before.

              Jalali calender is a solar calender. first six mounts of a year are 31 days. months 7 to 11 are 30 days and 12th month is 29 day and becomes 30 days every four-year period. also there are two years in a 4-year period with 30 days in 12th month, every 33 years. and every 124 years there is no year with 30 days in 12th month. The year begin at March 21st. (Spring)

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                Jelali is the Persian calendar system. I think KDE supports working with it out of the box, so yet again: I suggest you check out how they manage that.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  soroush
                  wrote on last edited by
                  #8

                  bq. Jelali is the Persian calendar system. I think KDE supports working with it out of the box, so yet again: I suggest you check out how they manage that.

                  KDE already has a complete implementation of Jalali calender (I'm using on my desktop :) but it's not so usable within Qt. I would like to have a Qt-like class. I started to implement a subclass of QObject with approach of SIGNAL / SLOT (hopefully).

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    [quote author="soroush" date="1309161858"]It seems that I'll have to write a Qt-like class, (subclass of QObject) from scratch. It should not be so hard... for converting between calenders, got some complex algorithms for convert between Jalali, Hijri and Julian calender from Geophysical Institute of Tehran.[/quote]
                    Why do you need to subclass QObject? Do you need signals and slots? Properties?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      soroush
                      wrote on last edited by
                      #10

                      bq. Why do you need to subclass QObject? Do you need signals and slots? Properties?

                      Actually no! but I think it could be a nice training to learn more about Qt.

                      Is it a bad idea to use signal / slot / properties and other things of Qt in some class when it's possible to implement that without them?

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        thisisbhaskar
                        wrote on last edited by
                        #11

                        [quote author="soroush" date="1309163121"]bq. Why do you need to subclass QObject? Do you need signals and slots? Properties?

                        Actually no! but I think it could be a nice training to learn more about Qt.

                        Is it a bad idea to use signal / slot / properties and other things of Qt in some class when it's possible to implement that without them?[/quote]

                        Signals/Slots are there to be used. If you need them, by all means go and have a QObject subclass. What Andre meant was, if you don't need signals and slots ( other few good things that come with QObject,Q_OBJECT macro) you don't need to have your class derived from QObject.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          soroush
                          wrote on last edited by
                          #12

                          Ok.

                          I'm going to write without QObject.

                          thanks

                          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