summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/filterconstraint.cpp2
-rw-r--r--desktop-widgets/filterconstraintwidget.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/core/filterconstraint.cpp b/core/filterconstraint.cpp
index 6922f1530..54654457f 100644
--- a/core/filterconstraint.cpp
+++ b/core/filterconstraint.cpp
@@ -1059,7 +1059,7 @@ static bool check_year_range(const filter_constraint &c, const struct dive *d)
static bool check_multiple_choice(const filter_constraint &c, int v)
{
- bool has_bit = c.data.multiple_choice & (1 << v);
+ bool has_bit = c.data.multiple_choice & (1ULL << v);
return has_bit != c.negate;
}
diff --git a/desktop-widgets/filterconstraintwidget.cpp b/desktop-widgets/filterconstraintwidget.cpp
index 441ab73ea..418fca0d5 100644
--- a/desktop-widgets/filterconstraintwidget.cpp
+++ b/desktop-widgets/filterconstraintwidget.cpp
@@ -324,7 +324,7 @@ void FilterConstraintWidget::update()
if (multipleChoice) {
uint64_t bits = idx.data(FilterConstraintModel::MULTIPLE_CHOICE_ROLE).value<uint64_t>();
for (int i = 0; i < multipleChoice->count(); ++i)
- multipleChoice->item(i)->setSelected(bits & (1 << i));
+ multipleChoice->item(i)->setSelected(bits & (1ULL << i));
}
// Update the unit strings in case the locale was changed
@@ -392,9 +392,11 @@ void FilterConstraintWidget::multipleChoiceEdited()
uint64_t bits = 0;
for (const QModelIndex &idx: multipleChoice->selectionModel()->selectedIndexes()) {
int row = idx.row();
- if (row >= 64)
+ if (row >= 64) {
qWarning("FilterConstraint: multiple-choice with more than 64 entries not supported");
- bits |= 1 << row;
+ continue;
+ }
+ bits |= 1ULL << row;
}
QModelIndex idx = model->index(row, 0);
model->setData(idx, qulonglong(bits), FilterConstraintModel::MULTIPLE_CHOICE_ROLE);