draft of spinbox
authorjakub <jakub.jaszczynski@comarch.com>
Tue, 4 Jan 2011 12:02:25 +0000 (13:02 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Tue, 4 Jan 2011 12:02:25 +0000 (13:02 +0100)
data/button/down_enable.png [new file with mode: 0644]
data/button/up_enable.png [new file with mode: 0644]
data/gui.qrc
src/mdictionary/gui/AboutWidget.cpp
src/mdictionary/gui/SearchBarWidget.cpp
src/mdictionary/mdictionary.pro
src/mdictionary/qml/AboutWidget.qml
src/mdictionary/qml/IconButton.qml
src/mdictionary/qml/MySpinBox.qml [new file with mode: 0644]

diff --git a/data/button/down_enable.png b/data/button/down_enable.png
new file mode 100644 (file)
index 0000000..8cae783
Binary files /dev/null and b/data/button/down_enable.png differ
diff --git a/data/button/up_enable.png b/data/button/up_enable.png
new file mode 100644 (file)
index 0000000..a82da53
Binary files /dev/null and b/data/button/up_enable.png differ
index 94cfba9..604d56a 100644 (file)
@@ -27,5 +27,7 @@
         <file>button/go-next.png</file>
         <file>button/go-show.png</file>
         <file>button/go-clear.png</file>
+        <file>button/up_enable.png</file>
+        <file>button/down_enable.png</file>
     </qresource>
 </RCC>
index 1d0516e..aeea848 100644 (file)
@@ -35,17 +35,11 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
     resize(380,450);
 
     view= new QDeclarativeView();
-    view->setSource(QUrl("src/mdictionary/qml/AboutWidget.qml"));
+    view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/AboutWidget.qml"));
     view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
     view->setAlignment(Qt::AlignCenter);
     view->show();
 
- /*   QDeclarativeView *view2 = new QDeclarativeView();
-    view2->setSource(QUrl("src/mdictionary/qml/TranslationView.qml"));
-    view2->setResizeMode(QDeclarativeView::SizeRootObjectToView);
-    view2->setAlignment(Qt::AlignCenter);
-    view2->show();
-*/
     mainLayout = new QVBoxLayout;
     mainLayout->addWidget(view);
 
index 95e2543..9dc1450 100644 (file)
@@ -39,13 +39,13 @@ SearchBarWidget::SearchBarWidget(QWidget *parent) : QWidget(parent) {
     busyTimer=new QTimer;
 
     progressBar = new QDeclarativeView();
-    progressBar->setSource(QUrl("src/mdictionary/qml/ProgressBar.qml"));
+    progressBar->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/ProgressBar.qml"));
     progressBar->setResizeMode(QDeclarativeView::SizeRootObjectToView);
     progressBar->setAlignment(Qt::AlignCenter);
     progressBar->hide();
 
     view= new QDeclarativeView();
-    view->setSource(QUrl("src/mdictionary/qml/SearchBarWidget.qml"));
+    view->setSource(QUrl::fromLocalFile("/usr/share/mdictionary/qml/SearchBarWidget.qml"));
     view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
     view->setAlignment(Qt::AlignCenter);
     view->show();
index 6062abc..a055f31 100644 (file)
@@ -95,8 +95,8 @@ OTHER_FILES += \
     qml/TranslationView.qml \
     qml/FlickableWebView.qml \
     qml/ScrollBar.qml \
-    qml/SpinBox.qml \
-    qml/Checkbox.qml
+    qml/Checkbox.qml \
+    qml/MySpinBox.qml
 
 target.path = $$BIN_DIR
 INSTALLS += target
@@ -200,6 +200,7 @@ unix {
         qmls.files += ./qml/FlickableWebView.qml
         qmls.files += ./qml/ScrollBar.qml
         qmls.files += ./qml/Checkbox.qml
+        qmls.files += ./qml/MySpinBox.qml
     }
        
     INSTALLS += desktop icon64 shared service css css_images qmls
index 92c6d07..a8e85bc 100644 (file)
@@ -52,4 +52,13 @@ Rectangle {
         anchors.horizontalCenterOffset: 0
         onLinkActivated: linkClicked(link);
     }
+
+    MySpinBox {
+        id: test01
+        y:50;
+        x:100;
+        width: 40
+        height: 20;
+    }
+
 }
index 7fc32ea..dc749a4 100644 (file)
@@ -4,6 +4,8 @@ Rectangle {
     id: rectangle
 
     property alias pathToIcon: image.source;
+    property int iconWidth:rectangle.width;
+    property int iconHeight:rectangle.height;
 
     signal clicked;
     radius: 50
@@ -22,8 +24,8 @@ Rectangle {
         id: image
         z:4;
         anchors.centerIn: parent
-        width: rectangle.width;
-        height: rectangle.height;
+        width: iconWidth;
+        height: iconHeight;
     }
 
     Image {
diff --git a/src/mdictionary/qml/MySpinBox.qml b/src/mdictionary/qml/MySpinBox.qml
new file mode 100644 (file)
index 0000000..e0d536b
--- /dev/null
@@ -0,0 +1,102 @@
+import Qt 4.7
+
+Rectangle {
+    id: rectangle1
+    radius: 10
+    border.color: "#000666";
+    property int maxValue:500;
+    property int minValue:0;
+    property alias value:text_input1.text
+
+    TextInput {
+        id: text_input1
+        x: 1
+        width: rectangle1.width-15
+        height: rectangle1.height*0.6;
+        text: "0"
+        anchors.centerIn: parent
+        validator: IntValidator{bottom: 0; top: 500;}
+        transformOrigin: Item.Left
+        selectByMouse: true;
+        font.pixelSize: rectangle1.height * .5;
+        onCursorPositionChanged:  moveCursorSelection(cursorPosition);
+        focus: rectangle1.focus;
+ /*       Keys.onPressed: {
+            if ((event.key == Qt.Key_Enter) || (event.key == Qt.Key_Return))
+                rectangle1.enterPressed(text_input1.text)
+        }
+*/
+    }
+
+    Rectangle {
+        id: shadeDisable
+        anchors.centerIn: parent;
+        radius: parent.radius
+        color: "grey";
+        opacity: 0
+        width:  parent.width;
+        height: parent.height;
+    }
+
+    Image {
+        id: imageUp
+        z:4;
+        anchors.right: parent.right
+        anchors.top: parent.top
+        anchors.rightMargin: 2
+        anchors.topMargin: 2
+        width: 11;
+        height: 6;
+
+        source: "qrc:/button/up_enable.png";
+    }
+
+    Image {
+        id: imageDown
+        z:4;
+        width: 11;
+        height: 6;
+        anchors.right: parent.right
+        anchors.bottom: parent.bottom
+        anchors.rightMargin: 2
+        anchors.bottomMargin: 2
+        source: "qrc:/button/down_enable.png";
+    }
+
+    MouseArea {
+        id: mouseAreaUp
+        anchors.right: parent.right
+        anchors.top: parent.top
+        anchors.rightMargin: 2
+        anchors.topMargin: 2
+        width: 11;
+        height: rectangle1/2;
+        onClicked: {
+            console.log("t1");
+            //rectangle.clicked();
+        }
+    }
+
+    MouseArea {
+        id: mouseAreaDown
+        anchors.right: parent.right
+        anchors.top: parent.top
+        anchors.rightMargin: 2
+        anchors.topMargin: 2
+        width: 11;
+        height: rectangle1/2;
+        onClicked: {
+            console.log("t2");
+            //rectangle.clicked();
+        }
+
+    }
+
+    states: [
+        State {
+            name: "DisableState"; when: rectangle1.enabled==false;
+            PropertyChanges { target: shadeDisable; z: 3; opacity: 0.5 }
+        }
+    ]
+}
+