edited general settings categories (#2117)

* edited general settings categories

* Update CHANGELOG.md
This commit is contained in:
fourtf
2020-10-23 14:26:04 +02:00
committed by GitHub
parent 5f54b1b495
commit 11525e626a
5 changed files with 180 additions and 117 deletions
@@ -40,6 +40,11 @@ void GeneralPageView::addLayout(QLayout *layout)
this->contentLayout_->addLayout(layout);
}
void GeneralPageView::addStretch()
{
this->contentLayout_->addStretch();
}
TitleLabel *GeneralPageView::addTitle(const QString &title)
{
// space
@@ -68,6 +73,16 @@ TitleLabel *GeneralPageView::addTitle(const QString &title)
return label;
}
SubtitleLabel *GeneralPageView::addSubtitle(const QString &title)
{
auto label = new SubtitleLabel(title + ":");
this->addWidget(label);
this->groups_.back().widgets.push_back({label, {title}});
return label;
}
QCheckBox *GeneralPageView::addCheckbox(const QString &text,
BoolSetting &setting, bool inverse)
{
@@ -224,7 +239,9 @@ bool GeneralPageView::filterElements(const QString &query)
{
for (auto &&widget : group.widgets)
widget.element->show();
group.title->show();
group.navigationLink->show();
any = true;
}
// check if any match
@@ -232,12 +249,26 @@ bool GeneralPageView::filterElements(const QString &query)
{
auto groupAny = false;
QWidget *currentSubtitle = nullptr;
bool currentSubtitleVisible = false;
for (auto &&widget : group.widgets)
{
if (dynamic_cast<SubtitleLabel *>(widget.element))
{
if (currentSubtitle)
currentSubtitle->setVisible(currentSubtitleVisible);
currentSubtitleVisible = false;
currentSubtitle = widget.element;
continue;
}
for (auto &&keyword : widget.keywords)
{
if (keyword.contains(query, Qt::CaseInsensitive))
{
currentSubtitleVisible = true;
widget.element->show();
groupAny = true;
}
@@ -248,9 +279,14 @@ bool GeneralPageView::filterElements(const QString &query)
}
}
if (currentSubtitle)
currentSubtitle->setVisible(currentSubtitleVisible);
if (group.space)
group.space->setVisible(groupAny);
group.title->setVisible(groupAny);
group.navigationLink->setVisible(groupAny);
any |= groupAny;
}
}