diff widgets/SearchWidget.cpp @ 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 a5175615d153
children d99441818cd9
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()