diff options
author | Christian Kandeler <christian.kandeler@nokia.com> | 2012-08-23 15:53:58 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-08-27 17:00:03 +0200 |
commit | e669f054069c3a1214a31c4c1d7d9269659c31c4 (patch) | |
tree | d611e865215dc8ee705a640fdf3e35660542632f /src/libs/utils/detailsbutton.cpp | |
parent | b674b59b3d652fa9c5d74dc4e16380e3a5d23882 (diff) | |
download | qt-creator-e669f054069c3a1214a31c4c1d7d9269659c31c4.tar.gz |
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/libs/utils/detailsbutton.cpp')
-rw-r--r-- | src/libs/utils/detailsbutton.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp index aa95ea2848..178f22a585 100644 --- a/src/libs/utils/detailsbutton.cpp +++ b/src/libs/utils/detailsbutton.cpp @@ -30,6 +30,7 @@ #include "detailsbutton.h" +#include <utils/hostosinfo.h> #include <utils/stylehelper.h> #include <QPropertyAnimation> @@ -83,11 +84,9 @@ QSize DetailsButton::sizeHint() const { // TODO: Adjust this when icons become available! const int w = fontMetrics().width(text()) + 32; -#ifdef Q_OS_MAC - return QSize(w, 34); -#else + if (HostOsInfo::isMacHost()) + return QSize(w, 34); return QSize(w, 22); -#endif } bool DetailsButton::event(QEvent *e) @@ -120,11 +119,10 @@ void DetailsButton::paintEvent(QPaintEvent *e) QWidget::paintEvent(e); QPainter p(this); -#ifndef Q_OS_MAC + // draw hover animation - if (!isDown() && m_fader > 0) + if (!HostOsInfo::isMacHost() && !isDown() && m_fader > 0) p.fillRect(rect().adjusted(1, 1, -2, -2), QColor(255, 255, 255, int(m_fader*180))); -#endif if (isChecked()) { if (m_checkedPixmap.isNull() || m_checkedPixmap.size() != contentsRect().size()) |