Skip to content

Commit

Permalink
fix #126901: swap directional icons for RTL languages
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Oct 4, 2016
1 parent cf14b8d commit d301e3d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
10 changes: 8 additions & 2 deletions mscore/drumroll.cpp
Expand Up @@ -56,8 +56,14 @@ DrumrollEditor::DrumrollEditor(QWidget* parent)
layout->setSpacing(0);

QToolBar* tb = addToolBar(tr("Toolbar 1"));
tb->addAction(getAction("undo"));
tb->addAction(getAction("redo"));
if (qApp->layoutDirection() == Qt::LayoutDirection::LeftToRight) {
tb->addAction(getAction("undo"));
tb->addAction(getAction("redo"));
}
else {
tb->addAction(getAction("redo"));
tb->addAction(getAction("undo"));
}
tb->addSeparator();
#ifdef HAS_MIDI
tb->addAction(getAction("midi-on"));
Expand Down
4 changes: 4 additions & 0 deletions mscore/measureproperties.cpp
Expand Up @@ -44,6 +44,10 @@ MeasureProperties::MeasureProperties(Measure* _m, QWidget* parent)
connect(previousButton, SIGNAL(clicked()), SLOT(gotoPreviousMeasure()));
nextButton->setEnabled(_m->nextMeasure() != 0);
previousButton->setEnabled(_m->prevMeasure() != 0);
if (qApp->layoutDirection() == Qt::LayoutDirection::RightToLeft) {
horizontalLayout_2->removeWidget(nextButton);
horizontalLayout_2->insertWidget(0, nextButton);
}
}

//---------------------------------------------------------
Expand Down
11 changes: 8 additions & 3 deletions mscore/musescore.cpp
Expand Up @@ -717,9 +717,14 @@ MuseScore::MuseScore()

fileTools = addToolBar("");
fileTools->setObjectName("file-operations");

for (auto i : { "file-new", "file-open", "file-save", "print", "undo", "redo"})
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(i)));
if (qApp->layoutDirection() == Qt::LayoutDirection::LeftToRight) {
for (auto i : { "file-new", "file-open", "file-save", "print", "undo", "redo"})
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(i)));
}
else {
for (auto i : { "file-new", "file-open", "file-save", "print", "redo", "undo"})
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(i)));
}

fileTools->addSeparator();
mag = new MagBox;
Expand Down
10 changes: 8 additions & 2 deletions mscore/pianoroll.cpp
Expand Up @@ -49,8 +49,14 @@ PianorollEditor::PianorollEditor(QWidget* parent)

QWidget* mainWidget = new QWidget;
QToolBar* tb = addToolBar(tr("Toolbar 1"));
tb->addAction(getAction("undo"));
tb->addAction(getAction("redo"));
if (qApp->layoutDirection() == Qt::LayoutDirection::LeftToRight) {
tb->addAction(getAction("undo"));
tb->addAction(getAction("redo"));
}
else {
tb->addAction(getAction("redo"));
tb->addAction(getAction("undo"));
}
tb->addSeparator();
#ifdef HAS_MIDI
tb->addAction(getAction("midi-on"));
Expand Down
10 changes: 8 additions & 2 deletions mscore/pluginCreator.cpp
Expand Up @@ -75,10 +75,16 @@ PluginCreator::PluginCreator(QWidget* parent)
editTools->setObjectName("EditOperations");
actionUndo->setIcon(*icons[int(Icons::undo_ICON)]);
actionUndo->setShortcut(QKeySequence(QKeySequence::Undo));
editTools->addAction(actionUndo);
actionRedo->setIcon(*icons[int(Icons::redo_ICON)]);
actionRedo->setShortcut(QKeySequence(QKeySequence::Redo));
editTools->addAction(actionRedo);
if (qApp->layoutDirection() == Qt::LayoutDirection::LeftToRight) {
editTools->addAction(actionUndo);
editTools->addAction(actionRedo);
}
else {
editTools->addAction(actionUndo);
editTools->addAction(actionRedo);
}
actionUndo->setEnabled(false);
actionRedo->setEnabled(false);

Expand Down

0 comments on commit d301e3d

Please sign in to comment.