aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/locator/locatorwidget.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@nokia.com>2012-08-23 15:53:58 +0200
committerhjk <qthjk@ovi.com>2012-08-27 17:00:03 +0200
commite669f054069c3a1214a31c4c1d7d9269659c31c4 (patch)
treed611e865215dc8ee705a640fdf3e35660542632f /src/plugins/locator/locatorwidget.cpp
parentb674b59b3d652fa9c5d74dc4e16380e3a5d23882 (diff)
Utils: Introduce HostOsInfo class.
The class' member functions are intended to be used instead of the Q_OS_* macros in all contexts where the latter are not syntactically required. This lowers the likelihood of changes made on one platform breaking the build on another, e.g. due to the code model missing symbols in #ifdef'ed out code when refactoring. Change-Id: I4a54788591b4c8f8d589b8368a6c683d4155c9fa Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/locator/locatorwidget.cpp')
-rw-r--r--src/plugins/locator/locatorwidget.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp
index 7d5b84f844..910f64cac4 100644
--- a/src/plugins/locator/locatorwidget.cpp
+++ b/src/plugins/locator/locatorwidget.cpp
@@ -45,6 +45,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/fileiconprovider.h>
#include <utils/filterlineedit.h>
+#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
@@ -221,12 +222,12 @@ CompletionList::CompletionList(QWidget *parent)
// This is too slow when done on all results
//header()->setResizeMode(QHeaderView::ResizeToContents);
setWindowFlags(Qt::ToolTip);
-#ifdef Q_OS_MAC
- if (horizontalScrollBar())
- horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
- if (verticalScrollBar())
- verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
-#endif
+ if (Utils::HostOsInfo::isMacHost()) {
+ if (horizontalScrollBar())
+ horizontalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
+ if (verticalScrollBar())
+ verticalScrollBar()->setAttribute(Qt::WA_MacMiniSize);
+ }
}
void CompletionList::updatePreferredSize()
@@ -408,11 +409,14 @@ bool LocatorWidget::eventFilter(QObject *obj, QEvent *event)
}
}
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusOut) {
-#if defined(Q_OS_WIN)
- QFocusEvent *fev = static_cast<QFocusEvent*>(event);
- if (fev->reason() != Qt::ActiveWindowFocusReason ||
- (fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow()))
-#endif
+ bool hideList = true;
+ if (Utils::HostOsInfo::isWindowsHost()) {
+ QFocusEvent *fev = static_cast<QFocusEvent*>(event);
+ if (fev->reason() == Qt::ActiveWindowFocusReason &&
+ !(fev->reason() == Qt::ActiveWindowFocusReason && !m_completionList->isActiveWindow()))
+ hideList = false;
+ }
+ if (hideList)
m_completionList->hide();
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) {
showPopupNow();