[Interest] QML select/drag/drop like a calendar.

Mark markg85 at gmail.com
Sun Jul 8 02:09:03 CEST 2012


Hi,

I'm developing a calendar in QML and thus far it seems to going quite well.
Making a view with 12 months visible or a full month to select a day
isn't an issue. Works wonderful in QML.

The place where i hit real big QML issues (or actually the lack of
components) is when i want to make the day overview. Go to google
calendar or the calendar in your emailing application and you notice
that you can select some cells in the day overview. Those selected
cells will become the "appointment" or event or whatever. That part is
close to impossible to implement in the current QML.

Take this as an example if you don't know what i mean:
http://photos.appleinsider.com/Lionical4.png

What i want to do is the following. I want users to be able to select
some cells in QML which will then be a event and stored somewhere.
Obviously the user can also have overlapping events or multiple events
at the same time - like other calendars allow as well.

The issues i run into are:
- dynamic elements don't have a ID thus that can't be used. That
prevents selecting it and dragging/dropping the event on another date.
- there is no sane way to select some elements in a list or repeater
without doing all kinds of tricks
- once the selection is made, how can i lay an item on top of that
selection? Dynamic element?
- there don't seem to be any elements in QML that are suited for this

So, is Qt 5 going to be of help here in making it easier? I doubt
that. Is there another way how i can make this work? Or do i need to
make special QML elements in C++ that are maintained in C++ as well
(id wise)? I'd hate to make that in C++ if it's even possible. It is
possible with QWidgets, but that kinda defeats the point of using QML.

I hope this makes some sense since it's quite difficult to describe the issue.
Incase you want to test my current testing code, clone:
git://gitorious.org/qmlcalendar/master.git

in main.qml uncomment:

CalendarDay
{
        anchors.fill: parent
}

And comment the CalenderMonth part.

Cheers,
Mark



More information about the Interest mailing list