forked from qt-creator/qt-creator
fix GCC 10.2.1 arm std::ranges::dangling compile issues
error was: src/plugins/qmldesigner/components/componentcore/zoomaction.cpp:97:14: error: no match for ‘operator!=’ (operand types are ‘std::ranges::dangling’ and ‘std::array<double, 27>::reverse_iterator’ {aka ‘std::reverse_iterator<double*>’}) Change-Id: Ifefc4d17791fc5eb8a1446538b429410692b6d2e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -93,13 +93,15 @@ double ZoomAction::setPreviousZoomFactor(double zoom)
|
|||||||
return zoom;
|
return zoom;
|
||||||
|
|
||||||
auto smaller = [zoom](double val) { return val < zoom; };
|
auto smaller = [zoom](double val) { return val < zoom; };
|
||||||
if (auto iter = std::ranges::find_if(m_zooms | std::views::reverse, smaller);
|
auto iter = std::find_if(m_zooms.rbegin(), m_zooms.rend(), smaller);
|
||||||
iter != m_zooms.rend()) {
|
|
||||||
|
if (iter != m_zooms.rend()) {
|
||||||
auto index = std::distance(iter, m_zooms.rend() - 1);
|
auto index = std::distance(iter, m_zooms.rend() - 1);
|
||||||
m_combo->setCurrentIndex(static_cast<int>(index));
|
m_combo->setCurrentIndex(static_cast<int>(index));
|
||||||
m_combo->setToolTip(m_combo->currentText());
|
m_combo->setToolTip(m_combo->currentText());
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
return zoom;
|
return zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,8 +74,8 @@ static qreal next(const QVector<qreal> &vector, qreal current)
|
|||||||
|
|
||||||
static qreal previous(const QVector<qreal> &vector, qreal current)
|
static qreal previous(const QVector<qreal> &vector, qreal current)
|
||||||
{
|
{
|
||||||
auto iter = std::ranges::find_if(vector | std::views::reverse,
|
auto iter = std::find_if(vector.rbegin(), vector.rend(),
|
||||||
[&](qreal val) { return val < current; });
|
[&](qreal val) { return val < current; });
|
||||||
if (iter != vector.rend())
|
if (iter != vector.rend())
|
||||||
return *iter;
|
return *iter;
|
||||||
return current;
|
return current;
|
||||||
|
Reference in New Issue
Block a user