Hi, all.
Currently, I am constructing a UI to control a mobile robot in ROS.
The following is the window of my ui:
1.png
Where both of the background of ui and buttons are set as transparent, and a png figure is set to every button.
Qt Code:
  1. MainWindow::MainWindow(int argc, char** argv, QWidget *parent)
  2. : QMainWindow(parent)
  3. , qnode(argc,argv)
  4. {
  5. //Transparent
  6. setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
  7. setParent(0); // Create TopLevel-Widget
  8. setAttribute(Qt::WA_NoSystemBackground, true);
  9. setAttribute(Qt::WA_TranslucentBackground, true);
  10.  
  11. ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class.
  12.  
  13. setWindowIcon(QIcon(":/images/icon.png"));
  14. QObject::connect(&qnode, SIGNAL(rosShutdown()), this, SLOT(close()));
  15.  
  16. //buttons
  17. ButtonBackground(ui.up_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/up_up.png"));
  18. ButtonBackground(ui.down_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/down_up.png"));
  19. ButtonBackground(ui.left_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/left_up.png"));
  20. ButtonBackground(ui.right_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/right_up.png"));
  21. ButtonBackground(ui.stop_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/stop.png"));
  22. ButtonBackground(ui.exit_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/exit.png"));
  23.  
  24. void MainWindow::ButtonBackground(QPushButton *button, QPixmap pixmap)
  25. {
  26. //Bitmap
  27. int width = button->size().width();
  28. int height = button->size().height();
  29. QIcon ButtonIcon(pixmap);
  30. button->setFlat(true);
  31. button->setStyleSheet("background-color: transparent;");
  32. button->setIcon(ButtonIcon);
  33. button->setIconSize(QSize(width, height));
  34. }
To copy to clipboard, switch view to plain text mode 

However, a shadow always exist, see the middle button of above figure.
And also the bottom button in the following figure:
2.png

Is there any method to hide or delete this shadow?

Thank you very much for your help.