Workaround GCC bug and fix Linux build.

This commit is contained in:
John Preston 2017-06-28 12:17:27 +03:00
parent 67f2daa43c
commit 2a51e2aa59

View file

@ -57,9 +57,9 @@ void InnerWidget::enumerateItems(Method method) {
auto begin = std::rbegin(_items), end = std::rend(_items); auto begin = std::rbegin(_items), end = std::rend(_items);
auto from = TopToBottom ? std::lower_bound(begin, end, _visibleTop, [this](auto &elem, int top) { auto from = TopToBottom ? std::lower_bound(begin, end, _visibleTop, [this](auto &elem, int top) {
return itemTop(elem) + elem->height() <= top; return this->itemTop(elem) + elem->height() <= top;
}) : std::upper_bound(begin, end, _visibleBottom, [this](int bottom, auto &elem) { }) : std::upper_bound(begin, end, _visibleBottom, [this](int bottom, auto &elem) {
return itemTop(elem) + elem->height() >= bottom; return this->itemTop(elem) + elem->height() >= bottom;
}); });
auto wasEnd = (from == end); auto wasEnd = (from == end);
if (wasEnd) { if (wasEnd) {
@ -245,8 +245,8 @@ void InnerWidget::updateVisibleTopItem() {
_visibleTopItem = nullptr; _visibleTopItem = nullptr;
} else { } else {
auto begin = std::rbegin(_items), end = std::rend(_items); auto begin = std::rbegin(_items), end = std::rend(_items);
auto from = std::lower_bound(begin, end, _visibleTop, [this](auto &elem, int top) { auto from = std::lower_bound(begin, end, _visibleTop, [this](auto &&elem, int top) {
return itemTop(elem) + elem->height() <= top; return this->itemTop(elem) + elem->height() <= top;
}); });
if (from != end) { if (from != end) {
_visibleTopItem = *from; _visibleTopItem = *from;
@ -511,10 +511,10 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
} else { } else {
auto begin = std::rbegin(_items), end = std::rend(_items); auto begin = std::rbegin(_items), end = std::rend(_items);
auto from = std::lower_bound(begin, end, clip.top(), [this](auto &elem, int top) { auto from = std::lower_bound(begin, end, clip.top(), [this](auto &elem, int top) {
return itemTop(elem) + elem->height() <= top; return this->itemTop(elem) + elem->height() <= top;
}); });
auto to = std::lower_bound(begin, end, clip.top() + clip.height(), [this](auto &elem, int bottom) { auto to = std::lower_bound(begin, end, clip.top() + clip.height(), [this](auto &elem, int bottom) {
return itemTop(elem) < bottom; return this->itemTop(elem) < bottom;
}); });
if (from != end) { if (from != end) {
auto top = itemTop(from->get()); auto top = itemTop(from->get());
@ -1056,7 +1056,7 @@ void InnerWidget::updateSelected() {
auto itemPoint = QPoint(); auto itemPoint = QPoint();
auto begin = std::rbegin(_items), end = std::rend(_items); auto begin = std::rbegin(_items), end = std::rend(_items);
auto from = (point.y() >= _itemsTop && point.y() < _itemsTop + _itemsHeight) ? std::lower_bound(begin, end, point.y(), [this](auto &elem, int top) { auto from = (point.y() >= _itemsTop && point.y() < _itemsTop + _itemsHeight) ? std::lower_bound(begin, end, point.y(), [this](auto &elem, int top) {
return itemTop(elem) + elem->height() <= top; return this->itemTop(elem) + elem->height() <= top;
}) : end; }) : end;
auto item = (from != end) ? from->get() : nullptr; auto item = (from != end) ? from->get() : nullptr;
if (item) { if (item) {