Use natural sort order in Bin

CCBUG: 363604
parent d1f78ac6
......@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
ProjectSortProxyModel::ProjectSortProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
m_collator.setNumericMode(true);
m_selection = new QItemSelectionModel(this);
connect(m_selection, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(onCurrentRowChanged(QItemSelection,QItemSelection)));
setDynamicSortFilter(true);
......@@ -95,7 +96,7 @@ bool ProjectSortProxyModel::lessThan(const QModelIndex & left, const QModelIndex
if (leftData.type() == QVariant::DateTime) {
return leftData.toDateTime() < rightData.toDateTime();
}
return QSortFilterProxyModel::lessThan(right, left);
return m_collator.compare(leftData.toString(), rightData.toString()) < 0;
}
if (sortOrder() == Qt::AscendingOrder) return leftType < rightType;
return leftType > rightType;
......
......@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PROJECTSORTPROXYMODEL_H
#include <QSortFilterProxyModel>
#include <QCollator>
class QItemSelectionModel;
......@@ -61,6 +62,7 @@ protected:
private:
QItemSelectionModel*m_selection;
QString m_searchString;
QCollator m_collator;
signals:
/** @brief Emitted when the row changes, used to prepare action for selected item */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment