mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	desktop: make DiveLocationModel entries "editable"
If the entries in the DiveLocationModel don't have their entries set as editable, the auto-completion popup turns of composition if such an item is highlighted (see Qt code in /src/widgets/itemviews/qabstractitemview.cpp), thus disabling composition of multi-key characters. Therefore, set this flag. Seems weird, but what should we do!? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									9455ca7061
								
							
						
					
					
						commit
						cfa0c9c735
					
				
					 2 changed files with 15 additions and 4 deletions
				
			
		|  | @ -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()) | ||||
|  |  | |||
|  | @ -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 { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue