This example illustrates how QSortFilterProxyModel and QAbstractListModel can be used to display a list of filterable items in QML and Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Calvin Rien | |
// http://the.darktable.com | |
// | |
// This software is provided 'as-is', without any express or implied warranty. In | |
// no event will the authors be held liable for any damages arising from the use | |
// of this software. | |
// | |
// Permission is granted to anyone to use this software for any purpose, | |
// including commercial applications, and to alter it and redistribute it freely, | |
// subject to the following restrictions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicInheritance(type): | |
""" | |
Dinamicaly modify class with some extra mixins. | |
""" | |
def __call__(cls, *args, **kwargs): | |
_mixins = kwargs.pop("_mixins", None) | |
if _mixins: | |
assert isinstance(_mixins, tuple), "_mixin patemeter must be a tuple" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
foo=${1:-hoge} | |
echo $foo #$1がなかったらhogeをデフォルト値としてfooに代入する | |
#var自身にデフォルト値としてhogeを代入としたいので以下のように書きたい | |
${var:=hoge} #このままでは、hogeが展開されてしまって、hogeなんてコマンドはないとシェル怒られる | |
echo "1:$var" | |
var= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
if文の中が1行のとき,どれがベストなのか | |
コメント募集(下記以外の方法でも可) | |
*/ | |
// 01 | |
if (true) println("true"); | |
// 02 | |
if (true) |
This example illustrates how to intercept log records and visualise them using Python and QML with QAbstractListModel, QSortFilterProxyModel and a custom logging handler.
Run filtering_log.py
; it will load filtering_log.qml
which will need to be located in the same directory.
https://ja.wikipedia.org/wiki/JavaScript_Object_Notation
- Python標準に含まれている
- 仕様が厳格に決まっている
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.4 | |
Item { | |
id: root | |
width: 800 | |
height: 600 | |
property int xOverlap: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import (absolute_import, division, print_function, | |
unicode_literals) | |
from sqlalchemy import Column, MetaData, Table, create_engine | |
from sqlalchemy import String, Integer, Float, BigInteger, DateTime | |
from sqlalchemy.schema import DropTable, CreateTable | |
from sqlalchemy.orm import scoped_session, sessionmaker | |
## 見出し2
### 見出し3
#### 見出し4
##### 見出し5
###### 見出し6 ## Block 段落 空白行を挟むことで段落となります。 ```
段落1
(空行)
段落2
``` 段落1 段落2 ## Br 改行 改行の前に半角スペース` `を2つ記述します。 ```
hoge
fuga(スペース2つ)
piyo
``` hoge
fuga piyo ## Blockquotes 引用 先頭に`>`を記述します。ネストは`>`を多重に記述します。 ```
> 引用 > 引用
>> 多重引用
``` > 引用 > 引用
>> 多重引用 ## Code コード `` `バッククオート` `` 3つ、あるいはダッシュ`~`3つで囲みます。 ```
print 'hoge'
``` ```
print 'hoge'
``` ### インラインコード `` `バッククオート` `` で単語を囲むとインラインコードになります。 ```
これは `インラインコード`です。
``` これは `インラインコード`です。 ## pre 整形済みテキスト 半角スペース4個もしくはタブで、コードブロックをpre表示できます ``` class Hoge def hoge print 'hoge' end end
``` class Hoge def hoge print 'hoge' end end ## Hr 水平線 アンダースコア`_` 、アスタリスク`*`、ハイフン`-`などを3つ以上連続して記述します。 ```
hoge
***
hoge
___
hoge
---
``` hoge
***
hoge
___
hoge
--- # Lists ## Ul 箇条書きリスト ハイフン`-`、プラス`+`、アスタリスク`*`のいずれかを先頭に記
OlderNewer