summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkh <qtc-committer@nokia.com>2009-05-26 13:57:45 (GMT)
committerkh <qtc-committer@nokia.com>2009-05-26 13:57:45 (GMT)
commitb03f598df2aa4037815eab9249ba1213236216c5 (patch)
tree6fb96a884743698d5ae0acfae31ba4d5e68f8926 /tools
parenta088a3e5698881b0466cd072380fc7347ea68fba (diff)
downloadQt-b03f598df2aa4037815eab9249ba1213236216c5.zip
Qt-b03f598df2aa4037815eab9249ba1213236216c5.tar.gz
Qt-b03f598df2aa4037815eab9249ba1213236216c5.tar.bz2
Workaround the palette issue, set it only when we search is open.
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;
};