Skip to content

Instantly share code, notes, and snippets.

View Kakadu's full-sized avatar

Dmitrii Kosarev Kakadu

  • (ex-)JetBrains Research
  • Saint-Petersburg, Russia
View GitHub Profile
@Kakadu
Kakadu / PanelButton.qml
Created February 1, 2014 21:14
QtQuick 2.0 list of buttons with onClicked handlers
import QtQuick 2.0
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: 20
radius: 10
border.width: 1
property string title
color: "lightgray"
@Kakadu
Kakadu / ListItem.qml
Created February 8, 2014 18:57
ListView for buttons with custom onclick events. In this implementation button onclick handler is placed in model near to useful properties of button. I don't want to place them far away of button descriptions because it breaks readability.
import QtQuick 2.0
Rectangle {
id: root
anchors { left: parent.left; right: parent.right }
height: 30
color: "gray"
radius: 15
border.width: 1
@Kakadu
Kakadu / 1.qml
Last active August 29, 2015 13:56
The 2nd variant is 100% correct implementation. But it introduces dummy identifier which creation I want ot avoid. 1st peice of code is about avoiding it. I dont introduce variable there, I set property value to VisualListItem explicitly. It seems to work correctly but QtCreator's syntax highlighter doesn't understand it as expected. Am I missin…
Item {
property variant forestQuest1: _forestQuest1
Rectangle {
id: _forestQuest1
property variant choices: VisualItemModel {
id: _forest1_choices
QuestButton { ... }
open Eliom_openid
open Lwt
let messages =
let scope = (Eliom_common.default_process_scope :> Eliom_common.user_scope) in
Eliom_state.create_volatile_table ~scope ()
(* The login form *)
let login_form = Eliom_service.App.service
~path:["login-form"]
@Kakadu
Kakadu / Root.qml
Last active August 29, 2015 13:58
Expected: City1____ and City1____. Got: City1____ and undefined. Why when strict mode is enabled eval("images.city1") is evaluated by QML JS engine into undefined? Plain javascript object are evaluated OK (not into undefined).
import QtQuick 2.1
import "global.js" as Global
import "ocaml.js" as OCaml
Rectangle {
width: 1224; height: 600; color: "lightgray";
Item { id: images; visible: false
property string city1: "City1____"
@Kakadu
Kakadu / a.qml
Created June 4, 2014 08:20
QtQuick attached signal Add example
import QtQuick 2.1
Rectangle {
width: 800; height: 600
ListModel {
id: nameModel
ListElement { name: "Alice" }
ListElement { name: "Bob" }
@Kakadu
Kakadu / qt_install.sh
Last active August 29, 2015 14:03
Travis script to install qt.
#!/usr/bin/env bash
set +x +e
TAR=qt-everywhere-opensource-src-5.3.1
wget http://download.qt-project.org/archive/qt/5.3/5.3.1/single/$TAR.tar.xz
echo Unpacking....
tar -xf $TAR.tar.xz
cd $TAR
@Kakadu
Kakadu / get_qt5.sh
Last active August 29, 2015 14:04
Installing Qt5 on 12.04 with abandoning package dependencies.
#!/usr/bin/env bash
set -x -e
lsb_release -a
uname -a
UBUNTU_PREFIX=http://fr.archive.ubuntu.com/ubuntu/pool/main
PACKAGES="\
$UBUNTU_PREFIX/i/icu/libicu52_52.1-3_amd64.deb \
@Kakadu
Kakadu / Test.qml
Last active August 29, 2015 14:04
Demo for opening a dialog. I can't set initial directory for the fialog. Is it a bug?
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
ApplicationWindow {
width: 640
height: 480
FileDialog {
@Kakadu
Kakadu / APP.log
Last active August 29, 2015 14:08
Civ5 crash
[0.326] DBG: Command Line Args: