Guest User

Untitled

a guest
Nov 17th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <QApplication>
  2. #include <QQuickView>
  3. #include <QQuickItem>
  4. #include <QWidget>
  5.  
  6. template <typename T>
  7. void updateMask(T* window)
  8. {
  9. int arrowHeight = 12;
  10. int arrowWidth = 12;
  11. int hw = window->width() / 2;
  12.  
  13. QPolygon polygon;
  14. polygon << QPoint(0, arrowHeight) << QPoint(0, window->height())
  15. << QPoint(window->width(), window->height()) << QPoint(window->width(), arrowHeight)
  16. << QPoint(hw+arrowWidth, arrowHeight)
  17. << QPoint(hw, 0)
  18. << QPoint(hw-arrowWidth, arrowHeight);
  19.  
  20. QRegion region(polygon);
  21.  
  22. window->setMask(region);
  23. }
  24.  
  25. int main(int argc, char *argv[])
  26. {
  27. QApplication app(argc, argv);
  28.  
  29. QQuickView window;
  30. window.setTitle("qquickview");
  31. window.resize(800, 600);
  32. window.show();
  33. updateMask(&window);
  34.  
  35. QWidget w;
  36. w.setWindowTitle("mask widget");
  37. w.resize(800, 600);
  38. w.show();
  39. updateMask(&w);
  40.  
  41. return app.exec();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment