Merge with develop

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-10 11:28:08 +02:00
commit 0dbf26a109
5 changed files with 77 additions and 1 deletions

View File

@ -159,3 +159,6 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
# Understand IDE file
*.udb

View File

@ -1,4 +1,5 @@
# Version 0.5.0
- [#581] User can now filter input lists by keyword in function wizard.
- [#24] User can now add labels with different information on the detail
- [#505] New installer script based on Inno Setup 5.
- Size of preferences dialog in both Valentina and Tape app is now preserved between sessions

View File

@ -85,6 +85,11 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const qui
this->formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this);
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->filterFormulaInputs->setClearButtonEnabled(true);
#endif
connect(ui->filterFormulaInputs, &QLineEdit::textChanged, this, &DialogEditWrongFormula::FilterVariablesEdited);
InitOkCancel(ui);
flagFormula = false;
CheckState();
@ -398,16 +403,37 @@ void DialogEditWrongFormula::InitVariables()
ui->radioButtonStandardTable->setChecked(true);
Measurements();
// clear text filter every time when new radio button selected
auto ClearFilterFormulaInputs = [=] () { ui->filterFormulaInputs->clear(); };
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogEditWrongFormula::Measurements);
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEditWrongFormula::Increments);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthLines);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthCurves);
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonAngleLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::AngleLines);
connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements);
connect(ui->radioButtonAngleLine, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs);
connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves);
connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonCLength, &QRadioButton::clicked, this, &DialogEditWrongFormula::CurvesCLength);
connect(ui->radioButtonCLength, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, &DialogEditWrongFormula::Functions);
connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, ClearFilterFormulaInputs);
connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements);
}
//---------------------------------------------------------------------------------------------------------------------
@ -529,3 +555,40 @@ void DialogEditWrongFormula::ShowFunctions()
ui->tableWidget->selectRow(0);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::FilterVariablesEdited(const QString &filter)
{
ui->tableWidget->blockSignals(true);
// If filter is empty findItems() for unknown reason returns nullptr items.
// See issue #586. https://bitbucket.org/dismine/valentina/issues/586/valentina-crashes-if-clear-input-filter
if (filter.isEmpty())
{
// show all rows
for (auto i = 0; i < ui->tableWidget->rowCount(); ++i)
{
ui->tableWidget->showRow(i);
}
}
else
{
// hide all rows
for (auto i = 0; i < ui->tableWidget->rowCount(); i++)
{
ui->tableWidget->hideRow(i);
}
// show rows with matched filter
for (auto item : ui->tableWidget->findItems(filter, Qt::MatchContains))
{
// If filter is empty findItems() for unknown reason returns nullptr items.
if (item)
{
ui->tableWidget->showRow(item->row());
}
}
}
ui->tableWidget->blockSignals(false);
}

View File

@ -96,6 +96,8 @@ protected:
virtual void CheckState() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
private slots:
void FilterVariablesEdited(const QString &filter);
private:
Q_DISABLE_COPY(DialogEditWrongFormula)
Ui::DialogEditWrongFormula *ui;

View File

@ -355,6 +355,13 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="filterFormulaInputs">
<property name="placeholderText">
<string>Filter list by keyword</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHideEmpty">
<property name="text">