try this

Qt Code:
  1. ...
  2. int main(int argc, char* argv[])
  3. {
  4. QApplication app(argc, argv);
  5.  
  6. // parse the commandline:
  7. ...
  8.  
  9. ScreenSaverWidget* widget = new ScreenSaverWidget;
  10. widget->setAttribute(Qt::WA_DeleteOnClose);
  11. QObject::connect(widget, SIGNAL(destroyed()), &app, SLOT(quit()));
  12. switch(mode)
  13. {
  14. case ConfigurationMode:
  15. configure();
  16. return 0;
  17.  
  18. case FullScreenMode:
  19. new ScreenSaverEventFilter(widget);
  20. widget->showFullScreen();
  21. return app.exec();
  22.  
  23. case PreviewMode:
  24. {
  25. widget->setWindowFlags(Qt::FramelessWindowHint|Qt::SubWindow);
  26. ::SetParent(widget->winId(), parent);
  27. RECT parentRect;
  28. ::GetClientRect(parent, &parentRect);
  29. widget->move(0,0);
  30. widget->resize(parentRect.right, parentRect.bottom);
  31. widget->show();
  32. }
  33. }
  34.  
  35. }
To copy to clipboard, switch view to plain text mode