frek

Untitled

Jul 14th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import QtQuick 2.5
  2. import QtQuick.Controls 2.3
  3. import Felgo 3.0
  4.  
  5. Page {
  6.     id: detailPage
  7.     title: qsTr("Edit Product Item")
  8.  
  9.     property var productItem
  10.     signal saveProductItem(var productItem)
  11.  
  12.     rightBarItem: IconButtonBarItem {
  13.         icon: IconType.save
  14.         onClicked: {
  15.             textEditProductItem.focus = false
  16.             productItem.text = textEditProductItem.text
  17.             detailPage.saveProductItem(productItem)
  18.         }
  19.     }
  20.  
  21.     TextArea {
  22.         id: textEditProductItem
  23.  
  24.         width: parent.width
  25.         padding: dp(12)
  26.         verticalAlignment: TextEdit.AlignTop
  27.         font.pixelSize: sp(14)
  28.         inputMethodHints: Qt.ImhNoPredictiveText
  29.         placeholderText: qsTr("Product item text")
  30.     }
  31.  
  32.     Component.onCompleted: {
  33.         console.log(JSON.stringify(productItem))
  34.         textEditProductItem.text = productItem.text
  35.  
  36.         textEditProductItem.forceActiveFocus()
  37.         textEditProductItem.cursorPosition = productItem.text.length
  38.     }
  39. }
Add Comment
Please, Sign In to add comment