Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Edit TexEdit by click

Edit TexEdit by click

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 249 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Damian7546
    wrote on last edited by
    #1

    Hi,
    In my TextEdit I would like to add function. I would like to click to actual value and edit them. Now I have code like below:

    TextEdit {
                id: occupiedPlaceValue
                anchors {
                    top: parent.bottom
                    leftMargin: 0
                    horizontalCenter: parent.horizontalCenter
                }
                text: occupiedPlaces
                color: "white"
                font.pixelSize: parent.height * 1.2
    
    
                MouseArea {
                    anchors.fill: parent
                    onPressed: {
                        occupiedPlaceValue.select(0,occupiedPlaceValue.length)
                    }
    
                }
            }
    

    how do this >?

    ? 1 Reply Last reply
    0
    • D Damian7546

      Hi,
      In my TextEdit I would like to add function. I would like to click to actual value and edit them. Now I have code like below:

      TextEdit {
                  id: occupiedPlaceValue
                  anchors {
                      top: parent.bottom
                      leftMargin: 0
                      horizontalCenter: parent.horizontalCenter
                  }
                  text: occupiedPlaces
                  color: "white"
                  font.pixelSize: parent.height * 1.2
      
      
                  MouseArea {
                      anchors.fill: parent
                      onPressed: {
                          occupiedPlaceValue.select(0,occupiedPlaceValue.length)
                      }
      
                  }
              }
      

      how do this >?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      @Damian7546 said in Edit TexEdit by click:

      In my TextEdit I would like to add function. I would like to click to actual value and edit them. Now I have code like below:

      Hi could you please be more explicit about what you actually want to do ? In my world, when you click any text editor, you enter the edit mode and then you can edit the value.

      Of what I understand from your code, you want your input to be wholly selected, I'd rather pick for selectAll() method. Whereas to the property to be monitored, I'd rather pick for the TextEdit's onCursorVisibleChanged one, testing of course whether the cursor is actually visible or not.

      By the way, your anchors seem very weird, as I understand it your horizontalCenter would be higher than the top.

      1 Reply Last reply
      0
      • D Damian7546 has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved