# HG changeset patch # User lbajardsilogic # Date 1181740545 0 # Node ID 46af1af183ac5bdf5f644e2f8296b6d05f92d59e # Parent 72123059fa934a0b310f26d344a9984eb72c58df Highlight the button of the current theme in the search tab diff -r 72123059fa93 -r 46af1af183ac widgets/SearchWidget.cpp --- 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::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; icount(); 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() diff -r 72123059fa93 -r 46af1af183ac widgets/SearchWidget.h --- 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: