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

[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.
Читати далі

[EN] Using scons with QtCreator (on Mixxx example)

Intro

Mixxx has everything you need to start making DJ mixes in a tight, integrated package.”

We’ll try to compile it and by the way, understand how to make QtCreator use scons build system instead of qmake. Why not use qmake? SCons is implemented as a Python script and set of modules, and SCons “configuration files” are actually executed as Python scripts. This gives SCons many powerful capabilities not found in other software build tools. Here is SCons vs other build tools.

Читати далі

Fuzzy queries to relational databases [EN]

Translation of article BaseGroup Labs — Нечеткие запросы к реляционным базам данных (Nikolay Palkin)

[D R A F T]

Intro

Mechanisms of fuzzy queries (fuzzy queries, flexible queries) to relational databases are based on the Zadeh theory of
fuzzy sets, first proposed in 1984 and subsequently developed in works of Dubois, Prada.

Читати далі

[EN] HOWTO: Compile Shark Machine Learning Library on Windows using MinGW, CMake

Shark Machine Learning Library (http://shark-project.sourceforge.net/) is a modular C++ library for the design and optimization of adaptive systems. It provides methods for linear and nonlinear optimization, in particular evolutionary and gradient-based algorithms, kernel-based learning algorithms and neural networks, and various other machine learning techniques. SHARK serves as a toolbox to support real world applications as well as research in different domains of computational intelligence and machine learning. The sources are compatible with the following platforms: Windows, Solaris, MacOS X, and Linux.

You can get source here: http://sourceforge.net/projects/shark-project/files/ or thru SVN from here: http://sourceforge.net/projects/shark-project/develop.

Here http://shark-project.sourceforge.net/GettingStarted.html you can read how to compile Shark library, but installing and compiling Shark on Windows systems is not so clear for typical users.

So, to compile, you must have installed this software:

Latest MinGW (http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/).
Latest CMake (http://www.cmake.org/cmake/resources/software.html).

When you unpack Shark sources, go to Shark root directory, and create file script.bat:

mkdir <path-to-build-dir>
cd <path-to-build-dir>
<path-to-CMake-bin>\cmake.exe -G"MinGW Makefiles" <path-to-Shark-sources>
<path-to-mingw-bin>\mingw32-make.exe

For example, I unpacked Shark sources to d:\PROJECTS\NEURAL\Shark\, and there I created such script file:

mkdir d:\PROJECTS\NEURAL\Shark_bin
cd d:\PROJECTS\NEURAL\Shark_bin
"d:\WORKSHOP\CMake 2.8\bin\cmake.exe" -G"MinGW Makefiles" d:\PROJECTS\NEURAL\Shark\
"c:\MinGW\bin\mingw32-make.exe"

Example of using Shark with Qt. In .pro file add:

SHARKHOME = "d:/PROJECTS/NEURAL/Shark/"
CONFIG  = qt console
INCLUDEPATH = $${SHARKHOME}/include
win32{
   LIBS = -L$${SHARKHOME}/lib/ -lshark
}
...

That’s all!