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. check date called from firebase against calendar?
QtWS25 Last Chance

check date called from firebase against calendar?

Scheduled Pinned Locked Moved Unsolved General and Desktop
firebasecalendardatedatabaseqml
10 Posts 2 Posters 2.4k 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.
  • L Offline
    L Offline
    Ldweller
    wrote on 28 Sept 2018, 23:43 last edited by Ldweller
    #1

    Hey guys,

    I am working with QML saving Calendar selected dates into a firebase database. when i open the calendar page i am then reading the saved dates back.

    I need to check the dates from firebase to the calendar and any date saved will display a marker?

    how could i set this up? as i'm well and truly stuck XD

    Thanks!

    M 1 Reply Last reply 29 Sept 2018, 07:04
    0
    • L Ldweller
      28 Sept 2018, 23:43

      Hey guys,

      I am working with QML saving Calendar selected dates into a firebase database. when i open the calendar page i am then reading the saved dates back.

      I need to check the dates from firebase to the calendar and any date saved will display a marker?

      how could i set this up? as i'm well and truly stuck XD

      Thanks!

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 29 Sept 2018, 07:04 last edited by
      #2

      @Ldweller
      Hi
      Subclass QCalendarWidget and override
      http://doc.qt.io/qt-5/qcalendarwidget.html#paintCell
      so you can draw the marker.
      Open DB and store the "marked" date in a lookup list
      so when paintCell is called, you check the date paramter against
      the data and draw marker if needed.

      1 Reply Last reply
      1
      • L Offline
        L Offline
        Ldweller
        wrote on 29 Sept 2018, 09:33 last edited by
        #3

        @mrjj Thanks for getting back to be so fast! and thanks for the response!!

        I am using the QtQuick Calendar would this method still be able to be applied?

        When you say lookup list, by what do you mean(sorry if it's an obvious question?)

        my dates are stored like so, would this be the appropriate way to get it working?

        ---dates
        ------1
        ---------date: "2018-09-03"
        ------2
        ---------date: "2018-09-04"
        ------3
        ---------date: "2018-09-05"

        Thanks again!

        M 1 Reply Last reply 29 Sept 2018, 11:17
        0
        • L Ldweller
          29 Sept 2018, 09:33

          @mrjj Thanks for getting back to be so fast! and thanks for the response!!

          I am using the QtQuick Calendar would this method still be able to be applied?

          When you say lookup list, by what do you mean(sorry if it's an obvious question?)

          my dates are stored like so, would this be the appropriate way to get it working?

          ---dates
          ------1
          ---------date: "2018-09-03"
          ------2
          ---------date: "2018-09-04"
          ------3
          ---------date: "2018-09-05"

          Thanks again!

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 29 Sept 2018, 11:17 last edited by
          #4

          @Ldweller
          Hi
          oh, its QML. nope that is different.
          I think you can make your own
          http://doc.qt.io/qt-5/qml-qtquick-controls-styles-calendarstyle.html
          if the default is not looking like you want. else default is fine.
          And also forget about the looup list. :) not needed.
          The QML calendar uses a model based SqlQueryModel so all you really need
          is change the database type and the query in
          void SqlEventModel::createConnection()
          in sample ( you linked) it just creates a table and put data in.
          you would just read the ones you have. ( SQL select statement)

          1 Reply Last reply
          1
          • L Offline
            L Offline
            Ldweller
            wrote on 29 Sept 2018, 13:18 last edited by
            #5

            @mrjj
            again I can't thank you enough for the help!

            I have amended my original post stating I am working in QML and added the QML tag also.

            forgive me, I am a novice but adamant to complete this project and learning unfathomable amounts along the way assisted by the likes of you!

            There is already a QML project example with saved dates marked using SQLite, yet I chose firebase for the cloud hosted backend, noSQL and no additional setup there for me! When you have said change the database type do you mean to stop using firebase and move to SQL? or is there a way I can translate my firebase callbacks into and SQL event model?

            Thanks a million again!!!

            M 1 Reply Last reply 30 Sept 2018, 00:07
            0
            • L Ldweller
              29 Sept 2018, 13:18

              @mrjj
              again I can't thank you enough for the help!

              I have amended my original post stating I am working in QML and added the QML tag also.

              forgive me, I am a novice but adamant to complete this project and learning unfathomable amounts along the way assisted by the likes of you!

              There is already a QML project example with saved dates marked using SQLite, yet I chose firebase for the cloud hosted backend, noSQL and no additional setup there for me! When you have said change the database type do you mean to stop using firebase and move to SQL? or is there a way I can translate my firebase callbacks into and SQL event model?

              Thanks a million again!!!

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 30 Sept 2018, 00:07 last edited by
              #6

              Hi
              Do you already have a way to connect to cloud firebase that works with Qt ?

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Ldweller
                wrote on 30 Sept 2018, 23:18 last edited by
                #7

                @mrjj
                Yes i have already setup my database for user auth and can currently write the selected date to firebase and read back into the log. Its now using that read to also add the marker which is where i am stuck!!!

                M 1 Reply Last reply 1 Oct 2018, 06:32
                0
                • L Ldweller
                  30 Sept 2018, 23:18

                  @mrjj
                  Yes i have already setup my database for user auth and can currently write the selected date to firebase and read back into the log. Its now using that read to also add the marker which is where i am stuck!!!

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 1 Oct 2018, 06:32 last edited by
                  #8

                  @Ldweller
                  Ok super.
                  Next step would be to alter
                  QList<QObject*> SqlEventModel::eventsForDate(const QDate &date)
                  to use your table names / col names to get any events that need to be drawn.

                  I assume you can use QSqlQuery with firebase or is that the actual issue ?
                  its non sql and u use completely another method of getting data ?
                  IF yes, i think we need to use other model then.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Ldweller
                    wrote on 1 Oct 2018, 10:15 last edited by
                    #9

                    @mrjj

                    firebase is noSQL with data stored as JSON so i have no tables to work with;
                    a simple read value for me would be;

                    firebaseDB.getUserValue("users/details/firstname")
                    

                    I can query firebase also with filter by key/value/child options.

                    Would you suggest working with Sql then?

                    Thanks

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      Ldweller
                      wrote on 4 Oct 2018, 01:07 last edited by
                      #10

                      @mrjj
                      I have moved forward from calling my saved dates to receive the following:

                      Read Value: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] for key: dates

                      (one for each date saved)
                      when adding

                      if(success) {
                          console.log(JSON.stringify(value))
                          }
                      

                      I can also read the saved dates in the format of:

                      [{"date":"2018-10-01T21:17:00.926"},{"date":"2018-10-02T12:00:00.000"},{"date":"2018-10-03T12:00:00.000"},{"date":"2018-10-06T12:00:00.000"},{"date":"2018-10-07T12:00:00.000"},{"date":"2018-10-08T12:00:00.000"}]

                      now how would I determine these dates are saved in my calendar to add the marker?

                      I have tried adding a property bool to the marker so the read value equals isMarked = true yet this either marks every date on the calendar or none at all depending on how I am working this?!?

                      How would I convert the JSON string to individual date reads?

                      1 Reply Last reply
                      0

                      6/10

                      30 Sept 2018, 00:07

                      • Login

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