aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmleditorwidgets/contextpanewidget.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/libs/qmleditorwidgets/contextpanewidget.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/libs/qmleditorwidgets/contextpanewidget.cpp')
-rw-r--r--src/libs/qmleditorwidgets/contextpanewidget.cpp44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/libs/qmleditorwidgets/contextpanewidget.cpp b/src/libs/qmleditorwidgets/contextpanewidget.cpp
index 4ef37f3cea4..6fe788357a2 100644
--- a/src/libs/qmleditorwidgets/contextpanewidget.cpp
+++ b/src/libs/qmleditorwidgets/contextpanewidget.cpp
@@ -29,6 +29,9 @@
**************************************************************************/
#include "contextpanewidget.h"
+
+#include <utils/hostosinfo.h>
+
#include <QToolButton>
#include <QFontComboBox>
#include <QComboBox>
@@ -49,6 +52,8 @@
#include "customcolordialog.h"
#include "colorbutton.h"
+using namespace Utils;
+
namespace QmlEditorWidgets {
/* XPM */
@@ -102,12 +107,12 @@ DragWidget::DragWidget(QWidget *parent) : QFrame(parent)
// TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed
-#ifndef Q_OS_MAC
- m_dropShadowEffect = new QGraphicsDropShadowEffect;
- m_dropShadowEffect->setBlurRadius(6);
- m_dropShadowEffect->setOffset(2, 2);
- setGraphicsEffect(m_dropShadowEffect);
-#endif
+ if (!HostOsInfo::isMacHost()) {
+ m_dropShadowEffect = new QGraphicsDropShadowEffect;
+ m_dropShadowEffect->setBlurRadius(6);
+ m_dropShadowEffect->setOffset(2, 2);
+ setGraphicsEffect(m_dropShadowEffect);
+ }
}
void DragWidget::mousePressEvent(QMouseEvent * event)
@@ -127,12 +132,12 @@ void DragWidget::mouseReleaseEvent(QMouseEvent *event)
m_startPos = QPoint(-1, -1);
// TODO: The following code should be enabled for OSX
// when QTBUG-23205 is fixed
-#ifndef Q_OS_MAC
- m_dropShadowEffect = new QGraphicsDropShadowEffect;
- m_dropShadowEffect->setBlurRadius(6);
- m_dropShadowEffect->setOffset(2, 2);
- setGraphicsEffect(m_dropShadowEffect);
-#endif
+ if (!HostOsInfo::isMacHost()) {
+ m_dropShadowEffect = new QGraphicsDropShadowEffect;
+ m_dropShadowEffect->setBlurRadius(6);
+ m_dropShadowEffect->setOffset(2, 2);
+ setGraphicsEffect(m_dropShadowEffect);
+ }
}
QFrame::mouseReleaseEvent(event);
}
@@ -177,16 +182,14 @@ void DragWidget::protectedMoved()
void DragWidget::leaveEvent(QEvent *)
{
-#ifdef Q_OS_MAC
- unsetCursor();
-#endif
+ if (HostOsInfo::isMacHost())
+ unsetCursor();
}
void DragWidget::enterEvent(QEvent *)
{
-#ifdef Q_OS_MAC
- setCursor(Qt::ArrowCursor);
-#endif
+ if (HostOsInfo::isMacHost())
+ setCursor(Qt::ArrowCursor);
}
ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_currentWidget(0)
@@ -232,9 +235,8 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
m_disableAction->setCheckable(true);
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
m_pinned = false;
-#ifdef Q_OS_MAC
- setCursor(Qt::ArrowCursor);
-#endif
+ if (HostOsInfo::isMacHost())
+ setCursor(Qt::ArrowCursor);
}
ContextPaneWidget::~ContextPaneWidget()