mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
delegates: don't use starts-with search to fetch cylinder/weight data
In the wightsystem-type and cylinder-type delegates, when entering data, when entering known weight- or cylinder-types, some ui fields (notably weight, size and working-pressure) are automatically filled out. The search was using the default flags provided by Qt: starts-with and case-insensitive. This had a few strange effects, when entering a string that is the beginning of a known string (e.g. "AL6" when "AL63" already exists): 1) The wrong data was used if the new string didn't exist. 2) For cylinders it was impossible to create new cylinder types whose name is the starting string of a different type. 3) For weights, the new type was not added to the list of known types. This, however, is no problem, because it will be added by the undo command anyway. A future commit will address that redundancy. Therefore use only the case-insensitive flag (which has to be performed by passing the MatchFixedString flag - very weird). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c7c5dac621
commit
fb76eb9a1a
2 changed files with 3 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
Desktop: fix creation of new cylinder types (names couldn't be the start of already existing names)
|
||||
Mobile: fix no-cloud to cloud transition
|
||||
Mobile: remove locking of data storage access
|
||||
Mobile: performance improvements for dive list
|
||||
|
|
|
@ -240,7 +240,7 @@ void TankInfoDelegate::setModelData(QWidget*, QAbstractItemModel*, const QModelI
|
|||
{
|
||||
QAbstractItemModel *mymodel = currCombo.model;
|
||||
TankInfoModel *tanks = TankInfoModel::instance();
|
||||
QModelIndexList matches = tanks->match(tanks->index(0, 0), Qt::DisplayRole, currCombo.activeText);
|
||||
QModelIndexList matches = tanks->match(tanks->index(0, 0), Qt::DisplayRole, currCombo.activeText, 1, Qt::MatchFixedString | Qt::MatchWrap);
|
||||
int row;
|
||||
QString cylinderName = currCombo.activeText;
|
||||
if (matches.isEmpty()) {
|
||||
|
@ -336,7 +336,7 @@ void WSInfoDelegate::setModelData(QWidget*, QAbstractItemModel*, const QModelInd
|
|||
{
|
||||
WeightModel *mymodel = qobject_cast<WeightModel *>(currCombo.model);
|
||||
WSInfoModel *wsim = WSInfoModel::instance();
|
||||
QModelIndexList matches = wsim->match(wsim->index(0, 0), Qt::DisplayRole, currCombo.activeText);
|
||||
QModelIndexList matches = wsim->match(wsim->index(0, 0), Qt::DisplayRole, currCombo.activeText, 1, Qt::MatchFixedString | Qt::MatchWrap);
|
||||
int row;
|
||||
if (matches.isEmpty()) {
|
||||
// we need to add this puppy
|
||||
|
|
Loading…
Add table
Reference in a new issue