From 0d511a6dd227b6d463c533e460657d7bd3380e7b Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Tue, 2 Nov 2021 10:10:28 -0500 Subject: [PATCH] Spreadsheet: Fix bug in content and alias lineedits The two line edit widgets above the spreadsheet, one for exiting the cell contents and one for editing the alias, were set to use the same editing widget as the individual spreadsheet cells. Once that widget was refactored to handle tab/enter behavior it was no longer the correct widget for those elements. This commit changes them to Gui::ExpressionLineEdit widgets instead, so that the Enter key works correctly for them again. --- src/Mod/Spreadsheet/Gui/Sheet.ui | 8 ++++---- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Mod/Spreadsheet/Gui/Sheet.ui b/src/Mod/Spreadsheet/Gui/Sheet.ui index 5704291d1e..68aa09998e 100644 --- a/src/Mod/Spreadsheet/Gui/Sheet.ui +++ b/src/Mod/Spreadsheet/Gui/Sheet.ui @@ -27,7 +27,7 @@ - + false @@ -44,7 +44,7 @@ - + false @@ -68,9 +68,9 @@ Spreadsheet.my_alias_name instead of Spreadsheet.B1
SheetTableView.h
- SpreadsheetGui::LineEdit + Gui::ExpressionLineEdit QLineEdit -
SpreadsheetView.h
+
Gui/ExpressionCompleter.h
diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 3d2056cb3f..df46121a19 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -99,10 +99,8 @@ SheetView::SheetView(Gui::Document *pcDocument, App::DocumentObject *docObj, QWi this, SLOT(rowResized(int, int, int))); connect(delegate, &SpreadsheetDelegate::finishedWithKey, this, &SheetView::editingFinishedWithKey); - connect(ui->cellContent, &LineEdit::finishedWithKey, this, [this](int, Qt::KeyboardModifiers) {confirmContentChanged(ui->cellContent->text()); }); - connect(ui->cellContent, &LineEdit::returnPressed, this, [this]() {confirmContentChanged(ui->cellContent->text()); }); - connect(ui->cellAlias, &LineEdit::finishedWithKey, this, [this](int, Qt::KeyboardModifiers) {confirmAliasChanged(ui->cellAlias->text()); }); - connect(ui->cellAlias, &LineEdit::returnPressed, this, [this]() {confirmAliasChanged(ui->cellAlias->text()); }); + connect(ui->cellContent, &ExpressionLineEdit::returnPressed, this, [this]() {confirmContentChanged(ui->cellContent->text()); }); + connect(ui->cellAlias, &ExpressionLineEdit::returnPressed, this, [this]() {confirmAliasChanged(ui->cellAlias->text()); }); connect(ui->cellAlias, &LineEdit::textEdited, this, &SheetView::aliasChanged); columnWidthChangedConnection = sheet->columnWidthChanged.connect(bind(&SheetView::resizeColumn, this, bp::_1, bp::_2));