clementine-player/Clementine — pull request #4102 by Tatsh (2014-01-11 08:58:03+00:00)
Title: In the tag editor, make the reset button appear on the left side for RTL...

Fixes #2673. Suggestions welcome!

Left to right text is left alone of course:
![roman-fine](https://f.cloud.github.com/assets/724848/1893525/10a35c02-7a9d-11e3-8d8c-89c3f458f74b.png)

Normal use case. Note how *Pop* stays on the left and the Reset button appears on the right, but for the Arabic, the Reset buttons appear on the left.
![normal](https://f.cloud.github.com/assets/724848/1893527/1ff59558-7a9d-11e3-932c-3531d80eecab.png)

Mixed LTR and RTL but with RTL as first character. Handling this is special because Qt does not consider *لو نرجع سوا (instrumetal)* to be RTL. It has to be 100% RTL or it is considered LTR. So, the first character is checked with `.isRightToLeft()` rather than the whole string. This also keeps text staying LTR if it starts with LTR but ends with RTL (which makes more visual sense for button placement).
![mixed](https://f.cloud.github.com/assets/724848/1893533/443e2bdc-7a9d-11e3-8a29-01b3d83c3cab.png)

More mixed (album and album artist):
![mixed2](https://f.cloud.github.com/assets/724848/1893537/78354a42-7a9d-11e3-9577-4a1161df17f2.png)

# Caveats

Maybe calling `Resize()` in the `Paint()` method is not such a good idea, but I could not find a better place to re-use the `is_rtl_` property to adjust the buttons. The editor dialog is re-used (cache) so remains across launches (and to avoid re-constructing). Without the `Resize()` call in `Paint()` the button placement will stay the same across multiple launches, which means RTL layout will load for a non-RTL string if RTL is loaded first. This is definitely not desirable.

However, the main reason I say it is does not seem so great in the to call `Resize()` in the `Paint()` method is because `Paint()` is called very very often.