在QML中,我常常寫類似這樣的東西:
Item {
id: settings
property alias snapshot: snapshot
Item {
id: snapshot
property string saveDirectory: "~/hello/world/"
}
}| var sqlite3 = require('sqlite3').verbose(); | |
| var db = new sqlite3.Database('benchmark_tmp.db'); | |
| var dateFormat = require('dateformat'); | |
| const ROWS = 100000 | |
| db.serialize(function() { | |
| let begin | |
| db.serialize(function() { | |
| db.run("CREATE TABLE date_time (ctime DATETIME)") |
| (defun sort-ip (ip-list) | |
| (sort ip-list #'>ip)) | |
| (defun >ip (a b) | |
| (if (and (null a) (null b)) | |
| nil | |
| (let ((x (car a)) | |
| (y (car b))) | |
| (cond ((> x y) t) | |
| ((< x y) nil) |
| // === colors ==== | |
| $colors: | |
| "base_grey" #e8e8e8, | |
| "base_white" #fff, | |
| "base_black" #333, | |
| "switch1_color" #e6943b, | |
| "swtich2_color" #56b538, | |
| "wireless_color" #4baae2, | |
| "router_color" #969696, | |
| "ite_color" #756bb1, |
| (defun mmm-mode-restart! () | |
| (interactive) | |
| (widen) | |
| (let ((ext (file-name-extension (buffer-name)))) | |
| (cond ((string= ext "jade") | |
| (jade-mode)) | |
| ((string= ext "vue") | |
| (html-mode)) | |
| (t nil)) |
在QML中,我常常寫類似這樣的東西:
Item {
id: settings
property alias snapshot: snapshot
Item {
id: snapshot
property string saveDirectory: "~/hello/world/"
}
}這個範例中使用 Loader { sourceComponent: block } 來載入名為 block 的 component,會導致 ColumnLayout 無法在 block 的 visible 狀態改變時自動調整大小。
然而,如果把 block 獨立出成單一檔案 Block.qml ,然後直接在 ColumnLayout 中使用 Block {} 來載入 component,就沒有上述問題,Layout能夠自動根據 Block 的 visible 來自動調整大小。
| Item { | |
| id: videoArea | |
| anchors.top: parent.top | |
| width: parent.width | |
| height: parent.height - panelRectangle.height | |
| VideoOutput2 { | |
| id: videoOutput | |
| anchors.fill: parent | |
| source: player | |
| } |
| Canvas { | |
| id: canvasTest | |
| property int ratio: Screen.devicePixelRatio | |
| width: 100 //* ratio | |
| height: 100 //* ratio | |
| //scale: 1/ratio | |
| Path { | |
| id: myPath1 | |
| startX: 0; startY: 50 |
| #! /usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import os, subprocess, re | |
| import fileinput | |
| def replaceTabInFile(filePath): | |
| print("Processing file {} ...".format(filePath)) | |
| with fileinput.FileInput(filePath, inplace=True) as f: | |
| for line in f: |
| (setq hexo-help-buffer "*hexo-help*") | |
| (defun hexo-command-open-fixed-help-window () | |
| (interactive) | |
| (select-window (split-window-below -6)) | |
| (if (not (get-buffer hexo-help-buffer)) | |
| (temp-buffer-window-setup hexo-help-buffer)) | |
| (switch-to-buffer hexo-help-buffer) | |
| (let ((inhibit-read-only t)) | |
| (insert (hexo-get-help-string))) |