Mercurial > hg > easaier-soundaccess
changeset 70:46af1af183ac
Highlight the button of the current theme in the search tab
author | lbajardsilogic |
---|---|
date | Wed, 13 Jun 2007 13:15:45 +0000 |
parents | 72123059fa93 |
children | a1ce307bab17 |
files | widgets/SearchWidget.cpp widgets/SearchWidget.h |
diffstat | 2 files changed, 34 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/SearchWidget.cpp Wed Jun 13 13:14:59 2007 +0000 +++ b/widgets/SearchWidget.cpp Wed Jun 13 13:15:45 2007 +0000 @@ -119,6 +119,7 @@ QString themeName = getActiveTheme(); m_searchButton->setObjectName(themeName); + highlightThemeButton(themeName); } @@ -246,12 +247,41 @@ { QString name = sender()->objectName(); - m_searchButton->setObjectName(name); + m_searchButton->setObjectName(name); + + highlightThemeButton(name); std::map<QString, int>::iterator iter = m_themes.find(name); if (iter != m_themes.end()) + { m_themesLayout->setCurrentIndex(iter->second); + } +} + +void SearchWidget::highlightThemeButton(QString &name) +{ + QLayoutItem *child; + + for (int i = 0; i<m_buttonLayout->count(); i++ ) + { + child = m_buttonLayout->itemAt(i); + QPushButton* button = (QPushButton*) child->widget(); + if (button) + { + if (name == button->objectName()) + { + QPalette palette; + palette.setColor(QPalette::Button,palette.color(QPalette::Highlight)); + button->setPalette(palette); + } + else + { + QPalette palette; + button->setPalette(palette); + } + } + } } QString SearchWidget::getActiveTheme()
--- a/widgets/SearchWidget.h Wed Jun 13 13:14:59 2007 +0000 +++ b/widgets/SearchWidget.h Wed Jun 13 13:15:45 2007 +0000 @@ -48,6 +48,9 @@ /* return the name of the active query theme */ QString getActiveTheme(); + /*highlight the button of the theme "name"*/ + void highlightThemeButton(QString &name); + void reset(); public slots: