Browse Source

Fix a bad previous merge with branch popup-widgets

Julien Finet 14 years ago
parent
commit
da264d1b31
1 changed files with 12 additions and 30 deletions
  1. 12 30
      Libs/Widgets/ctkPopupWidget.cpp

+ 12 - 30
Libs/Widgets/ctkPopupWidget.cpp

@@ -610,40 +610,22 @@ void ctkPopupWidget::paintEvent(QPaintEvent* event)
   Q_D(ctkPopupWidget);
   Q_UNUSED(event);
 
-  if (d->Effect == WindowOpacityFadeEffect)
-    {
-    int opacity = d->Alpha;
-    if (d->AlphaAnimation->state() != QAbstractAnimation::Stopped)
+  QPainter painter(this);
+  QBrush brush = this->palette().window();
+  if (brush.style() == Qt::LinearGradientPattern ||
+      brush.style() == Qt::ConicalGradientPattern ||
+      brush.style() == Qt::RadialGradientPattern)
+    {
+    QGradient* newGradient = duplicateGradient(brush.gradient());
+    QGradientStops stops;
+    foreach(QGradientStop stop, newGradient->stops())
       {
       stop.second.setAlpha(stop.second.alpha() * d->WindowAlpha);
       stops.push_back(stop);
       }
-    QPainter painter(this);
-    QBrush brush = this->palette().window();
-    if (brush.style() == Qt::LinearGradientPattern ||
-        brush.style() == Qt::ConicalGradientPattern ||
-        brush.style() == Qt::RadialGradientPattern)
-      {
-      QGradient* newGradient = duplicateGradient(brush.gradient());
-      QGradientStops stops;
-      foreach(QGradientStop stop, newGradient->stops())
-        {
-        stop.second.setAlpha(opacity);
-        stops.push_back(stop);
-        }
-      newGradient->setStops(stops);
-      brush = QBrush(*newGradient);
-      delete newGradient;
-      }
-    else
-      {
-      QColor color = brush.color();
-      color.setAlpha(opacity);
-      brush.setColor(color);
-      }
-    //QColor semiTransparentColor = this->palette().window().color();
-    //semiTransparentColor.setAlpha(d->CurrentAlpha);
-    painter.fillRect(this->rect(), brush);
+    newGradient->setStops(stops);
+    brush = QBrush(*newGradient);
+    delete newGradient;
     }
   else
     {