[Interest] QML issue with putting an element on top of a repeater item based on the clicked one
bo at fioniasoftware.dk
Fri Jun 29 08:30:28 CEST 2012
This might not be the best advice, because I don't know your reasons for
choosing the repeater.
Something tells me the reason you have problems is that you shouldn't
use a repeater. I mean, what are you repeating? If you do different zoom
levels in a calendar application, the hours are usually painted
differently, which makes a repeater a bit weird.
Repeaters are great for doing something quick. But sometimes you have to
get rid of them later, because they get in your way.
Hard to say if this really is the core of your problem, but it's worth
Den 29-06-2012 01:04, Mark skrev:
> Sorry for the long title, i don't really know how to describe this
> issue otherwise.
> First for the code.
> File: CalendarDay.qml
> import QtQuick 1.1
> width: 800
> height: 600
> 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,
> Interest mailing list
> Interest at qt-project.org
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
More information about the Interest