diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 3c97360fd..76afaee79 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -421,6 +421,16 @@ int DiveLocationModel::rowCount(const QModelIndex&) const return dive_site_table.nr + 2; } +Qt::ItemFlags DiveLocationModel::flags(const QModelIndex &index) const +{ + // This is crazy: If an entry is not marked as editable, the QListView + // (or rather the QAbstractItemView base class) clears the WA_InputMethod + // flag, which means that key-composition events are disabled. This + // breaks composition as long as the popup is openen. Therefore, + // make all items editable. + return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; +} + bool DiveLocationModel::setData(const QModelIndex &index, const QVariant &value, int) { if (!index.isValid()) diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h index c94623e23..ec8554feb 100644 --- a/desktop-widgets/locationinformation.h +++ b/desktop-widgets/locationinformation.h @@ -67,12 +67,13 @@ class DiveLocationModel : public QAbstractTableModel { public: DiveLocationModel(QObject *o = 0); void resetModel(); - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - int rowCount(const QModelIndex& parent = QModelIndex()) const; - int columnCount(const QModelIndex& parent = QModelIndex()) const; - bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole); + bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; private: QString new_ds_value[2]; + Qt::ItemFlags flags(const QModelIndex &index) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; }; class DiveLocationListView : public QListView {