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. Possible bug calendar?
Forum Updated to NodeBB v4.3 + New Features

Possible bug calendar?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 769 Views 1 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.
  • H Offline
    H Offline
    homer0123456789
    wrote on last edited by
    #1

    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]

    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