QFileSystemModel: make it clearer how new Roles should be added

New Roles in user code should start from `Qt::UserRole + 1`; whereas in
Qt code itself it should start from `Qt::UserRole - 1`; adjust the
enumerators accordingly, to have less differences between Qt6 and Qt7.

Change-Id: Ib20f95e841d4d252fa9dd085530e6f3257d2776d
Reviewed-by: Sune Vuorela <sune@vuorela.dk>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0a133035963b83e886578b9621b1275780c7d9cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ahmad Samir 2024-06-10 12:59:41 +03:00 committed by Qt Cherry-pick Bot
parent fc3ac85db9
commit ca0f9c4ce8

View File

@ -34,12 +34,14 @@ Q_SIGNALS:
public:
enum Roles {
FileIconRole = Qt::DecorationRole,
FileInfoRole = Qt::UserRole - 4, // New values go before, -5, -6 ..etc
QT7_ONLY(
FilePathRole = Qt::UserRole - 4,
FileNameRole = Qt::UserRole - 3,
FilePermissions = Qt::UserRole - 2,
FilePathRole = Qt::UserRole - 3,
FileNameRole = Qt::UserRole - 2,
FilePermissions = Qt::UserRole - 1,
)
FileInfoRole = Qt::UserRole - 1,
QT6_ONLY(
FilePathRole = Qt::UserRole + 1,
FileNameRole = Qt::UserRole + 2,