diff --git a/src/krecursivefilterproxymodel.cpp b/src/krecursivefilterproxymodel.cpp index 21ed5d6..014e107 100644 --- a/src/krecursivefilterproxymodel.cpp +++ b/src/krecursivefilterproxymodel.cpp @@ -31,14 +31,7 @@ // to be cleared, even if only a part of it is dirty. // Stephen Kelly, 30 April 2010. -inline static bool passRolesToDataChanged() -{ - // runtime check to ensure a KF5 built against Qt < 5.5 keeps working when Qt is updated to 5.5 and above but KF5 is not rebuild - // TODO: remove once Qt 5.5 or above is required for frameworks - static const bool passRoles = QT_VERSION >= 0x050500 // no runtime check required when we built against Qt 5.5 or higher - || KRecursiveFilterProxyModel::staticMetaObject.indexOfMethod("_q_sourceDataChanged(QModelIndex,QModelIndex,QVector)") != -1; - return passRoles; -} +// All this is temporary anyway, the long term solution is support in QSFPM: https://codereview.qt-project.org/151000 class KRecursiveFilterProxyModelPrivate { @@ -65,21 +58,12 @@ public: inline void invokeDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles = QVector()) { Q_Q(KRecursiveFilterProxyModel); - bool success = false; - if (passRolesToDataChanged()) { - // required for Qt 5.5 and upwards, see commit f96baeb75fc in qtbase - static const QMetaMethod m = findMethod("_q_sourceDataChanged(QModelIndex,QModelIndex,QVector)"); - success = m.invoke(q, Qt::DirectConnection, - Q_ARG(QModelIndex, topLeft), - Q_ARG(QModelIndex, bottomRight), - Q_ARG(QVector, roles)); - } else { - // backwards compatibility - static const QMetaMethod m = findMethod("_q_sourceDataChanged(QModelIndex,QModelIndex)"); - success = m.invoke(q, Qt::DirectConnection, - Q_ARG(QModelIndex, topLeft), - Q_ARG(QModelIndex, bottomRight)); - } + // required for Qt 5.5 and upwards, see commit f96baeb75fc in qtbase + static const QMetaMethod m = findMethod("_q_sourceDataChanged(QModelIndex,QModelIndex,QVector)"); + bool success = m.invoke(q, Qt::DirectConnection, + Q_ARG(QModelIndex, topLeft), + Q_ARG(QModelIndex, bottomRight), + Q_ARG(QVector, roles)); Q_UNUSED(success); Q_ASSERT(success); } @@ -320,13 +304,8 @@ void KRecursiveFilterProxyModel::setSourceModel(QAbstractItemModel *model) { // Standard disconnect of the previous source model, if present if (sourceModel()) { - if (passRolesToDataChanged()) { - disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - this, SLOT(sourceDataChanged(QModelIndex,QModelIndex,QVector))); - } else { - disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(sourceDataChanged(QModelIndex,QModelIndex))); - } + disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), + this, SLOT(sourceDataChanged(QModelIndex,QModelIndex,QVector))); disconnect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(sourceRowsAboutToBeInserted(QModelIndex,int,int))); @@ -411,13 +390,8 @@ void KRecursiveFilterProxyModel::setSourceModel(QAbstractItemModel *model) return; } - if (passRolesToDataChanged()) { - disconnect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); - } else { - disconnect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex))); - } + disconnect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), + this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector))); disconnect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int))); @@ -432,13 +406,8 @@ void KRecursiveFilterProxyModel::setSourceModel(QAbstractItemModel *model) this, SLOT(_q_sourceRowsRemoved(QModelIndex,int,int))); // Slots for manual invoking of QSortFilterProxyModel methods. - if (passRolesToDataChanged()) { - connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), - this, SLOT(sourceDataChanged(QModelIndex,QModelIndex,QVector))); - } else { - connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(sourceDataChanged(QModelIndex,QModelIndex))); - } + connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector)), + this, SLOT(sourceDataChanged(QModelIndex,QModelIndex,QVector))); connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(sourceRowsAboutToBeInserted(QModelIndex,int,int)));