#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);
connect(searchSelectedAction, SIGNAL(triggered()),
this, SIGNAL(search()));
connect(page(), SIGNAL(selectionChanged()), this, SLOT(selection()));
+
+#endif
}
void TranslationView::wheelEvent(QWheelEvent *e) {
#include <QAction>
#include <QWebView>
#include <QEvent>
+#include <QDeclarativeView>
+#include <QVBoxLayout>
class TranslationWidget;
void wheelEvent(QWheelEvent *);
private:
+ QVBoxLayout* mainLayout;
+ QDeclarativeView *view;
+
QAction* searchSelectedAction;
QAction* copySelectedAction;
QAction* selectAllAction;
--- /dev/null
+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;
+ }
+}