diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-05-04 14:26:18 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-04-26 07:36:16 +0200 |
commit | 065548e7b45250acc236ca9d56f45fce64afb52b (patch) | |
tree | 21cf1891869d65213556ce994333806dd6960146 /util/locale_database/testlocales/localemodel.cpp | |
parent | 1d48bf34db40280c6e1f5a40b22b18f51f102660 (diff) |
Modernise testlocales/ program and make it compile
After several years unused, it had bit-rotted to the point of not
compiling and failing an assertion. It also appears to have always had
a bad free() on exit, due to passing the address of a static object to
a function that took ownership and later deleted it.
Change-Id: I91856258c3fedf820bf151b5d205d257876a8e13
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'util/locale_database/testlocales/localemodel.cpp')
-rw-r--r-- | util/locale_database/testlocales/localemodel.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/locale_database/testlocales/localemodel.cpp b/util/locale_database/testlocales/localemodel.cpp index 7d3c5cfa75..7f0150c7e0 100644 --- a/util/locale_database/testlocales/localemodel.cpp +++ b/util/locale_database/testlocales/localemodel.cpp @@ -680,7 +680,7 @@ LocaleModel::LocaleModel(QObject *parent) QVariant LocaleModel::data(const QModelIndex &index, int role) const { if (!index.isValid() - || role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::ToolTipRole + || (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::ToolTipRole) || index.column() >= g_model_cols || index.row() >= g_locale_list_count + 2) return QVariant(); @@ -821,9 +821,9 @@ int LocaleModel::rowCount(const QModelIndex &parent) const Qt::ItemFlags LocaleModel::flags(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return {}; if (index.row() == 0 && index.column() == g_model_cols - 1) - return 0; + return {}; if (index.row() == 0) return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; return QAbstractItemModel::flags(index); @@ -835,7 +835,7 @@ bool LocaleModel::setData(const QModelIndex &index, const QVariant &value, int r || index.row() != 0 || index.column() >= g_model_cols - 1 || role != Qt::EditRole - || m_data_list.at(index.column()).type() != value.type()) + || m_data_list.at(index.column()).typeId() != value.typeId()) return false; m_data_list[index.column()] = value; |