]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tooltips/ktooltipwindow.cpp
Get back names, and use "using" keyword to keep GCC silent on "method foo on base...
[dolphin.git] / src / tooltips / ktooltipwindow.cpp
index 7c9e0b2f00fc750b97448e68a6a8cfcfec6894c2..035e141eba8b023e12afcd82ac1ddd1fa12c1ff1 100644 (file)
 #include "ktooltipwindow_p.h"
 
 #include <kcolorscheme.h>
+#include <kwindowsystem.h>
 
 #include <QPainter>
 #include <QVBoxLayout>
 
-#ifdef Q_WS_X11
-    #include <QX11Info>
-#endif
-
 KToolTipWindow::KToolTipWindow(QWidget* content) :
     QWidget(0)
 {
@@ -53,11 +50,7 @@ void KToolTipWindow::paintEvent(QPaintEvent* event)
     QColor toColor = palette().brush(QPalette::ToolTipBase).color();
     QColor fromColor = KColorScheme::shade(toColor, KColorScheme::LightShade, 0.2);
 
-#ifdef Q_WS_X11
-    const bool haveAlphaChannel = QX11Info::isCompositingManagerRunning();
-#else
-    const bool haveAlphaChannel = false;
-#endif
+    const bool haveAlphaChannel = KWindowSystem::compositingActive();
     if (haveAlphaChannel) {
         painter.setRenderHint(QPainter::Antialiasing);
         painter.translate(0.5, 0.5);
@@ -72,17 +65,21 @@ void KToolTipWindow::paintEvent(QPaintEvent* event)
     painter.setBrush(gradient);
 
     const QRect rect(0, 0, width(), height());
-    const qreal radius = 5;
-
-    QPainterPath path;
-    path.moveTo(rect.left(), rect.top() + radius);
-    arc(path, rect.left()  + radius, rect.top()    + radius, radius, 180, -90);
-    arc(path, rect.right() - radius, rect.top()    + radius, radius,  90, -90);
-    arc(path, rect.right() - radius, rect.bottom() - radius, radius,   0, -90);
-    arc(path, rect.left()  + radius, rect.bottom() - radius, radius, 270, -90);
-    path.closeSubpath();
-
-    painter.drawPath(path);
+    if (haveAlphaChannel) {
+        const qreal radius = 5.0;
+
+        QPainterPath path;
+        path.moveTo(rect.left(), rect.top() + radius);
+        arc(path, rect.left()  + radius, rect.top()    + radius, radius, 180, -90);
+        arc(path, rect.right() - radius, rect.top()    + radius, radius,  90, -90);
+        arc(path, rect.right() - radius, rect.bottom() - radius, radius,   0, -90);
+        arc(path, rect.left()  + radius, rect.bottom() - radius, radius, 270, -90);
+        path.closeSubpath();
+
+        painter.drawPath(path);
+    } else {
+        painter.drawRect(rect);
+    }
 }
 
 void KToolTipWindow::arc(QPainterPath& path, qreal cx, qreal cy, qreal radius, qreal angle, qreal sweeplength)