Skip to content

Commit 8b48131

Browse files
committed
Fix add/delete of buttons in non english configurations
1 parent c3f519d commit 8b48131

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/capture/button.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ size_t Button::getButtonBaseSize() {
246246
Button::Type Button::getTypeByName(const QString s) {
247247
Button::Type res = Type::last;
248248
for (auto i: typeName.toStdMap())
249-
if (i.second == s)
249+
if (tr(i.second) == s)
250250
res = i.first;
251251
return res;
252252
}

src/config/buttonlistview.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
#include <QListWidgetItem>
2121
#include <QListWidgetItem>
2222
#include <QSettings>
23+
#include <algorithm>
2324

2425
ButtonListView::ButtonListView(QWidget *parent) : QListWidget(parent) {
2526
setMouseTracking(true);
2627

2728
QSettings settings;
2829
m_listButtons = settings.value("buttons").value<QList<int> >();
30+
2931
initButtonList();
3032

3133
connect(this, &QListWidget::itemChanged, this,
@@ -62,11 +64,15 @@ void ButtonListView::initButtonList() {
6264

6365
void ButtonListView::updateActiveButtons(QListWidgetItem *item) {
6466
int buttonIndex = static_cast<int>(Button::getTypeByName(item->text()));
67+
6568
if (item->checkState() == Qt::Checked) {
6669
m_listButtons.append(buttonIndex);
70+
std::sort(m_listButtons.begin(), m_listButtons.end());
71+
6772
} else {
6873
m_listButtons.removeOne(buttonIndex);
6974
}
75+
7076
QSettings().setValue("buttons", QVariant::fromValue(m_listButtons));
7177
}
7278

0 commit comments

Comments
 (0)