qml
authorjakub <jakub.jaszczynski@comarch.com>
Thu, 23 Dec 2010 11:46:53 +0000 (12:46 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Thu, 23 Dec 2010 11:46:53 +0000 (12:46 +0100)
src/mdictionary/gui/TranslationView.cpp
src/mdictionary/gui/TranslationView.h
src/mdictionary/qml/TranslationView.qml [new file with mode: 0644]

index 7e9cd8c..351ed6b 100644 (file)
 #include "TranslationView.h"
 #include "TranslationWidget.h"
 
-TranslationView::TranslationView(QWidget *parent) :
-    QWebView(parent)
-{
+
+
+TranslationView::TranslationView(QWidget *parent) : QWebView(parent) {
+
+#ifndef Q_WS_MAEMO_5
+
+    view= new QDeclarativeView();
+    view->setSource(QUrl("src/mdictionary/qml/TranslationView.qml"));
+    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+    view->setAlignment(Qt::AlignCenter);
+    view->show();
+
+#else
+
     realParent = qobject_cast<TranslationWidget*>(parent);
     searchSelectedAction = new QAction(tr("Search"), this);
     copySelectedAction = new QAction(tr("Copy"), this);
@@ -48,6 +59,8 @@ TranslationView::TranslationView(QWidget *parent) :
     connect(searchSelectedAction, SIGNAL(triggered()),
             this, SIGNAL(search()));
     connect(page(), SIGNAL(selectionChanged()), this, SLOT(selection()));
+
+#endif
 }
 
 void TranslationView::wheelEvent(QWheelEvent *e) {
index c3768dc..7db495d 100644 (file)
@@ -32,6 +32,8 @@
 #include <QAction>
 #include <QWebView>
 #include <QEvent>
+#include <QDeclarativeView>
+#include <QVBoxLayout>
 
 class TranslationWidget;
 
@@ -57,6 +59,9 @@ protected:
     void wheelEvent(QWheelEvent *);
 
 private:
+    QVBoxLayout* mainLayout;
+    QDeclarativeView *view;
+
     QAction* searchSelectedAction;
     QAction* copySelectedAction;
     QAction* selectAllAction;
diff --git a/src/mdictionary/qml/TranslationView.qml b/src/mdictionary/qml/TranslationView.qml
new file mode 100644 (file)
index 0000000..d020be1
--- /dev/null
@@ -0,0 +1,47 @@
+import Qt 4.7
+import QtWebKit 1.0
+
+Rectangle {
+    id: rectangle1
+    width: 500
+    height: 500
+
+
+
+    WebView {
+        id: web_view1
+        anchors.fill: parent
+        url: "http://kokos.pl/"
+
+        onDoubleClick: {
+            console.log(clickX,clickY);
+            heuristicZoom(clickX,clickY,2)
+        }
+       /* onZoomTo: {
+            console.log(zoom);
+            scale=zoom;x=width/2-centerX;
+            y=height/2-centerY
+       }
+       */
+    }
+
+    Button {
+        id: button1
+        textInButton: "test"
+        width: 200;
+        height: 30;
+        x: 41
+        y: 28
+        onClicked: web_view1.scale=web_view1.scale*1.05;
+    }
+
+    Button {
+        id: button2
+        textInButton: "test2"
+        width: 200;
+        height: 30;
+        x: 41
+        y: 68
+        onClicked: web_view1.scale=web_view1.scale*.95;
+    }
+}