Permalink
Browse files

port to Qt5

  • Loading branch information...
yinyunqiao committed Feb 7, 2012
1 parent c87784d commit a9d6a664a50c8f15295649160fb694db273717e9
Showing with 18 additions and 18 deletions.
  1. +6 −5 Writing.qml
  2. +9 −9 handwriting.cpp
  3. +2 −2 handwriting.pro
  4. +1 −2 main.qml
View
@@ -1,19 +1,16 @@
import "Canvas"
import Qt 4.7
import QtQuick 2.0
import "js/shortstraw.js" as Straw
import "js/script.js" as Script
Canvas {
id:canvas
color: "#D0D4D8"
property int paintX
property int paintY
property int count: 0
property int lineWidth: 5
property variant drawColor: "black"
property variant ctx: getContext("2d");
property int strokes: 0
@@ -33,6 +30,7 @@ Canvas {
}
onReleased: {
var ctx = canvas.getContext('2d');
var array = Straw.shortStraw(Script.getList());
ctx.beginPath();
@@ -55,6 +53,7 @@ Canvas {
}
function drawLineSegment() {
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.strokeStyle = drawColor
ctx.lineWidth = lineWidth
@@ -65,15 +64,17 @@ Canvas {
}
function drawPoint() {
var ctx = canvas.getContext('2d');
ctx.lineWidth = lineWidth
ctx.fillStyle = drawColor
ctx.fillRect(mousearea.mouseX, mousearea.mouseY, 2, 2);
}
function clear() {
var ctx = canvas.getContext('2d');
strokes=0;
text.text = "";
Zinnia.clear();
ctx.clearRect(0, 0, width, height);
}
}
}
View
@@ -1,8 +1,8 @@
#include <QApplication>
#include <QDeclarativeView>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include <QTextCodec>
#include <QtGui/QGuiApplication>
#include <QtQuick/QQuickView>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
#include <QtCore/QTextCodec>
#include <zinnia.h>
class ApplicationData : public QObject
@@ -38,14 +38,14 @@ class ApplicationData : public QObject
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QDeclarativeView view;
QGuiApplication app(argc, argv);
QQuickView view;
ApplicationData data;
data.recognizer = zinnia::Recognizer::create();
if (!data.recognizer->open("/usr/share/tegaki/models/zinnia/handwriting-zh_TW.model"))
if (!data.recognizer->open("/usr/share/tegaki/models/zinnia/handwriting-zh_CN.model"))
qDebug("can't load model file");
else qDebug("model \"handwriting-zh_TW.model\" loaded");
else qDebug("model \"handwriting-zh_CN.model\" loaded");
data.character = zinnia::Character::create();
data.character->clear();
View
@@ -1,11 +1,11 @@
TEMPLATE = app
TARGET = qml-handwriting
CONFIG += qt
QT += declarative
QT += quick
SOURCES += handwriting.cpp
unix {
CONFIG += link_pkgconfig
PKGCONFIG += zinnia
}
}
View
@@ -1,5 +1,4 @@
import "Canvas"
import Qt 4.7
import QtQuick 2.0
Item {
id:root

1 comment on commit a9d6a66

@toby20130333

This comment has been minimized.

Show comment
Hide comment
@toby20130333

toby20130333 Jun 15, 2015

还有人吗?我在zinnia官网下载不了这些库和头文件呢

toby20130333 commented on a9d6a66 Jun 15, 2015

还有人吗?我在zinnia官网下载不了这些库和头文件呢

Please sign in to comment.