Disable unchecking a section if all child in the list. Backgroud color show
sections and measurements in the list. --HG-- branch : feature
This commit is contained in:
parent
925805a5e3
commit
5615817334
|
@ -100,12 +100,19 @@ void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column)
|
||||||
|
|
||||||
if (item->childCount() != 0 && item->checkState(0) != Qt::PartiallyChecked && column != -1)
|
if (item->childCount() != 0 && item->checkState(0) != Qt::PartiallyChecked && column != -1)
|
||||||
{
|
{
|
||||||
|
bool flag = false; // Check if we could change atleast one children
|
||||||
Qt::CheckState checkState = item->checkState(0);
|
Qt::CheckState checkState = item->checkState(0);
|
||||||
for (int i = 0; i < item->childCount(); ++i)
|
for (int i = 0; i < item->childCount(); ++i)
|
||||||
{
|
{
|
||||||
if (not list.contains(item->child(i)->data(0, Qt::UserRole).toString()))
|
if (not list.contains(item->child(i)->data(0, Qt::UserRole).toString()))
|
||||||
{
|
{
|
||||||
item->child(i)->setCheckState(0, checkState);
|
item->child(i)->setCheckState(0, checkState);
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag == false) // All child in the list
|
||||||
|
{
|
||||||
|
item->setCheckState(0, Qt::Checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,6 +613,7 @@ QTreeWidgetItem *DialogMDataBase::AddGroup(const QString &text)
|
||||||
{
|
{
|
||||||
group->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
group->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||||
group->setCheckState(0, Qt::Unchecked);
|
group->setCheckState(0, Qt::Unchecked);
|
||||||
|
group->setBackground(0, QBrush(Qt::lightGray));
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
@ -621,6 +629,7 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
|
||||||
{
|
{
|
||||||
m->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
m->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
m->setCheckState(0, Qt::Checked);
|
m->setCheckState(0, Qt::Checked);
|
||||||
|
m->setBackground(0, QBrush(Qt::yellow));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -628,6 +637,8 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateChecks(m, 0);
|
||||||
|
|
||||||
const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
|
const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
|
||||||
m->setText(0, text);
|
m->setText(0, text);
|
||||||
m->setToolTip(0, text);
|
m->setToolTip(0, text);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user