summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp35
-rw-r--r--tools/assistant/tools/assistant/centralwidget.h5
2 files changed, 38 insertions, 2 deletions
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 98245c0..52d48d5 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -87,6 +87,7 @@ namespace {
FindWidget::FindWidget(QWidget *parent)
: QWidget(parent)
+ , appPalette(qApp->palette())
{
QHBoxLayout *hboxLayout = new QHBoxLayout(this);
QString resourcePath = QLatin1String(":/trolltech/assistant/images/");
@@ -148,6 +149,34 @@ FindWidget::~FindWidget()
{
}
+void FindWidget::hideEvent(QHideEvent* event)
+{
+#if !defined(QT_NO_WEBKIT)
+ // TODO: remove this once webkit supports setting the palette
+ if (!event->spontaneous())
+ qApp->setPalette(appPalette);
+#else
+ Q_UNUSED(event);
+#endif
+}
+
+void FindWidget::showEvent(QShowEvent* event)
+{
+#if !defined(QT_NO_WEBKIT)
+ // TODO: remove this once webkit supports setting the palette
+ if (!event->spontaneous()) {
+ QPalette p = appPalette;
+ p.setColor(QPalette::Inactive, QPalette::Highlight,
+ p.color(QPalette::Active, QPalette::Highlight));
+ p.setColor(QPalette::Inactive, QPalette::HighlightedText,
+ p.color(QPalette::Active, QPalette::HighlightedText));
+ qApp->setPalette(p);
+ }
+#else
+ Q_UNUSED(event);
+#endif
+}
+
void FindWidget::updateButtons()
{
if (editFind->text().isEmpty()) {
@@ -245,12 +274,14 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent)
SLOT(showTabBarContextMenu(QPoint)));
}
- QPalette p = qApp->palette();
+#if defined(QT_NO_WEBKIT)
+ QPalette p = palette();
p.setColor(QPalette::Inactive, QPalette::Highlight,
p.color(QPalette::Active, QPalette::Highlight));
p.setColor(QPalette::Inactive, QPalette::HighlightedText,
p.color(QPalette::Active, QPalette::HighlightedText));
- qApp->setPalette(p);
+ setPalette(p);
+#endif
}
CentralWidget::~CentralWidget()
diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h
index 1342a75..d59dbe5 100644
--- a/tools/assistant/tools/assistant/centralwidget.h
+++ b/tools/assistant/tools/assistant/centralwidget.h
@@ -80,6 +80,10 @@ signals:
void findNext();
void findPrevious();
+protected:
+ void hideEvent(QHideEvent* event);
+ void showEvent(QShowEvent * event);
+
private slots:
void updateButtons();
@@ -95,6 +99,7 @@ private:
QToolButton *toolPrevious;
QCheckBox *checkWholeWords;
+ QPalette appPalette;
friend class CentralWidget;
};