/*******************************************************************************
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
Image {
id: checkbox
property bool selected
signal changed
height: {
var aspectRatio = sourceSize.height / sourceSize.width
return checkbox.width * aspectRatio
}
width: sourceSize.width
smooth: true
states: [
State {
name: "checked";
when: (checkbox.selected == true);
PropertyChanges { target: checkbox; source: "qrc:/button/checkboxChecked.png" }
},
State {
name: "unchecked";
when: (checkbox.selected == false);
PropertyChanges { target: checkbox; source: "qrc:/button/checkbox.png" }
}
]
MouseArea{
id: area
anchors.fill: parent
onClicked: {
checkbox.selected = !checkbox.selected
changed()
}
}
}