translate

嵌入式Qt方案中文显示系列:应用程序本地中文显示的实现

 ̄綄美尐妖づ 提交于 2019-12-01 18:58:01
嵌入式Qt应用程序进行中文显示有两种解决方案,一种是直接在代码中使用中文,利用QTextCodec类来实现,另一种是使用qt平台的国际化支持机制,通过语言翻译来实现。第一种方案直接明了,相对来说也简单方便一点,除了编码时麻烦点(来回切换输入法),而第二种方法的优点是具有良好的扩展性,代码中全部使用英文,然后使用中文翻译文件来进行语言翻译,当需要其它语言方案时,只需要添加翻译文件就可以。这里先介绍第一种方案,之后再写第二方案的文章。 方案实现 直接使用中文,利用QTextCodec类来实现中文的显示方案实现通过下面的三个步骤: 中文字体文件的存在:前文提到过字体文件的内容,文泉驿字体库是支持中文的。 应用程序代码中QTextCodec的设置和QFont字体的设置:对整个应用程序来说,一般是放在main函数中进行设置,大概的代码如下: int main(int argc, char *argv[]) { QApplication app(argc,argv); ... QTextCodec* codec = QTextCodec::codecForName("UTF-8"); app.setFont(QFont("wenquanyi",16,75,FALSE,QFont::Unicode)); app.setDefaultCodec(codec); ... return app

Translate + Canvas = Blurry Text

对着背影说爱祢 提交于 2019-12-01 13:18:25
There are more than a few "CSS transform = blurry text" entries on SO already but I think I have a unique doozy here. I have tried all the other fixes with no avail. I'm implementing the CSS transform center / middle align method: .centered { position: absolute; top: 50%; left: 50%; -webkit-transform-style: preserve-3d; -webkit-transform: translate(-50%,-50%); } Once I apply an image via drawImage AND resize the canvas that is underneath the .centered element, the text starts blurring on the "half pixel". The -webkit-transform-style: preserve-3d fix has no effect. This only happens in Chrome

Translate + Canvas = Blurry Text

时光总嘲笑我的痴心妄想 提交于 2019-12-01 10:43:46
问题 There are more than a few "CSS transform = blurry text" entries on SO already but I think I have a unique doozy here. I have tried all the other fixes with no avail. I'm implementing the CSS transform center / middle align method: .centered { position: absolute; top: 50%; left: 50%; -webkit-transform-style: preserve-3d; -webkit-transform: translate(-50%,-50%); } Once I apply an image via drawImage AND resize the canvas that is underneath the .centered element, the text starts blurring on the

Chrome is now blurring text when using transform translateY with percent

吃可爱长大的小学妹 提交于 2019-12-01 07:36:37
问题 Since a few days, I'm experimenting a pretty big issue when using the very cool technique for vertically centering a div with css3 transform (transform: translateY(-50%); ) described here: https://davidwalsh.name/css-vertical-center Indeed, the elements (text or images) included in this div get blurry. I tried a lot of techniques (transform: translateZ(0); backface-visibility; scale(1); translateX( calc( -50% + 0.5px ) ); filter: blur(0); and so on). But nothing actually works. The only one

How can I return a Dictionary<string, Object> as JsonResult, AND get the proper result in JavaScript?

被刻印的时光 ゝ 提交于 2019-12-01 06:45:07
I'm constructing my JsonResult in Controller by adding some extra information to an already existing JsonResult (returned from a different method). In order to add more properties, I converted the initial JsonResult into a Dictionary: IDictionary<string, object> wrapper = (IDictionary<string, object>)new System.Web.Routing.RouteValueDictionary(json.Data); Then I just add data by writing wrapper["..."] = "value" . The method returns a new JsonResult, with wrapper as .Data: new JsonResult() { wrapper, JsonRequestBehavior.AllowGet }; and that's where the troubles start; while communication

How can I return a Dictionary<string, Object> as JsonResult, AND get the proper result in JavaScript?

放肆的年华 提交于 2019-12-01 05:45:57
问题 I'm constructing my JsonResult in Controller by adding some extra information to an already existing JsonResult (returned from a different method). In order to add more properties, I converted the initial JsonResult into a Dictionary: IDictionary<string, object> wrapper = (IDictionary<string, object>)new System.Web.Routing.RouteValueDictionary(json.Data); Then I just add data by writing wrapper["..."] = "value" . The method returns a new JsonResult, with wrapper as .Data: new JsonResult() {

How to use the QGraphicsView's translate() function?

喜欢而已 提交于 2019-12-01 03:19:50
here i have a scene and a associated view ,then i hava a position in the scene coordinates.I want to set the center of the viewport with the position.How can i do it? I try to use the translate() function but it didn't work? view->translate(10, 10); The viewport should move with the delta x 10, and delta y 10, but it didn't work! Center As said Frank Osterfeld , to center your viewport at a given position, you can simply use the function centerOn . Translate But to translate your viewport, it exists another way that consists to change your scrollbars position : // Your graphics view

OpenCV: Shift/Align face image relative to reference Image (Image Registration)

北战南征 提交于 2019-11-30 16:11:06
问题 I am new to OpenCV2 and working on a project in emotion recognition and would like to align a facial image in relation to a reference facial image. I would like to get the image translation working before moving to rotation. Current idea is to run a search within a limited range on both x and y coordinates and use the sum of squared differences as error metric to select the optimal x/y parameters to align the image. I'm using the OpenCV face_cascade function to detect the face images, all

Zend Framework 2 - translating routes

孤者浪人 提交于 2019-11-30 10:30:25
I am wondering if it is possible to use translational tools for routes/uris in zf2. I want for example the route en.domain.tld/article/show/1 to translate for example to de.domain.tld/artikel/anzeigen/1 . I don't think regex is the way to go here, because it could result in something like en.domain.tld/artikel/show/1 . Also I want to avoid creating routes for every language, because it is going to get quite messy as the system scales. I was able to get it working! First, add a 'router_class' => 'Zend\Mvc\Router\Http\TranslatorAwareTreeRouteStack', your module.config.php like this: return array

Offline language translation API [closed]

半城伤御伤魂 提交于 2019-11-30 07:08:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Please note that I am aware that this question has appeared in various forms at several places, including stackoverflow, but I have yet to see a satisfying answer. There are several pretty solid language translation APIs out there (eg., Microsoft and Google). They are HTTP RESTful APIs that work well for web or