Advertisement
vavan_bonus

Untitled

Dec 1st, 2020 (edited)
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //-----------------------------------------------
  2. // rounded shadowed popup
  3. //
  4. import QtQuick 2.0
  5. import QtQuick.Window 2.2
  6. import QtQuick.Controls 2.3
  7. import QtGraphicalEffects 1.0
  8.  
  9. ApplicationWindow {
  10.     id: window
  11.     width: 400
  12.     height: 400
  13.     visible: true
  14.  
  15.     Rectangle {
  16.         id: rectMain;
  17.         width: parent.width
  18.         height: parent.height
  19.  
  20.         Button {
  21.             text: "Open"
  22.             onClicked: popup.open()
  23.         }
  24.  
  25.         Popup {
  26.             id: popup
  27.  
  28.             x: 100
  29.             y: 100
  30.             width: 200
  31.             height: 300
  32.             modal: true
  33.             focus: true
  34.             closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
  35.            
  36.          /*   Overlay.modal: GaussianBlur {
  37.                 source: ShaderEffectSource {
  38.                     sourceItem: window.contentItem
  39.                     live: false
  40.                 }
  41.                 radius: 8
  42.                 samples: 16
  43.             }
  44. */
  45.             padding: 0
  46.  
  47.             Rectangle {
  48.                 id: popRect;
  49.                 color: "red";
  50.  
  51.                 width: parent.width
  52.                 height: parent.height
  53.                
  54.                 layer.enabled: true
  55.                 layer.effect: OpacityMask {
  56.                     maskSource: Rectangle {
  57.                             id: opMask
  58.                         width: popRect.width
  59.                         height: popRect.height
  60.                         radius: 18
  61.                     }
  62.                 }
  63.             }
  64.  
  65.             background: DropShadow {
  66.                 source: popup.contentItem
  67.  
  68.                 horizontalOffset: 0
  69.                 verticalOffset: 0
  70.                 radius: 10
  71.                 samples: 7
  72.                 color: "black"
  73.             }
  74.         }
  75.     }
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement