Gui: Use RTL layout when Wb Tab Bar is placed in right corner

Right corner is placed to the right edge of screen, so its natural
growth occours on the left side. Basically it is Right to Left order and
so in that case the "end" is actually on left and so TabBar should grow
in that direction.

Unfortunately it is not possible to simply use RTL Qt feature to handle
that case as it would result in reverse order of workbenches (people will still
read it in LTR order) and icons on the right which is not wanted. That's
custom support is introduced.
This commit is contained in:
Kacper Donat
2024-05-05 13:42:37 +02:00
parent 37d6ba2898
commit 82f6b68307
3 changed files with 148 additions and 48 deletions

View File

@@ -632,15 +632,16 @@ void WorkbenchGroup::addTo(QWidget *widget)
if (widget->inherits("QToolBar")) {
ParameterGrp::handle hGrp;
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Workbenches");
QWidget* wbSel;
QWidget* workbenchSelectorWidget;
if (hGrp->GetInt("WorkbenchSelectorType", 0) == 0) {
wbSel = new WorkbenchComboBox(this, widget);
workbenchSelectorWidget = new WorkbenchComboBox(this, widget);
}
else {
wbSel = new WorkbenchTabWidget(this, widget);
workbenchSelectorWidget = new WorkbenchTabWidget(this, widget);
}
static_cast<QToolBar*>(widget)->addWidget(wbSel);
static_cast<QToolBar*>(widget)->addWidget(workbenchSelectorWidget);
}
else if (widget->inherits("QMenu")) {
auto menu = qobject_cast<QMenu*>(widget);