Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.66 KB | None | 0 0
  1. import QtQuick 2.9
  2. import QtQuick.Window 2.2
  3. import QtQuick.Controls 2.3
  4. import QtQml 2.3
  5.  
  6. Window {
  7.     visible: true
  8.     width: 640
  9.     height: 480
  10.  
  11.     Menu {
  12.         id: contextMenu
  13.  
  14.         MenuItem {
  15.             text: "Static"
  16.         }
  17.     }
  18.  
  19.     Instantiator {
  20.         model: 1
  21.         onObjectAdded: {
  22.             contextMenu.insertItem(index, object)
  23.         }
  24.         onObjectRemoved: {
  25.             contextMenu.removeItem(object)
  26.         }
  27.  
  28.         MenuItem {
  29.             text: "Instantiated"
  30.         }
  31.     }
  32.  
  33.     MouseArea {
  34.         anchors.fill: parent
  35.         onClicked: {
  36.             contextMenu.popup()
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement