/*******************************************************************************
This file is part of mDictionary.
mDictionary is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
mDictionary is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with mDictionary. If not, see .
Copyright 2010 Comarch S.A.
*******************************************************************************/
/*!
author: Marcin Kaźmierczak
*/
import Qt 4.7
Rectangle {
function changeWordState(nr, state) {
wordList.currentIndex = nr
wordModel.setModelProperty(wordList.currentIndex, state, "isBookmarked")
}
function setEnabled(Boolean) { wordList.enabled = Boolean }
signal wordSelected(string word);
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
id: rectangle1
color: myPalette.base
anchors.fill: parent
ElementsListView{
id: wordList
width: rectangle1.width
anchors.fill: parent
highlightResizeSpeed: 1000
delegate: Component{
id: wordListDelegate
Item {
width: rectangle1.width
height: {
if (wordText.height + 4 > check.height)
return wordText.height + 4;
else
return check.height;
}
MouseArea{
anchors.fill: parent
onClicked: {
wordList.currentIndex = number
rectangle1.wordSelected(word)
}
}
Text {
id: wordText
anchors.verticalCenter: parent.verticalCenter
text:
{
if (word == "!@#$%"){
qsTr("Can't find any matching words")
} else {
word
}
}
}
Checkbox{
id: check
width: wordText.height
selected: isBookmarked
pathToCheckedImage: CheckedPath
pathToUncheckedImage: UncheckedPath
anchors.right: parent.right
anchors.rightMargin: 5
anchors.verticalCenter: parent.verticalCenter
onChanged: rectangle1.changeWordState(number, selected)
visible: {
if (word == "!@#$%"){
false
} else {
true
}
}
}
}
}
model: wordModel
}
}