Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DolphinQt: Enable RTL layout #8006

Open
wants to merge 1 commit into
base: master
from

Conversation

4 participants
@JosJuice
Copy link
Contributor

commented Apr 17, 2019

@JosJuice JosJuice force-pushed the JosJuice:qt-rtl branch from d76b365 to 879b963 Apr 17, 2019

QStringLiteral("Syrj"), QStringLiteral("Syrn"),
};

for (int i = 1; i < components.size(); ++i)

This comment has been minimized.

Copy link
@BhaaLseN

BhaaLseN Apr 17, 2019

Member

I don't think theres a reason why this cannot be a range-based for-loop, can it?
Also, I wouldn't be surprised if there was an algorithm for this (altho I can't recall one from the top of my head)

This comment has been minimized.

Copy link
@JosJuice

JosJuice Apr 17, 2019

Author Contributor

It starts at 1 instead of 0 because I wanted to skip the main language code, so making it into a range-based for loop would be awkward.

This comment has been minimized.

Copy link
@JosJuice

JosJuice Apr 17, 2019

Author Contributor

The main language code should never actually be 4 in size, though...

This comment has been minimized.

Copy link
@BhaaLseN

BhaaLseN Apr 17, 2019

Member

Oops, kinda missed that :D

This comment has been minimized.

Copy link
@spycrab

spycrab Apr 22, 2019

Contributor

Instead of making this so hard on yourself you could just use
QStringList::takeFirst() to take away the first component which you can then use in line 205.

Now you would be able to use a for-range loop or better yet just turn your QStringList into a QSet<QString> and use
QSet::intersects (which will return true if at least one item matches the other)

This comment has been minimized.

Copy link
@JosJuice

JosJuice Apr 22, 2019

Author Contributor

I made it use QStringList::takeFirst and a range-based for loop now.

However, I can't just use QSet::intersects, because I want to return either true or false as soon as I find a script code (four-letter component). QSet::intersects only lets me find matching script codes, not non-matching script codes.

@JosJuice JosJuice force-pushed the JosJuice:qt-rtl branch from 879b963 to b57ffcf Apr 22, 2019

@leoetlino

This comment has been minimized.

Copy link
Member

commented May 4, 2019

Hmm, any thoughts on using the QT_LAYOUT_DIRECTION trick (where translators translate QT_LAYOUT_DIRECTION as either LTR or RTL themselves)? That'd remove the need for a hardcoded list of locales and scripts for which RTL is enabled.

@JosJuice

This comment has been minimized.

Copy link
Contributor Author

commented May 4, 2019

Does that work for Qt Widgets? I only found it in the documentation for Qt Quick.

@leoetlino

This comment has been minimized.

Copy link
Member

commented May 4, 2019

@JosJuice

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2019

That's probably the way to go, then. I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.