Hi Gabriel
Thank you for taking the time to reproduce this issue. It is
reassuring to know that based on the admittedly slim evidence of this
issue alone I am not going completely mad!
I agree that the 2 issues sound related (I will have a poke around
with your code later today).
Based on the assumption that this is probably a Qt issue rather than a
Sailfish issue I was about to open an issue on the Qt Bug tracker.
Then standing on the platform waiting for my train to arrive I
thought: How difficult could it be to fire up my Qt5.2 installation
and create a Desktop version of this project to reproduce this issue?
By the time the train pulled in I had my first ever Qt Desktop project
running! I had expected to see the same sections bug, but unexpectedly
I got the expected behaviour! i.e on Qt 5.2.0 desktop I cannot
reproduce this bug.
My next thought was: "Maybe this is still a Qt problem, but has been
fixed in Qt 5.2.0?
Luckily I have an old Qt 5.0.0 installation lurking on my laptop. So I
added a Qt version and kit for that, and launched the project as
Qt5.0.0.
Again no Section header bug.
Then I turned to Android with Qt 5.2.0, and once again got expected
behaviour (no bug).
So to cut a long story short, this behaviour appears to be limited to
Sailfish (or the particular Qt version used by Sailfish)
I can reproduce it on the Emulator and real Jolla Device.
I cannot reproduce it on Harmattan Qt 4.7.4 (from which I am porting the code)
I cannot reproduce it on Qt Desktop (5.0.0 and 5.2.0)
I cannot reproduce it on Android Qt 5.2.0 (Emulator and Galaxy Note 3
with KitKat).
Grüsse
Chris
Zitat von "Gabriel Böhme" <m.gabrielboe...@googlemail.com>:
Hi Chris,
I can reproduce this behavior with the code you posted and it seems to
be a bug.
I have encountered some days ago also a problem with section handling.
If you are appending a new Item to the list, while you use FullString
section headers, it's creating a new section, even if it is already
there. The expected behavior should be, that the new item is sorted
under the right section. Especially in my intended use case, it's a
problem because I want to fetch some data from an online source and sort
it in different sections. But how to do that, without appending? Insert
is also not possible at all, because it's varying always. Even if the
model is set after, appending (again) - it's not working. Also a code
example added at the bottom (just modified your code). The new
person/item with name "Tom" should be displayed in Boss section, but the
ListView creates another "Boss" section at the end of the list.
Maybe both are relating to each other?
Thank you very much.
Gabriel.
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
SilicaListView {
id: contactList
anchors.fill: parent
model: contactModel
delegate: Label {
text: model.name
width: page.width
}
section.property: "section"
section.criteria: ViewSection.FullString
section.delegate: Rectangle {
height: 50
width: page.width
color: Theme.secondaryHighlightColor
opacity: 0.5
Label {
anchors.horizontalCenter: parent.horizontalCenter
text: section
}
}
PullDownMenu {
MenuItem {
text: "Add a person"
onClicked: {
// comment out to set the model again, but thats not
working at
all. :-/
// contactList.model = emptyList
contactModel.insert({"name": "Tom", "section":
"Boss"})
// contactList.model = contactModel
}
}
}
}
ListModel {id: emptyList}
ListModel {
id: contactModel
ListElement {
name: "Achim"
section: "Boss"
}
ListElement {
name: "Ana"
section: "Friends"
}
ListElement {
name: "Bezelbub"
section: "Friends"
}
ListElement {
name: "Billy"
section: "Friends"
}
ListElement {
name: "Boris"
section: "Friends"
}
ListElement {
name: "Carrie"
section: "Friends"
}
ListElement {
name: "Cassie"
section: "Friends"
}
ListElement {
name: "Eziekiel"
section: "Family"
}
ListElement {
name: "Gargantua"
section: "Family"
}
ListElement {
name: "Gilbert"
section: "Family"
}
ListElement {
name: "Giles"
section: "Family"
}
ListElement {
name: "Gog"
section: "Workgroup"
}
ListElement {
name: "Mabel"
section: "Workgroup"
}
ListElement {
name: "Magog"
section: "Workgroup"
}
}
}
Am Mittwoch, den 29.01.2014, 19:56 +0100 schrieb
christopher.l...@thurweb.ch:
Hi all
I have come across some more strange behaviour.
This time it is a ListView / SilicaListVew with a SectionDelegate
based on FirstCharacter.
For the items initially displayed this works well, with the section
headers exactly where I would expect them (e.g between Anne and Babs
in the code below)
But as I flick up, I then a section header between each item (e.g
between Gargantua and Gilbert).
The code below demonstrates this on the emulator.
Grüsse
Chris
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
SilicaListView {
id: contactList
anchors.fill: parent
model: contactModel
delegate: Label {
text: model.displayLabel
width: page.width
}
section.property: "displayLabel"
section.criteria: ViewSection.FirstCharacter
section.delegate: Rectangle {
height: 10
width: page.width
color: "lightblue"
}
}
ListModel {
id: contactModel
ListElement {
displayLabel: "Achim"
}
ListElement {
displayLabel: "Ana"
}
ListElement {
displayLabel: "Anne"
}
ListElement {
displayLabel: "Babs"
}
ListElement {
displayLabel: "Barnie"
}
ListElement {
displayLabel: "Barry"
}
ListElement {
displayLabel: "Bezelbub"
}
ListElement {
displayLabel: "Billy"
}
ListElement {
displayLabel: "Boris"
}
ListElement {
displayLabel: "Carrie"
}
ListElement {
displayLabel: "Cassie"
}
ListElement {
displayLabel: "Charlie"
}
ListElement {
displayLabel: "Chris"
}
ListElement {
displayLabel: "Diana"
}
ListElement {
displayLabel: "Donald"
}
ListElement {
displayLabel: "Doris"
}
ListElement {
displayLabel: "Egbert"
}
ListElement {
displayLabel: "Ethel"
}
ListElement {
displayLabel: "Eziekiel"
}
ListElement {
displayLabel: "Franzi"
}
ListElement {
displayLabel: "Freddy"
}
ListElement {
displayLabel: "Gargantua"
}
ListElement {
displayLabel: "Gilbert"
}
ListElement {
displayLabel: "Giles"
}
ListElement {
displayLabel: "Gog"
}
ListElement {
displayLabel: "Mabel"
}
ListElement {
displayLabel: "Magog"
}
}
}
_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list