原来一直以为qmlRegisterType一次只能注册一个类,今天看了一个大佬的源码之后,发现同一个模块名可以导入多个类 示例:
qmlRegisterType<ClassA>("Class",1,0,"Class1");
qmlRegisterType<ClassB>("Class",1,0,"Class2");
qmlRegisterType<ClassC>("Class",1,0,"Class3");这样在qml文件可以这样使用
import Class 1.0| package main | |
| import ( | |
| "log" | |
| "os/exec" | |
| "time" | |
| ) | |
| func main() { | |
| cmd := exec.Command("ping", "www.baidu.com") |
| ## | |
| # chang the image color to another color, such as white to red | |
| ## | |
| import Image | |
| import numpy as np | |
| im = Image.open('test.png') | |
| im = im.convert('RGBA') | |
| data = np.array(im) # "data" is a height x width x 4 numpy array |
| """ | |
| This creates the following GIF, where the text appears to be "embedded" | |
| in the video and "disappears" behind rapunzel. | |
| http://i.imgur.com/gxEHfLX.gif | |
| """ | |
| from moviepy.editor import * | |
| import numpy as np | |
| import skimage.morphology as skm |
| """ | |
| An alternative text clip for Moviepy, relying on Gizeh instead of ImageMagick | |
| Advantages: | |
| - Super fast (20x faster) | |
| - no need to install imagemagick | |
| - full-vector graphic, no aliasing problems | |
| - Easier font names | |
| Disadvantages: |
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| func Decorate(impl interface{}) interface{} { | |
| fn := reflect.ValueOf(impl) |
原来一直以为qmlRegisterType一次只能注册一个类,今天看了一个大佬的源码之后,发现同一个模块名可以导入多个类 示例:
qmlRegisterType<ClassA>("Class",1,0,"Class1");
qmlRegisterType<ClassB>("Class",1,0,"Class2");
qmlRegisterType<ClassC>("Class",1,0,"Class3");这样在qml文件可以这样使用
import Class 1.0在main.cpp中添加
QFontDatabase::addApplicationFont("xxx.ttf")然后就可以在qml文件中使用font.family="xxx"来设置字体,这样比在qml文件中使用Fontloader更方便。
bool mouseTracking
这个属性保存的是窗口部件跟踪鼠标是否生效。
如果鼠标跟踪失效(默认),当鼠标被移动的时候只有在至少一个鼠标按键被按下时,这个窗口部件才会接收鼠标移动事件。
如果鼠标跟踪生效,如果没有按键被按下,这个窗口部件也会接收鼠标移动事件。
也可以参考mouseMoveEvent ()和QApplication::setGlobalMouseTracking ()。
形式:小写:{{ name | lower }}
串联:先转义文本到HTML,再转换每行到<p>标签:{{ my_text|escape|linebreaks }}
过滤器的参数