Advertisement
vavan_bonus

mycode

Jan 8th, 2021 (edited)
1,658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 5.91 KB | None | 0 0
  1. console.log("Button clicked!")
  2.    
  3. Layout.preferredWidth: 100
  4. Layout.alignment: Qt.AlignHCenter
  5.  
  6. implicitWidth: contentWidth
  7. horizontalAlignment: Text.AlignHLeft
  8.  
  9. baselineOffset:
  10. topPadding: 10
  11. anchors.margins
  12. anchors.fill: parent
  13. anchors.centerIn: parent
  14.  
  15. //-----------------------------------------------
  16. layer.enabled: true
  17. layer.effect: OpacityMask {
  18.     maskSource: Rectangle {
  19.             id: opMask
  20.         width: popupContent.width
  21.         height: popupContent.height
  22.         radius: 18
  23.     }
  24. }
  25. //-----------------------------------------------
  26. rgba
  27. 0% = #00
  28. 10% = #16
  29. 20% = #32
  30. 30% = #48
  31. 40% = #64
  32. 50% = #80
  33. 60% = #96
  34. 70% = #112
  35. 80% = #128
  36. 90% = #144
  37. //-----------------------------------------------
  38. Component.onCompleted: control.setTime()
  39.  
  40.    Timer {
  41.         repeat: true
  42.         interval: 60*100095
  43.         onTriggered: updateData()
  44.         running: true
  45.     }
  46.  
  47. opacity: index !== 122 ? 1 : 0
  48. //-----------------------------------------------
  49.  
  50.  
  51. import QtQuick 2.6
  52. import QtQuick.Window 2.2
  53.  
  54. Window {
  55.     visible: true
  56.     width: 640
  57.     height: 480
  58.     title: qsTr("Hello World")
  59.  
  60.     Text {
  61.         id: my_text
  62.         font.pixelSize:  30
  63.         text: "Hello"
  64.     }
  65.  
  66.     Timer{
  67.         id: timer
  68.         interval: 1000
  69.         running: true
  70.         repeat: true
  71.         onTriggered: my_text.opacity = my_text.opacity === 0 ? 1 : 0
  72.      }
  73. }
  74.  
  75.  
  76. MouseArea {
  77.      anchors.fill: parent
  78.      onClicked: redPinRings.visible ? redPinRings.visible=false: redPinRings.visible=true
  79.  }
  80. //-----------------------------------------------
  81.  
  82. import QtQuick 2.6
  83. import QtQuick.Window 2.2
  84.  
  85. Window {
  86.     visible: true
  87.     width: 640
  88.     height: 480
  89.     title: qsTr("Hello World")
  90.  
  91.     Text {
  92.         anchors.centerIn: parent
  93.         id: my_text
  94.         text: "Hello"
  95.         font.pixelSize:  30
  96.  
  97.         OpacityAnimator {
  98.             target: my_text;
  99.             from: 0;
  100.             to: 1;
  101.             duration: 400;
  102.             loops: Animation.Infinite;
  103.             running: true;
  104.             easing {
  105.                 type: Easing.InOutExpo;
  106.             }
  107.         }
  108.     }
  109. }
  110.  
  111. Rectangle {
  112.         id: popup
  113.         x: 30
  114.         y: 40
  115.         //radius: 15
  116.         width: 160
  117.         height: 40
  118.         color: "green"
  119.         visible: false
  120.  
  121.             Rectangle {
  122.             x:0
  123.             y:0
  124.             width: 50
  125.             height: 50
  126.             color: "red"
  127.         }
  128.     }
  129.     Text {
  130.         text: myItem.width
  131.     }
  132.     Text {
  133.         text: myItem.height
  134.         y: 20
  135.     }
  136.     OpacityMask {
  137.         anchors.fill: popup
  138.         source: popup
  139.         maskSource: roundMask
  140.     }
  141.    
  142.  
  143.  
  144. //-----------------------------------------------
  145.  
  146. //gradient to background on image
  147.  
  148. Image {
  149.     id: test
  150.     source: '/assets/icons/alldata.pro_logo.png'
  151.     x: 216
  152.     y: 145
  153.     anchors.horizontalCenter: parent.horizontalCenter
  154.     visible: false // very imortant!
  155. }
  156. LinearGradient {
  157.     id: mask
  158.     anchors.fill: test
  159.     start: Qt.point(0, 0)
  160.     end: Qt.point(test.width, 0)
  161.     gradient: Gradient {
  162.         GradientStop { position: 0.2; color: "transparent" }
  163.         GradientStop { position: 0.5; color: "black" }
  164.         GradientStop { position: 0.8; color: "transparent" }
  165.     }
  166.     visible: false
  167. }
  168.  
  169. OpacityMask {
  170.     anchors.fill: test
  171.     source: test
  172.     maskSource: mask
  173. }
  174.    
  175. //-----------------------------------------------
  176. // rounded shadowed popup
  177. //
  178. import QtQuick 2.0
  179. import QtQuick.Window 2.2
  180. import QtQuick.Controls 2.3
  181. import QtGraphicalEffects 1.0
  182.  
  183. ApplicationWindow {
  184.     id: window
  185.     width: 400
  186.     height: 400
  187.     visible: true
  188.  
  189.     Rectangle {
  190.         id: rectMain;
  191.         width: parent.width
  192.         height: parent.height
  193.  
  194.         Canvas {
  195.             anchors.fill: parent
  196.  
  197.             property real hue: 0
  198.             RotationAnimation on hue {
  199.                 from: 0
  200.                 to: 360
  201.                 duration: 4000
  202.                 running: true
  203.                 loops: Animation.Infinite
  204.             }
  205.             onHueChanged: requestPaint()
  206.             onPaint: {
  207.                 var ctx = getContext("2d");
  208.                 ctx.fillStyle = Qt.hsla(hue / 360, 1, 0.5, 1);
  209.                 ctx.fillRect(0, 0, width, height);
  210.             }
  211.         }
  212.         Button {
  213.             text: "Open"
  214.             onClicked: popup.open()
  215.         }
  216.  
  217.         Popup {
  218.             id: popup
  219.  
  220.             x: 100
  221.             y: 100
  222.             width: 200
  223.             height: 300
  224.             modal: true
  225.             focus: true
  226.             closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
  227.  
  228.             // new attached property in 5.10, in 5.9 and older use the overlay.modal property of ApplicationWindow.
  229.             Overlay.modal: GaussianBlur {
  230.                 source: ShaderEffectSource { // you can just do source: window.contentItem if you just want a live blur.
  231.                     sourceItem: window.contentItem
  232.                     live: false
  233.                 }
  234.                 radius: 8
  235.                 samples: 16
  236.             }
  237.  
  238.             padding: 0
  239.  
  240.             Rectangle {
  241.                 id: popRect;
  242.                 color: "red";
  243.  
  244.                 width: parent.width
  245.                 height: parent.height
  246.                
  247.                 layer.enabled: true
  248.                 layer.effect: OpacityMask {
  249.                     maskSource: Rectangle {
  250.                             id: opMask
  251.                         width: popRect.width
  252.                         height: popRect.height
  253.                         radius: 18
  254.                     }
  255.                 }
  256.             }
  257.  
  258.             background: DropShadow {
  259.                 source: popup.contentItem
  260.  
  261.                 horizontalOffset: 0
  262.                 verticalOffset: 5
  263.                 radius: 10
  264.                 samples: 7
  265.                 color: "black"
  266.             }
  267.         }
  268.     }
  269. }
  270.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement