From d0d0304ce4840673741acb00d25f16a784b34ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 11 Mar 2012 09:04:29 +0100 Subject: [PATCH] Set completion inline due to a bug in Qt for popup mode --- README | 2 +- README.fr | 2 +- src/view/grid/GridAccount.cpp | 3 +++ src/view/grid/GridAccount.hpp | 1 - src/view/grid/TabDelegate.cpp | 10 +++++----- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README b/README index ffc7dd6..83d3a2e 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ KissCount is personnal account software delivered under GPL v3 licence terms. Current version is 0.3 -Qt4 (>= 4.7), libqt4-sql-sqlite and libofx are needed +Qt4 (>= 4.7), libqt4-sql-sqlite and libofx (Linux only) are needed If you use web view, edit database.php and set $BDD_FILE, it's higly recommanded to use an SSL certificate. diff --git a/README.fr b/README.fr index 3589b79..38111a6 100644 --- a/README.fr +++ b/README.fr @@ -2,7 +2,7 @@ KissCount est un logiciel de gestion de comptes personnels délivré sous licenc La version actuelle est 0.3 -Qt4 (>= 4.7), libqt4-sql-sqlite et libofx sont nécessaires +Qt4 (>= 4.7), libqt4-sql-sqlite et libofx (Uniquement pour Linux) sont nécessaires Si vous utilisez la version web pour visualiser vos comptes, éditez d'abord le fichier database.php en positionnant correctement la variable $BDD_FILE, il est fortement recommandé d'utiliser un certificat SSL. diff --git a/src/view/grid/GridAccount.cpp b/src/view/grid/GridAccount.cpp index 58a3962..e7b3be9 100644 --- a/src/view/grid/GridAccount.cpp +++ b/src/view/grid/GridAccount.cpp @@ -225,6 +225,7 @@ void GridAccount::LoadOperations(std::vector* operations, int month, _kiss->GetHistory(month, year, list); _completer = new QCompleter(list); _completer->setCaseSensitivity(Qt::CaseInsensitive); + _completer->setCompletionMode(QCompleter::InlineCompletion); } TabDelegate* descriptionEditor = new TabDelegate(this, &_displayedOperations, _completer); @@ -431,6 +432,8 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, } else { + item = new QTableWidgetItem(""); + setItem(line, DESCRIPTION, item); if (fix) { SET_ROW_COLOR(line, view::OWN_YELLOW, Qt::black); diff --git a/src/view/grid/GridAccount.hpp b/src/view/grid/GridAccount.hpp index 54bf5c1..310f0f2 100644 --- a/src/view/grid/GridAccount.hpp +++ b/src/view/grid/GridAccount.hpp @@ -85,7 +85,6 @@ private: QSignalMapper _treeSignalMapper, _checkSignalMapper, _deleteSignalMapper; bool _inModification; QCompleter* _completer; - void SetWeek(int week, int line); void ResetWeeks(); void ComputeWeeks(); diff --git a/src/view/grid/TabDelegate.cpp b/src/view/grid/TabDelegate.cpp index 5a57d00..ca08f4b 100644 --- a/src/view/grid/TabDelegate.cpp +++ b/src/view/grid/TabDelegate.cpp @@ -27,7 +27,7 @@ QWidget * TabDelegate::createEditor (QWidget * parent, const QStyleOptionViewIte QLineEdit* lineEdit = new QLineEdit(parent); if (_completer) - lineEdit->setCompleter(_completer); + lineEdit->setCompleter(_completer); return lineEdit; } @@ -38,11 +38,11 @@ void TabDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, QLineEdit *line = qobject_cast(editor); QString value = line->text().trimmed(); - if (index.row() < _operations->size() && (*_operations)[index.row()].id && - (*_operations)[index.row()].parent) - model->setData(index, qVariantFromValue(" " + value)); + if (index.row() < (int) _operations->size() && (*_operations)[index.row()].id && + (*_operations)[index.row()].parent) + model->setData(index, qVariantFromValue(" " + value)); else - model->setData(index, qVariantFromValue(value)); + model->setData(index, qVariantFromValue(value)); } void TabDelegate::setEditorData(QWidget *editor,