Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. qml calendar component
Forum Updated to NodeBB v4.3 + New Features

qml calendar component

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.0k Views 2 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.
  • V Offline
    V Offline
    vicarod
    wrote on last edited by vicarod
    #1

    In a qml calendar component I want to select and color only few days through selectData.date in dayDelegate.

    Ex. color: {(styleData.date==="2015-05-25") ? "yellow" : "red"}
    not work.

    How can I do this to work ?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jean
      wrote on last edited by Jean
      #2

      what do you mean it doesn't work to select date or to display different color according to compare date ?

      here is to display different color. I think your delegate have not problem, so check your code.

      import QtQuick 1.0
      
      Item {
          id: main
          width: 1280; height: 720
          focus: true
      
          ListModel{
              id: mymodel
              ListElement { d: "2015-05-25" }
              ListElement { d: "2015-05-26" }
              ListElement { d: "2015-05-27" }
          }
      
          ListView {
              width: 100; height: 100*4
              focus: true
              model: mymodel
              delegate: Item {
                  width: 100; height: 100
                  Rectangle {
                      color: "black"
                      opacity: 0.5
                      Text {
                          text: d
                          color: d==="2015-05-25" ? "yellow" : "white"
                          anchors.centerIn: parent
                      }
                      anchors.fill: parent
                  }
              }
              highlight: Rectangle {
                  color: "red"
                  opacity: 0.5
              }
          }
      }
      
      1 Reply Last reply
      0
      • V Offline
        V Offline
        vicarod
        wrote on last edited by
        #3

        I have solved the problem
        It works with

        styleData.date.toLocaleDateString() === "25 februarie 2015"

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          I suggest to use "numeric only" formats (for instance "yyyy-MM-dd"). In that case your app can work properly also in different Locales

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          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