Anchor animation in QML

Some time ago I was looking for clear way to provide anchor animation in QML.
First of all,

AnchorAnimation can only be used in a Transition and in conjunction with an AnchorChange. It cannot be used in behaviors and other types of animations.

But I want to have some pattern-like way to provide all animations inside project.

Now, I want to share my results, hope someone find it usefull.

Here is picture of how I done all:
testingAnchorsAnimation

What I’ve done in few words:

  • Created fakeLeftItem and anchored it to left of my main view
  • Explicitly set fakeLeftItem‘s width and heigth (if that fakeLeftItem is only for leftPanel, we can set its size to leftPanel‘s size). fakeLeftItem must be invisible, but we must understand that it is outside our main view.
  • leftPanel anchored to the top and to the bottom of main.
  • Next moment is anchoring of left side of leftPanel. It can be anchored to leftFakeItem.left — so panel will be hide; and to the main.left — so panel will be visible.

To animate anchor changes, I added states into leftPanel:

states: [ State {
  name: "show"
  AnchorChanges { 
    target: leftPanel
    anchors.left: parent.left 
  }},
 State {
  name: "hide"
  AnchorChanges { 
    target: leftPanel
    anchors.left: fakeLeftPanel.left 
  }} ]

Add animation effect on anchor changes is quite simple:

transitions: Transition {
  AnchorAnimation { duration: 200 }
} 

Thats all. Here you can seee whole qml-file: http://pastebin.com/b1C7vTbQ.

Advertisements

Evolus Pencil on Debian Jessie

There is no Firefox package in Debian. You can read about it here: http://en.wikipedia.org/wiki/Mozilla_Corporation_software_rebranded_by_the_Debian_project

If you found this article, it means that you tried to install Pencil from officially provided deb-package (today it is http://code.google.com/p/evoluspencil/downloads/detail?name=evoluspencil_2.0.5_all.deb&can=2&q=label%3A2.0.5+OpSys-Linux).

Generally, dpkg can not resolve firefox-dependency. I do not see any advantages of Firefox over Iceweasel. Keep in mind, that you can have only one of that applications — Firefox or Iceweasel. So I don’t want to install Firefox. Instead, I updated my Iceweasel guided by http://mozilla.debian.net/:

You need to add the following entry in /etc/apt/sources.list or a new file in /etc/apt/sources.list.d/:


deb http://cdn.debian.net/debian unstable main
deb http://cdn.debian.net/debian experimental main

You can install it with the following commands:


$ apt-get update
$ apt-get install -t experimental iceweasel

After that, I avoid firefox dependency in Pencil by simple swapping firefox to iceweasel in deb-package next way (as described here http://forums.debian.net/viewtopic.php?f=6&t=106325):

Basically what you have to do is extract the files from the deb


dpkg-deb -R file.deb temp-dir

Then edit DEBIAN/control and remove the firefox occurrence from the dependency list.

After that you repackage the deb

dpkg-deb -b temp-dir file-mod.deb

Once you’ve done that the installation should go smoothly and you can see if it works and in case it doesn’t, what errors it gives you.

[EN] Typical workflow with GitHub on shared project

Intro

I found this very strange, that all around the Internet there are lot of articles on how to do some extended techniques using git. But nowhere can find short, simple and easy recommendations on how to use GitHub to work on shared project.

This article is effort to describe typical workflow on shared project using git on GitHub.
Читати далі

[UA] Типовий підхід до роботи над спільним проектом засобами GitHub

Інтро

В Інтернеті є багато статей про те як користуватися git, є дуже багато статей про різного роду складні і вичурні техніки використання git.

Але, чомусь, ніде не знайшов толкового, простого і зрозуміло розписаного підходу до роботи засобами git над спільним проектом на GitHub.

Ця стаття — спроба описати підходу до роботи засобами git над спільним проектом на GitHub.

Читати далі

[EN] Rendering DPI in Qt’s WebKit

250px-Compass_in_a_box.svg

Some time ago, I stuck on reading manuals trying to find correct and clear way to enlarge DPI of images rendered by WebKit (in Qt).

If you need to render HTML page in your Qt app, you can use widgets that use QTextDocument, such as QLabel and QTextEdit. But all of them support limited subset of HTML 4 and CSS 2.1 (Qt Project — Supported HTML Subset). But if you need to use some more complicated things (or even some typical CSS styles) excluded from that list, you should use WebKit (WebKit in Qt).

Читати далі

[EN] FIXME story

Got some complaint from customer. My program got strange and unexpected behavior in some cases. It is needed to solve that problem.

When I find that peace of code, where problem happened, I become very confused and surprised.

In that code I find next line:

// FIXME: show msg after dbmanager say OK

I’m a bit embarrassing, but in the same time proud, that wrote that FIXME, respectively, thought forward…

Сonclusion:

  • Always write lot of TODO, FIXME, WARN,... in doubtful situations.
  • Always try to decrease amount of TODO, FIXME, WARN,... by avoiding all that issues (especially, FIXME).
  • Think on architecture of software.

“Педантичні” ключі GCC

Статичний аналіз

Цікавився питаннями статичного аналізу програмного коду програм на С/С++.

Статичний аналіз програмного коду – аналіз коду програмного забезпечення, що відбувається без реального запуску програм, що досліджуються (інакше, такий аналіз називається динамічним).

Здоровий глузд і здорова логіка підказує “Якщо такі є, то чого б не використовувати доступні засоби не виходячи за межі середовища програмування?!”

Читати далі