Skip to content

Commit

Permalink
Spreadsheet: Fix bug in content and alias lineedits
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chennes committed Nov 2, 2021
1 parent 6046790 commit 0d511a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Mod/Spreadsheet/Gui/Sheet.ui
Expand Up @@ -27,7 +27,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="SpreadsheetGui::LineEdit" name="cellContent">
<widget class="Gui::ExpressionLineEdit" name="cellContent">
<property name="enabled">
<bool>false</bool>
</property>
Expand All @@ -44,7 +44,7 @@
</widget>
</item>
<item row="0" column="3">
<widget class="SpreadsheetGui::LineEdit" name="cellAlias">
<widget class="Gui::ExpressionLineEdit" name="cellAlias">
<property name="enabled">
<bool>false</bool>
</property>
Expand All @@ -68,9 +68,9 @@ Spreadsheet.my_alias_name instead of Spreadsheet.B1</string>
<header>SheetTableView.h</header>
</customwidget>
<customwidget>
<class>SpreadsheetGui::LineEdit</class>
<class>Gui::ExpressionLineEdit</class>
<extends>QLineEdit</extends>
<header>SpreadsheetView.h</header>
<header location="global">Gui/ExpressionCompleter.h</header>
</customwidget>
</customwidgets>
<tabstops>
Expand Down
6 changes: 2 additions & 4 deletions src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp
Expand Up @@ -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));
Expand Down

0 comments on commit 0d511a6

Please sign in to comment.