From 190781e33b6a94b0708a76fa3a2b8d6a50bf7107 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 27 Jun 2016 13:03:08 -0400 Subject: Add in the search capabilities within the new lumina-config UI. --- .../core-utils/lumina-config/pages/page_main.cpp | 21 +++++++++++++++------ src-qt5/core-utils/lumina-config/pages/page_main.h | 1 + src-qt5/core-utils/lumina-config/pages/page_main.ui | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src-qt5/core-utils/lumina-config/pages') diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.cpp b/src-qt5/core-utils/lumina-config/pages/page_main.cpp index c853f06c..02065b78 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -14,6 +14,7 @@ page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); + connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); } page_main::~page_main(){ @@ -36,13 +37,17 @@ void page_main::UpdateItems(QString search){ apps->setIcon(0, LXDG::findIcon("preferences-desktop-filetype-association","")); apps->setText(0, tr("Application Settings")); //Now go through and add in the known pages for each category + QStringList SL = search.split(" "); //search list for(int i=0; itreeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); } - if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); } + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } + if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); apps->setExpanded(true); } } //================ @@ -93,3 +98,7 @@ void page_main::itemTriggered(QTreeWidgetItem *it){ emit ChangePage(it->whatsThis(0)); } } + +void page_main::searchChanged(QString txt){ + UpdateItems(txt.simplified()); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.h b/src-qt5/core-utils/lumina-config/pages/page_main.h index 0b24b6da..2e38eb64 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.h +++ b/src-qt5/core-utils/lumina-config/pages/page_main.h @@ -32,5 +32,6 @@ private: private slots: void itemTriggered(QTreeWidgetItem*); + void searchChanged(QString); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.ui b/src-qt5/core-utils/lumina-config/pages/page_main.ui index 3d9626c1..2331152b 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_main.ui @@ -15,19 +15,29 @@ - 0 + 2 0 - 0 + 2 0 + + + + Search for.... + + + + + Qt::NoFocus + QTreeWidget{background: transparent; } -- cgit