Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Wiki Discussion
  4. how to use highlight element
Forum Update on Monday, May 27th 2025

how to use highlight element

Scheduled Pinned Locked Moved Unsolved Wiki Discussion
2 Posts 2 Posters 1.1k 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.
  • S Offline
    S Offline
    saiteja yerramilli
    wrote on 5 Sept 2018, 04:56 last edited by
    #1

    I am making a telephome gui application using qml, I want to know how to use highlight element to highlight the elements of the dynamic list. The new element in the list must get highlighted. below is my source code.
    ListView{
    id:myview
    // model:callmodel
    model:callmodel
    width: mainrect.width
    anchors.bottom: buttonsrow.top
    anchors.bottomMargin: 0
    anchors.top: currentcalldisplay.bottom
    anchors.topMargin: 0
    delegate: mydelegate
    focus:true
    }
    delegate:
    Component{
    id:mydelegate

    Rectangle{
        id:delrec
        property string localcallstate:callstate
        property string localcallnumber:callnumber
        width:mainrect.width
        height: mainrect.height/10
        function getcolor(localcallstate)
        {
            if(localcallstate == "Active")
                return "#22d73a"
            else if(localcallstate == "Hold")
                return "#aa7865"
            else if(localcallstate == "Incoming")
                return "#f910da"
        }
    
        color: getcolor(localcallstate)
        Text {
            id: callstatetexr
            anchors.right:parent.right
            anchors.rightMargin: parent.width/6
            anchors.verticalCenter:delrec.verticalCenter
            text: localcallstate
            font.pointSize: 25
        }
        Text {
            id: callnumbertext
            anchors.left: parent.left
            anchors.leftMargin: parent.width/5
            anchors.topMargin: parent.height/5
            anchors.verticalCenter:delrec.verticalCenter
            text: localcallnumber
            font.pointSize: 25
        }
       focus:true
       MouseArea {
           anchors.fill: parent
           onClicked: myview.currentIndex = index
       }
    }
    

    }

    i want to know the implementation of the highlight element so that the newly entered element in the list will get highlighted.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 5 Sept 2018, 05:05 last edited by
      #2

      Please wrap your code in code tags to make it easier to read.

      (Z(:^

      1 Reply Last reply
      1

      1/2

      5 Sept 2018, 04:56

      • Login

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