Fix button graphics when button was pressed or disabled. Add disabled state to button...
[mdictionary] / src / mdictionary / qml / DictManagerWidget.qml
index 2f7c1a0..83cce28 100644 (file)
@@ -42,11 +42,16 @@ Rectangle {
             id: dictListDelegate
             Item {
                 width: rectangle1.width
-                height: typeText.height
+                height: {
+                    if (nameText.height + 10 > logo.height)
+                            return nameText.height + 10;
+                    else
+                            return logo.height;
+                }
                 MouseArea{
                     anchors.fill: parent
                     onClicked: {
-                        dictTypeList.currentIndex = number
+                        dictList.currentIndex = number
                     }
                     onDoubleClicked: {
                         selectedRow(number)
@@ -54,15 +59,48 @@ Rectangle {
                 }
                 Row {
                     //image zaznacz/odznacz
-                    //image logo
+                    anchors.fill: parent
+                    Image {
+                        id: checkbox
+//                        source: "qrc:/button/checkbox.png"
+                        height: {
+                            var aspectRatio = sourceSize.height / sourceSize.width
+                            return logo.width * aspectRatio
+                        }
+                        anchors.verticalCenter: parent.verticalCenter
+                        width: nameText.height + 10
+                        states: [
+                            State {
+                                name: "checked";
+                                when: (isSelected == true);
+
+                                PropertyChanges { target: checkbox; source: "qrc:/button/checkboxChecked.png" }
+                            },
+                            State {
+                                name: "unchecked";
+                                when: (isSelected == false);
+
+                                PropertyChanges { target: checkbox; source: "qrc:/button/checkbox.png" }
+                            }
+                        ]
+                    }
+
                     Image {
                         id: logo
                         source: iconPath
+                        height: {
+                            var aspectRatio = sourceSize.height / sourceSize.width
+                            return logo.width * aspectRatio
+                        }
+                        anchors.verticalCenter: parent.verticalCenter
+                        width: nameText.height + 10
                     }
                     Text {
                         id: nameText
                         text: name
-//                        width: rectangle1.width
+                        anchors.left: logo.right
+                        anchors.leftMargin: 5
+                        anchors.verticalCenter: parent.verticalCenter
                     }
                 }
             }