Resolved issue #732. Tape app. Improve Database dialog.
--HG-- branch : develop
This commit is contained in:
parent
2aaffd0e0d
commit
0cc551b786
|
@ -39,6 +39,7 @@
|
||||||
- New internal variable RotationElArc.
|
- New internal variable RotationElArc.
|
||||||
- [#794] Better control over scale value.
|
- [#794] Better control over scale value.
|
||||||
- [#392] Improve feature: Show progress bar while opening pattern file.
|
- [#392] Improve feature: Show progress bar while opening pattern file.
|
||||||
|
- [#732] Tape app. Improve Database dialog.
|
||||||
|
|
||||||
# Version 0.5.1
|
# Version 0.5.1
|
||||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||||
|
|
|
@ -68,6 +68,7 @@ DialogMDataBase::DialogMDataBase(const QStringList &list, QWidget *parent)
|
||||||
connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &DialogMDataBase::UpdateChecks);
|
connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &DialogMDataBase::UpdateChecks);
|
||||||
connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription);
|
connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription);
|
||||||
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &DialogMDataBase::TreeMenu);
|
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &DialogMDataBase::TreeMenu);
|
||||||
|
connect(ui->lineEditSearch, &QLineEdit::textChanged, this, &DialogMDataBase::FilterMeasurements);
|
||||||
|
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
}
|
}
|
||||||
|
@ -105,6 +106,7 @@ DialogMDataBase::DialogMDataBase(QWidget *parent)
|
||||||
connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription);
|
connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription);
|
||||||
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &DialogMDataBase::TreeMenu);
|
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &DialogMDataBase::TreeMenu);
|
||||||
connect(ui->treeWidget, &QTreeWidget::itemActivated, this, &DialogMDataBase::ShowDescription);
|
connect(ui->treeWidget, &QTreeWidget::itemActivated, this, &DialogMDataBase::ShowDescription);
|
||||||
|
connect(ui->lineEditSearch, &QLineEdit::textChanged, this, &DialogMDataBase::FilterMeasurements);
|
||||||
|
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
}
|
}
|
||||||
|
@ -307,19 +309,7 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
|
void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
|
||||||
{
|
{
|
||||||
if (column != 0 && column != -1)
|
if ((column != 0 && column != -1) || item == nullptr || item->childCount() != 0)
|
||||||
{
|
|
||||||
ui->textEdit->clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item == nullptr)
|
|
||||||
{
|
|
||||||
ui->textEdit->clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->childCount() != 0)
|
|
||||||
{
|
{
|
||||||
ui->textEdit->clear();
|
ui->textEdit->clear();
|
||||||
return;
|
return;
|
||||||
|
@ -399,6 +389,31 @@ void DialogMDataBase::Recheck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogMDataBase::FilterMeasurements(const QString &search)
|
||||||
|
{
|
||||||
|
FilterGroup(groupA, search);
|
||||||
|
FilterGroup(groupB, search);
|
||||||
|
FilterGroup(groupC, search);
|
||||||
|
FilterGroup(groupD, search);
|
||||||
|
FilterGroup(groupE, search);
|
||||||
|
FilterGroup(groupF, search);
|
||||||
|
FilterGroup(groupG, search);
|
||||||
|
FilterGroup(groupH, search);
|
||||||
|
FilterGroup(groupI, search);
|
||||||
|
FilterGroup(groupJ, search);
|
||||||
|
FilterGroup(groupK, search);
|
||||||
|
FilterGroup(groupL, search);
|
||||||
|
FilterGroup(groupM, search);
|
||||||
|
FilterGroup(groupN, search);
|
||||||
|
FilterGroup(groupO, search);
|
||||||
|
FilterGroup(groupP, search);
|
||||||
|
FilterGroup(groupQ, search);
|
||||||
|
|
||||||
|
const QList<QTreeWidgetItem *> list = ui->treeWidget->selectedItems();
|
||||||
|
list.isEmpty() ? ShowDescription(nullptr, -1) : ShowDescription(list.first(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogMDataBase::InitDataBase(const QStringList &list)
|
void DialogMDataBase::InitDataBase(const QStringList &list)
|
||||||
{
|
{
|
||||||
|
@ -432,6 +447,29 @@ void DialogMDataBase::InitGroup(QTreeWidgetItem **group, const QString &groupNam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogMDataBase::FilterGroup(QTreeWidgetItem *group, const QString &search)
|
||||||
|
{
|
||||||
|
SCASSERT(group != nullptr)
|
||||||
|
|
||||||
|
bool match = false;
|
||||||
|
for (int i=0; i < group->childCount(); ++i)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *childItem = group->child(i);
|
||||||
|
const bool hidden = (not childItem->isSelected()
|
||||||
|
&& not childItem->text(0).contains(search, Qt::CaseInsensitive))
|
||||||
|
|| (childItem->isSelected() && not ui->textEdit->toPlainText().contains(search, Qt::CaseInsensitive)
|
||||||
|
&& not childItem->text(0).contains(search, Qt::CaseInsensitive));
|
||||||
|
childItem->setHidden(hidden);
|
||||||
|
if (not hidden)
|
||||||
|
{
|
||||||
|
match = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
group->setHidden(not group->text(0).contains(search, Qt::CaseInsensitive) && not match);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QTreeWidgetItem *DialogMDataBase::AddGroup(const QString &text)
|
QTreeWidgetItem *DialogMDataBase::AddGroup(const QString &text)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@ private slots:
|
||||||
void ShowDescription(QTreeWidgetItem *item, int column);
|
void ShowDescription(QTreeWidgetItem *item, int column);
|
||||||
void TreeMenu(const QPoint &pos);
|
void TreeMenu(const QPoint &pos);
|
||||||
void Recheck();
|
void Recheck();
|
||||||
|
void FilterMeasurements(const QString &search);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogMDataBase)
|
Q_DISABLE_COPY(DialogMDataBase)
|
||||||
|
@ -90,6 +91,7 @@ private:
|
||||||
void InitDataBase(const QStringList &list = QStringList());
|
void InitDataBase(const QStringList &list = QStringList());
|
||||||
void InitGroup(QTreeWidgetItem **group, const QString &groupName, const QStringList &mList,
|
void InitGroup(QTreeWidgetItem **group, const QString &groupName, const QStringList &mList,
|
||||||
const QStringList &list = QStringList());
|
const QStringList &list = QStringList());
|
||||||
|
void FilterGroup(QTreeWidgetItem *group, const QString &search);
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QTreeWidgetItem *AddGroup(const QString &text);
|
Q_REQUIRED_RESULT QTreeWidgetItem *AddGroup(const QString &text);
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,35 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelSearch">
|
||||||
|
<property name="text">
|
||||||
|
<string>Search:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditSearch">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Search</string>
|
||||||
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -64,9 +91,15 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="undoRedoEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="readOnly">
|
<property name="readOnly">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Select measurement</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user