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. how to change the dayDelegate for changing the image visible state?
Forum Updated to NodeBB v4.3 + New Features

how to change the dayDelegate for changing the image visible state?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 68 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.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1
     style: CalendarStyle {
    
                    dayDelegate: Item {
                        id: calendarItem
                        readonly property color sameMonthDateTextColor: "#444"
                        readonly property color selectedDateColor: Qt.platform.os
                                                                   === "osx" ? "#3778d0" : "#d7d9dB"
                        readonly property color selectedDateTextColor: "white"
                        readonly property color differentMonthDateTextColor: "#bbb"
                        readonly property color invalidDatecolor: "#dddddd"
    
                        Rectangle {
                            anchors.fill: parent
                            border.color: "transparent"
                            color: styleData.date !== undefined
                                   && styleData.selected ? selectedDateColor : "transparent"
                            anchors.margins: styleData.selected ? -1 : 0
                        }
    
                        Image {
                            id: markedImage
                            visible: eventModel.eventsForDate(
                                         styleData.date).length > 0
                            anchors.top: parent.top
                            anchors.left: parent.left
                            anchors.margins: -1
                            width: 12
                            height: width
                            source: "qrc:/qss/res/img/ui/eventindicator.png"
                        }
    
                        Label {
                            id: dayDelegateText
                            text: styleData.date.getDate()
                            anchors.centerIn: parent
                            color: {
                                var color = invalidDatecolor
                                if (styleData.valid) {
                                    // Date is within the valid range.
                                    color = styleData.visibleMonth ? sameMonthDateTextColor : differentMonthDateTextColor
                                    if (styleData.selected) {
                                        color = selectedDateTextColor
                                    }
                                }
                                color
                            }
                        }
                    }
    

    the example what the qt offered that named the calendar of the qml.
    i just want to refresh the state of the calendar for some days state.the dayDelegate called the

    eventModel.eventsForDate(styleData.date).length > 0
    

    how to change the visible state ?the method upstairs

    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