Hi all
i try to set Opacity on masked QDialog but it doesn't fully set it
i still have the Main QDialog background color shown , it is masked with round corners
only the round corners get Opacity ..
here is the code it is in the paintEvent method :

Qt Code:
  1. QPainter painter(this);
  2. painter.setRenderHints(QPainter::Antialiasing);
  3. const QPalette& pal = palette();
  4. float thickline = 1.5;//_sizes.thicker_line();
  5. float border_rad = thickline * 4.0;
  6. float w = width();
  7. float h = height();
  8. QImage mask_img(width(), height(), QImage::Format_Mono);
  9. mask_img.fill(0xff);
  10. QPainter mask_ptr(&mask_img);
  11. mask_ptr.drawRoundedRect( QRectF( 0, 0, w, h),
  12. border_rad+thickline/2.0,
  13. border_rad+thickline/2.0 );
  14.  
  15. QBitmap bmp = QBitmap::fromImage(mask_img);
  16. setMask( bmp );
  17.  
  18. QBrush bg_brush( pal.color(QPalette::Active, QPalette::Window) );
  19. QPen border_pen( pal.color(QPalette::Active, QPalette::Dark) );
  20. border_pen.setWidthF(thickline);
  21. border_pen.setJoinStyle(Qt::RoundJoin);
  22. painter.setPen(border_pen);
  23. QRectF bg_rect = QRectF( thickline/2.0,
  24. thickline/2.0,
  25. w-thickline,
  26. h-thickline );
  27.  
  28. painter.setBrush(bg_brush);
  29.  
  30. painter.setOpacity(0); <-----------------------------------HERE IS THE PROBLEMATIC CODE
  31. mask_ptr.setOpacity(0);
  32.  
  33. mask_ptr.drawRoundedRect( QRectF( 0, 0, w, h),
  34. border_rad+thickline/2.0,
  35. border_rad+thickline/2.0 );
  36.  
  37. painter.drawRoundedRect( bg_rect,
  38. border_rad,
  39. border_rad );
To copy to clipboard, switch view to plain text mode