[Interest] QML issue with putting an element on top of a repeater item based on the clicked one

Mark markg85 at gmail.com
Fri Jun 29 01:04:26 CEST 2012


Hi,

Sorry for the long title, i don't really know how to describe this
issue otherwise.

First for the code.

File: CalendarDay.qml
http://paste.kde.org/509612/

main.qml

import QtQuick 1.1

Rectangle
{
    width: 800
    height: 600

    CalendarDay
    {
        anchors.fill: parent
    }
}

What i'm trying to achieve is the same as in iCal :
http://ompldr.org/vZWpvcw I'm trying to get the "green" thing places
on the cells that i select. Now i already can trace which rectangle
i'm clicking by means of childAt and that seems to be working just
fine. What i did then is adding just a red square that i want to place
at the bottom position of the clicked row. That is where i get stuck.

What i'm trying to do now is anchoring the red rectangle to the
"anchors.bottom" from the clicked rectangle (done in the code on line
250 in the paste link). I tried item.bottom and item.anchors.bottom,
the latter one complained about a null object..? That however isn't
working because: "QML Rectangle: Cannot anchor to an item that isn't a
parent or sibling." so i'm stuck getting that to work. You can also
see this by running the code in the paste.kde.org link and the
main.qml. Once running just click and drag anywhere,

also, if i change the line: console.log(item) (line 251) to
console.log(item.id) it prints "undefined" while the id is in fact set
in the actual elements.. Does anyone know why this is the case? I
would expect it to return the id.

Another side issues that i also have is the flickable area.. I want my
"custom" mousearea to catch the clicked and pressed events, the rest
can be passed on to Flickable, but how do i do that?

I hope someone can provide me some pointes on how to fix these issues.
Perhaps i'm doing ot all wrong and there might even be a lot easier
way that i don't know yet.

Kind regards,
Mark



More information about the Interest mailing list