저장소/Qt

Drop Shadow Effect

MindGear 2013. 11. 19. 11:37

frameless windows에 drop shadow 효과 주는 방법



원문 출처 : stackoverflow

http://stackoverflow.com/questions/12347776/how-to-put-a-shadow-to-a-frameless-window-in-qt



Q: How to put a shadow to a Frameless window in Qt


A: 

Add a "QWidget" (say widget) to the MainWindow and move everything that's on the MainWindow to the widget. Then do this:

setAttribute(Qt::WA_TranslucentBackground); //enable MainWindow to be transparent

QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
effect->setBlurRadius(5);
ui->widget->setGraphicsEffect(effect);

This seems to work for me. See:

illusion of a main window having a shadow