Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QApplication>
- #include <QQuickView>
- #include <QQuickItem>
- #include <QWidget>
- template <typename T>
- void updateMask(T* window)
- {
- int arrowHeight = 12;
- int arrowWidth = 12;
- int hw = window->width() / 2;
- QPolygon polygon;
- polygon << QPoint(0, arrowHeight) << QPoint(0, window->height())
- << QPoint(window->width(), window->height()) << QPoint(window->width(), arrowHeight)
- << QPoint(hw+arrowWidth, arrowHeight)
- << QPoint(hw, 0)
- << QPoint(hw-arrowWidth, arrowHeight);
- QRegion region(polygon);
- window->setMask(region);
- }
- int main(int argc, char *argv[])
- {
- QApplication app(argc, argv);
- QQuickView window;
- window.setTitle("qquickview");
- window.resize(800, 600);
- window.show();
- updateMask(&window);
- QWidget w;
- w.setWindowTitle("mask widget");
- w.resize(800, 600);
- w.show();
- updateMask(&w);
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment