Skip to content

Commit

Permalink
Spreadsheet: use ExpressionCompleter when setting DisplayUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Feb 16, 2020
1 parent dbb0a6f commit 996ed50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
10 changes: 8 additions & 2 deletions src/Mod/Spreadsheet/Gui/PropertiesDialog.cpp
Expand Up @@ -50,6 +50,9 @@ PropertiesDialog::PropertiesDialog(Sheet *_sheet, const std::vector<Range> &_ran
ui->foregroundColor->setStandardColors();
ui->backgroundColor->setStandardColors();

ui->displayUnit->setDocumentObject(_sheet);
ui->displayUnit->setSearchUnit(true);

assert(ranges.size() > 0);
Range range = ranges[0];

Expand Down Expand Up @@ -101,7 +104,10 @@ PropertiesDialog::PropertiesDialog(Sheet *_sheet, const std::vector<Range> &_ran
if (style.find("underline") != style.end())
ui->styleUnderline->setChecked(true);

ui->displayUnit->setText(Base::Tools::fromStdString(displayUnit.stringRep));
{
QSignalBlocker blocker(ui->displayUnit);
ui->displayUnit->setText(Base::Tools::fromStdString(displayUnit.stringRep));
}

ui->alias->setText(Base::Tools::fromStdString(alias));

Expand All @@ -123,7 +129,7 @@ PropertiesDialog::PropertiesDialog(Sheet *_sheet, const std::vector<Range> &_ran
connect(ui->styleUnderline, SIGNAL(clicked()), this, SLOT(styleChanged()));

// Display unit
connect(ui->displayUnit, SIGNAL(textEdited(QString)), this, SLOT(displayUnitChanged(QString)));
connect(ui->displayUnit, SIGNAL(textChanged(QString)), this, SLOT(displayUnitChanged(QString)));

// Alias is only allowed for a single cell
ui->tabWidget->widget(4)->setEnabled(_ranges.size() == 1 && _ranges[0].size() == 1);
Expand Down
20 changes: 8 additions & 12 deletions src/Mod/Spreadsheet/Gui/PropertiesDialog.ui
Expand Up @@ -27,7 +27,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
Expand Down Expand Up @@ -128,16 +128,7 @@
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
Expand Down Expand Up @@ -241,7 +232,7 @@
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<widget class="QLineEdit" name="displayUnit"/>
<widget class="Gui::ExpressionLineEdit" name="displayUnit"/>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
Expand Down Expand Up @@ -306,6 +297,11 @@
<header>qtcolorpicker.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>Gui::ExpressionLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">Gui/ExpressionCompleter.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
Expand Down

0 comments on commit 996ed50

Please sign in to comment.