import Qt 4.7 Rectangle { SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } color : myPalette.window; function setFocus() { historyList.setFocus() } signal selectedRow(int nr) id: rectangle1 width: 100 height: 300 Rectangle { id: rectangle2 color: "#ffffff" anchors.topMargin: 20 anchors.fill: parent } ElementsListView{ id: historyList width: rectangle1.width anchors.topMargin: 20 anchors.bottom: parent.bottom anchors.top: parent.top highlightResizeSpeed: 1000 Keys.onPressed: { if ((currentIndex < 0 || currentIndex >= count) && (event.key == Qt.Key_Up || event.key == Qt.Key_Down)){ currentIndex = 0 } if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){ selectedRow(currentIndex) } } delegate: Component{ id: historyListDelegate Item { width: rectangle1.width height: typeText.height MouseArea{ anchors.fill: parent onClicked: { historyList.currentIndex = number } onDoubleClicked: { selectedRow(number) } } Row { Text { id: typeText text: (number+1) +". "+word width: rectangle1.width } } } } model: historyTypeModel } Text { id: text1 x: 29 y: 0 width: 80 height: 20 text: qsTr("History"); anchors.horizontalCenterOffset: 19 anchors.topMargin: 0 anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 12 } }