Martchus / tageditor

A tag editor with Qt GUI and command-line interface supporting MP4/M4A/AAC (iTunes), ID3, Vorbis, Opus, FLAC and Matroska
GNU General Public License v2.0
676 stars 56 forks source link

Button overlay from qtutilities does not look nice in certain styles and especially with right-to-left configurations #56

Closed 4fury closed 4 years ago

4fury commented 4 years ago

tageditor

Martchus commented 4 years ago

I assume the problem is that the overlay icons in the text boxes interfere with your right-to-left font settings. Can you nevertheless provide a more detailed issue description?

4fury commented 4 years ago

I can't add details. If i fill tags a Latin characters, insert a very long value, get same problem. Addition, you see buttons in empty fields 'Track of' and 'Disk of'.

tageditor1

System with english localization.

Martchus commented 4 years ago

I can't add details.

Generally you should be able to edit your comments on GitHub. But I think I understand the problem at least.

But can you give me "steps to reproduce" like it is commonly done when reporting a bug? E.g. an environment variable one needs to set to get this right-to-left setup would be useful. It would also helpful to include "the expected behavior". I assume in a right-to-left config the buttons should show up on the left side?

I'm aware that it doesn't look nice if the full space is used even with a left-to-right locale. Maybe I can improve that at some point. However, it is not easy to implement this in a generic way which works for all styles and I want to avoid making things worse.

Regarding the boxes for numeric fields where the buttons interfere with the "-" and "+": Which style are you using here exactly? I've actually tried to use the metrics from the style here (instead of hard-coding the spacing). Either I made a mistake here (e.g. using the wrong metric) or the style is buggy.

Martchus commented 4 years ago

By the way, if you want to experiment with that yourself: The relevant code is actually in the qtutilities repository (ButtonOverlay and derived classes).

4fury commented 4 years ago

Environment variables by default, except some gtk3. DE -- xfce. No special settings for right-to-left text. On screenshots style KvGnomeDark for kvantum. If use kvantum default style, can see some improves. Problem exist if use adwaita-qt(light, dark), fusion or any other qt style engine.

"the expected behavior"

How?

I assume in a right-to-left config the buttons should show up on the left side?

Probably yes.

Martchus commented 4 years ago

This should avoid positioning overlay icons on spin box or combo box buttons: https://github.com/Martchus/qtutilities/commit/7db2fd02fcae80febfa30b602d6a560758009058

I have an idea how to avoid drawing over the text of line edits and combo boxes. However, it will only work for styles which support text margins which seems to be the case for Breeze but not for adwaita-qt.

I've noticed that the buttons (which are actually positioned using a regular Qt layout) go automatically from right to left when setting the layout direction to right-to-left. But then everything is weirdly mirrored which is not the same as your configuration. In your configuration only the text alignment is changed. I'm wondering how to apply that configuration to a single application for testing (without affecting the whole system).

4fury commented 4 years ago

I don't know. if in terminal:

export LANG='ar_**' -> ‎u200E -> tageditor

buttons reflected after input text. With breeze it work immediatly, if just export LANG.

I have an idea how to avoid drawing over the text of line edits and combo boxes.

setStyleSheet maybe?

Martchus commented 4 years ago

export LANG='ar_**'

That works but I get also a full right-to-left layout this way. And now I'm in the situation of having a file with English tags open using the right-to-left configured tag editor. Since the tag values themselves are still English and also displayed left-to-right the buttons should actually still be on the right side and only switch to the left side if right-to-left content is entered.

buttons reflected after input text.

Ah, right. That the direction is jumping when editing is weird although in my case it changes for the better because the file I have has English tag values.

setStyleSheet maybe?

That can't do much and maybe gets refactored in future Qt versions so I wouldn't rely on it. My idea is to set the QLineEdit's text margins (should also work for the combo box). The only problem is computing the size of the buttons and making this work automatically. But if that was implemented the left-to-right vs. right-to-left positioning wouldn't be such a big issue anymore and it would likely make sense to keep it always on the right side for consistency because the tag value's locale is actually independent from the applications locale and even might change while editing. Having the buttons jump around while editing is disturbing.

4fury commented 4 years ago

I have other question. How to disable bak-file creation? What is the best way to write about this?

Martchus commented 4 years ago

I've added a README section answering your question. So no, there's no way to disable it completely. Maybe I'll implement a feature to automatically remove these files at some point.

4fury commented 4 years ago

Thank you!

Martchus commented 4 years ago

I've changed the internal implementation of the button overlay to use Qt's built-in way to add custom buttons. It turns out it can not only show a clear button but also custom buttons. It works with all themes I've tested and looks acceptable when setting the layout direction to right-to-left. (Adwaita-qt has display issues with right-to-left layouts but I suppose that's a problem within that style.)

By the way, I didn't use Qt's built-in functions in the first place because these functions have only been added in Qt 5.2. Seems like I haven't touched this code much for 6 years until now :-)

4fury commented 4 years ago

Thank you! It's fine works. Tageditor added to Pisilinux Contrib repository.