smurfy / fahrplan

QT Application for Public transportation
GNU General Public License v2.0
58 stars 33 forks source link

Misaligned graphics in journey details view #131

Open leppa opened 9 years ago

leppa commented 9 years ago

Split of bug report #129.

From the screenshot below it's clearly visible that UI elements are misaligned when time is longer than "00:00" (e.g., contains AM/PM). Seems to happen on Nokia N9. Might also be on Symbian, however I checked on BlackBerry 10 and alignment is correct. Sailfish OS and Ubuntu Touch are other platforms to check.

fahrplan-bug-20141103

smurfy commented 9 years ago

As i mentioned in #129

I cant reproduce the problem, on harmattan (N950) or SailfishOs. The problem is, that regardless of the language etc. settings it always show a 24h time.

In the SailfishOS Emulator i noticed that at least in the listing (not details) it shows the time in 00:00:00 format, which is also wrong.

leppa commented 9 years ago

Oh, 00:00:00 - I've seen it once on one of my Symbian phones, but was busy with something else to check.

Well, currently we use Qt.DefaultLocaleShortDate format which depends on the system locale. It could be that in some cases this format is "hh:mm:ss" instead of just "hh:mm". This needs to be verified.

benni0815 commented 9 years ago

I can reproduce this when I start Fahrplan on my N9 from the terminal with:

LANG="EN" /opt/fahrplan2/bin/fahrplan2

Edit: The time is displayed as "hh:mm:ss"

smurfy commented 9 years ago

Did you test it with the fix-163 branch code? I will do a retest.

benni0815 commented 9 years ago

No, I can't, but I will do when the next version is out.

benni0815 commented 9 years ago

I'm sorry but this didn't work.

fahrplan

smurfy commented 9 years ago

Strange :( try to fix it with the next release.

leppa commented 9 years ago

There is one (hacky) way we could actually align all elements in the list. I used it in https://github.com/leppa/taot/blob/master/qml/symbian/DictionaryDelegate.qml (see lines 178, 191-198). In my case it's done with Column but should also be possible with ListView.

Basically, you declare a property (e.g., maxWidth) in the ListView. Then in the delegate you set width: listView.maxWidth for the times element and in the delegate's onCompleted you do this:

if (listView.maxWidth < times.childrenRect.width) {
    listView.maxWidth = times.childrenRect.width;
}

What it does is stores width of the widest times element in the list and this width is used by times elements in all delegates.