Possible bug calendar?



  • Good afternoon, my mistake will not if, but when you click on the rectangle that represents the present day, gives different column. Have someone can verify. Thank you.

    @
    ---QML---
    WorkData.positionToDate
    ( parent.mapToItem(calendar, calendar.x, calendar.y).x,
    parent.mapToItem(calendar, calendar.x, calendar.y).y,
    parent.width,
    parent.height)

    ---SCRIPT-----

    var m_firstDayOfWeek = 1;
    var m_monthStartAt;

    function positionToDate(mouseX, mouseY, width, height)
    {
    computeMonthBoundaries();

    var columnID = mouseX / width;
    var rowID = mouseY  / height;
    

    console.log("COlumn:" + columnID + ", Row:" + rowID)
    var offset = ((rowID * 7) + columnID) + 1;
    var day = offset - m_monthStartAt + 1;
    var monthLast = new Date(calendar.visibleYear, calendar.visibleMonth, offset - m_monthStartAt + 1);
    console.log(monthLast)

    }

    function computeMonthBoundaries()
    {
    var dayOfWeek = UTILS.getDayWeek(calendar.visibleYear, calendar.visibleMonth + 1, 1);

    if (dayOfWeek < m_firstDayOfWeek)
    {
        m_monthStartAt = dayOfWeek + (8 - m_firstDayOfWeek);
    }
    else if (dayOfWeek > m_firstDayOfWeek)
    {
        m_monthStartAt = dayOfWeek + (m_firstDayOfWeek - 1);
    }
    else
    {
        m_monthStartAt = 1;
    }
    

    // m_monthEndAt = m_monthStartAt + UTILS.getDaysMonth(calendar.visibleYear, calendar.visibleMonth) - 1;
    }
    @

    [edit: added missing coding tags @ SGaist]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.