Showing posts with label Qt Quick. Show all posts
Showing posts with label Qt Quick. Show all posts

Monday, May 31, 2021

How i ended up fixing a "not a bug" in Qt Quick that made apostrophes not being rendered while reviewing an Okular patch

But in Okular we don't use Qt Quick you'll say!


Well, we actually use Qt Quick in the mobile interface of Okular, but you're right, this was not a patch for the mobile version, so "But in Okular we don't use Qt Quick!"

 

The story goes like this.

I was reviewing https://invent.kde.org/graphics/okular/-/merge_requests/431 and was not super convinced of the look and feel of it, so Nate gave some examples and one example was "the sidebar in Elisa".

 

So I started Elisa and saw this

You probably don't speak Catalan so don't see that lesquerra is a mistake it should be l'esquerra

 

Oh the translators made a mistake i thought, so i went to the .po file https://websvn.kde.org/trunk/l10n-kf5/ca/messages/elisa/elisa.po?view=markup#l638 and oh surprise! the translators had not made a mistake (well not really a surprise since they're really good).


Ok, so what's wrong then?


I had a look at the .qml code https://invent.kde.org/multimedia/elisa/-/blob/release/21.04/src/qml/MediaPlayListView.qml#L333 and it really looked simple enough.

 

I had never seen a Kirigami.PlaceholderMessage before but looking at it, well the text ended up in a Kirigami.Heading and then in a QtQuick Label. Nothing really special.


Weeeeeeird.


Ok i said, let's replace the the whole xi18nc in there with the translated text and run elisa. And then i could see the ' properly.


Hmmmm, ok then the problem had to be xi18nc right? Well it was and it was not.


The problem is that xi18nc translates ' to ' to be more "html compliant" https://invent.kde.org/frameworks/ki18n/-/blob/master/src/kuitmarkup.cpp#L40

 

And unfortunately Qt Declarative 5.15 Text item default "html support" is something Qt calls "Styled Text" that only supports five HTML entities, and apos is not one of them https://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/quick/util/qquickstyledtext.cpp?h=5.15.2#n558

 

So where is the bug?

 

The Text documentation clearly states that ' is in the list of supported entities.

One could say the bug is that every time we use xi18nc in a Text we should remember to change the "html support" to something Qt calls "RichText" that actually supports '.


But we all know that's never going to happen :D, and in this case it would actually be hard since Kirigami.PlaceholderMessage doesn't even expose the format property of the inner text

So I convinced our friends at Qt that only supporting five entities is not great and now we support six ^_^ in Qt 6.2, 6.1 and 5.15 (if you use the KDE Qt patch collection) https://invent.kde.org/qt/qt/qtdeclarative/-/merge_requests/3/diffs


P.S: I have a patch in the works to support all HTML entities in StyledText but somehow it's breaking the tests, so well, need to work more on it :)

Sunday, October 27, 2013

KReversi master is now Qt Quick based!

Denis Kuplyakov worked on porting KReversi to QtQuick during this Google Summer of Code and his code has now been merged to master for the upcoming 4.12 release. The kdegames team has given the new code as much testing as we can, but it is a big re-work so it'd be great if you can give it a try and report any regression you may find compared to the old version.

Thursday, August 29, 2013

KNetwalk ported to QtQuick

Ashwin Rajeev has just commited his port of KNetwalk to use QtQuick to the master branch of the knetwalk git repository.

Ideally you should not notice any difference, but it would be awesome if you guys could give it a try and report to either Ashwin or to the kde-games-devel mailing list (if you do it here I'll try to pass the info, but I'm going to be off the web for a while so it may get lost when I come back and there's a ton of emails to read :D)

Wednesday, September 22, 2010

Speaking at OSS Barcamp this weekend

This weekend i will be giving two talks at OSS Barcamp in Dublin. The first talk (Saturday 12:00 Room 2) is "An introduction to Qt Quick" (really an introduction as i am just a beginner in Qt Quick) and the second talk (Sunday 11:10 Room 1) is an introduction to Valgrind (I'm not an expert but i think i qualify as seasoned user here). Of course I'll be around a while wearing my KDE gear so if you have questions or wanna have a chat just say "Hi!"